xtd 0.2.0
isynchronize_invoke.hpp
Go to the documentation of this file.
1
4#pragma once
5#include "any_object.hpp"
6#include "array.hpp"
7#include "delegate.hpp"
8#include "async_result.hpp"
9#include "interface.hpp"
10#include "object_ref.hpp"
11#include "optional.hpp"
12#include <memory>
13#include <vector>
14
16namespace xtd {
28 public:
30
35 virtual bool invoke_required() const noexcept = 0;
37
39
46 virtual xtd::async_result begin_invoke(delegate<void()> method) = 0;
53 virtual xtd::async_result begin_invoke(delegate<void(xtd::array<xtd::any_object>)> value, const xtd::array<xtd::any_object>& args) = 0;
54
59 virtual std::optional<object_ref> end_invoke(xtd::async_result async) = 0;
60
66 virtual std::optional<object_ref> invoke(delegate<void()> value) = 0;
73 virtual std::optional<object_ref> invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::array<xtd::any_object>& args) = 0;
80 virtual std::optional<object_ref> invoke(delegate<void(xtd::array<xtd::any_object>)> method, const xtd::any_object& arg) = 0;
82
84 template<class delegate_t>
85 xtd::async_result begin_invoke(delegate_t value, const xtd::array<xtd::any_object>& args) {return begin_invoke(delegate<void(xtd::array<xtd::any_object>)>(value), args);}
86
87 template<class delegate_t>
88 xtd::async_result begin_invoke(delegate_t value) {return begin_invoke(delegate<void(xtd::array<xtd::any_object>)>(value), {});}
89
90 template<class delegate_t>
91 void invoke(delegate_t value, const xtd::array<xtd::any_object>& args) {invoke(delegate<void(xtd::array<xtd::any_object>)>(value), args);}
92
93 template<class delegate_t, class args_t>
94 void invoke(delegate_t value, args_t args) {invoke(delegate<void(xtd::array<xtd::any_object>)>(value), xtd::any_object(args));}
95
96 template<class delegate_t>
97 void invoke(delegate_t value) {invoke(delegate<void(xtd::array<xtd::any_object>)>(value), xtd::array<xtd::any_object> {});}
99 };
100}
Contains xtd::any_object class.
Contains xtd::array class.
Contains xtd::async_result alias.
Represent a polymorphic wrapper capable of holding any type.
Definition any_object.hpp:29
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:61
Provides a way to synchronously or asynchronously execute a delegate.
Definition isynchronize_invoke.hpp:27
virtual std::optional< object_ref > end_invoke(xtd::async_result async)=0
Waits until the process started by calling xtd::isynchronize_invoke::begin_invoke completes,...
virtual std::optional< object_ref > invoke(delegate< void()> value)=0
Synchronously executes the delegate on the thread that created this object and marshals the call to t...
virtual bool invoke_required() const noexcept=0
Gets a value indicating whether the caller must call Invoke(Delegate, Object[]) when calling an objec...
virtual xtd::async_result begin_invoke(delegate< void()> method)=0
Asynchronously executes the delegate on the thread that created this object.
The xtd::shared_ptr_object is a shared pointer as std::shared_ptr.
Definition shared_ptr_object.hpp:30
Contains xtd::delegate <result_t(arguments_t...)> delegate.
#define interface_
This keyword is use to represent an interface.
Definition interface.hpp:58
std::optional< type_t > optional
Represents the null_opt alias on std::nullopt_t.
Definition optional.hpp:175
std::reference_wrapper< object > object_ref
Represents an object reference.
Definition object_ref.hpp:20
Contains xtd::interface interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::object_ref alias.
Contains xtd::optional type.