xtd 0.2.0
Loading...
Searching...
No Matches
isynchronize_invoke.h
Go to the documentation of this file.
1
4#pragma once
5#include "delegate.h"
6#include "async_result.h"
7#include "interface.h"
8#include "object_ref.h"
9#include <any>
10#include <memory>
11#include <optional>
12#include <vector>
13
15namespace xtd {
27 public:
29
34 virtual bool invoke_required() const noexcept = 0;
36
38
45 virtual xtd::async_result begin_invoke(delegate<void()> method) = 0;
52 virtual xtd::async_result begin_invoke(delegate<void(std::vector<std::any>)> value, const std::vector<std::any>& args) = 0;
53
58 virtual std::optional<object_ref> end_invoke(xtd::async_result async) = 0;
59
65 virtual std::optional<object_ref> invoke(delegate<void()> value) = 0;
72 virtual std::optional<object_ref> invoke(delegate<void(std::vector<std::any>)> method, const std::vector<std::any>& args) = 0;
79 virtual std::optional<object_ref> invoke(delegate<void(std::vector<std::any>)> method, std::any arg) = 0;
81
83 template<typename delegate_t>
84 xtd::async_result begin_invoke(delegate_t value, const std::vector<std::any>& args) {return begin_invoke(delegate<void(std::vector<std::any>)>(value), args);}
85
86 template<typename delegate_t>
87 xtd::async_result begin_invoke(delegate_t value) {return begin_invoke(delegate<void(std::vector<std::any>)>(value), {});}
88
89 template<typename delegate_t>
90 void invoke(delegate_t value, const std::vector<std::any>& args) {invoke(delegate<void(std::vector<std::any>)>(value), args);}
91
92 template<typename delegate_t, typename args_t>
93 void invoke(delegate_t value, args_t args) {invoke(delegate<void(std::vector<std::any>)>(value), std::any(args));}
94
95 template<typename delegate_t>
96 void invoke(delegate_t value) {invoke(delegate<void(std::vector<std::any>)>(value), std::vector<std::any> {});}
98 };
99}
Contains xtd::async_result alias.
Provides a way to synchronously or asynchronously execute a delegate.
Definition isynchronize_invoke.h:26
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.
Contains xtd::delegate delegate.
#define interface_
This keyword is use to represent an interface.
Definition interface.h:58
std::shared_ptr< xtd::iasync_result > async_result
Represents the status of an asynchronous operation.
Definition async_result.h:16
std::reference_wrapper< object > object_ref
Represents an object reference.
Definition object_ref.h:18
@ any
Indicates that all styles except allow_binary_specifier, allow_octal_specifier and allow_hex_specifie...
Contains xtd::interface interface.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::object_ref alias.