diff --git a/doxygen/html/_delegate_8h_source.html b/doxygen/html/_delegate_8h_source.html index f958f0d..0729614 100644 --- a/doxygen/html/_delegate_8h_source.html +++ b/doxygen/html/_delegate_8h_source.html @@ -160,344 +160,390 @@
- - - - - - - - -DelegateFreeAsync<>
class asynchronously invokes a free target function. More...DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function. More...DelegateMemberAsync<>
class asynchronously invokes a class member target function. More...DelegateMemberSpAsync<>
class asynchronously invokes a std::shared_ptr target function. More...DelegateMember<>
class synchronously invokes a class member target function using a class object pointer DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function DelegateMemberAsync<>
class asynchronously invokes a class member target function DelegateMemberAsyncWait<>
class asynchronously block invokes a class member target function bool
. bool
.
+
|
+ +inlinenoexcept | +
Move constructor that transfers ownership of resources.
+[in] | rhs | The object to move from. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
bool
. bool
.
+
|
+ +inlinenoexcept | +
Move constructor that transfers ownership of resources.
+[in] | rhs | The object to move from. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
Public Member Functions | |
DelegateFreeAsyncWait (FreeFunc func, DelegateThread &thread, std::chrono::milliseconds timeout) | |
Constructor to create a class instance. | |
DelegateFreeAsyncWait (FreeFunc func, DelegateThread &thread, std::chrono::milliseconds timeout=WAIT_INFINITE) | |
Constructor to create a class instance. | |
DelegateFreeAsyncWait (const ClassType &rhs) | |
Copy constructor that creates a copy of the given instance. | |
DelegateFreeAsyncWait (ClassType &&rhs) noexcept | |
Move constructor that transfers ownership of resources. | |
DelegateFreeAsyncWait ()=delete | |
void | Bind (FreeFunc func, DelegateThread &thread) |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
virtual bool | operator== (const DelegateBase &rhs) const override |
Compares two delegate objects for equality. | |
virtual void | DelegateInvoke (std::shared_ptr< DelegateMsg > msg) override |
Invoke the delegate function on the destination thread. Called by the destination thread. | |
bool | IsSuccess () |
RetType | GetRetVal () |
bool | IsSuccess () noexcept |
RetType | GetRetVal () noexcept |
Public Member Functions inherited from DelegateLib::DelegateFreeAsync< RetType(Args...)> | |
DelegateFreeAsync (FreeFunc func, DelegateThread &thread) | |
Constructor to create a class instance. | |
DelegateFreeAsync (const ClassType &rhs) | |
Copy constructor that creates a copy of the given instance. | |
DelegateFreeAsync (ClassType &&rhs) noexcept | |
Move constructor that transfers ownership of resources. | |
DelegateFreeAsync ()=delete | |
void | Bind (FreeFunc func, DelegateThread &thread) |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
void | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously. Do not wait for return value. Called by the source thread. | |
DelegateThread & | GetThread () |
Get the destination thread that the target function is invoked on. | |
DelegateThread & | GetThread () noexcept |
Get the destination thread that the target function is invoked on. | |
Public Member Functions inherited from DelegateLib::DelegateFree< RetType(Args...)> | |
DelegateFree (FreeFunc func) | |
Constructor to create a class instance. | |
DelegateFree (const ClassType &rhs) | |
Copy constructor that creates a copy of the given instance. | |
DelegateFree (ClassType &&rhs) noexcept | |
Move constructor that transfers ownership of resources. | |
DelegateFree ()=default | |
Default constructor creates an empty delegate. | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
bool | Empty () const |
Check if the delegate is bound to a target function. | |
void | Clear () |
Clear the target function. | |
operator bool () const | |
Implicit conversion operator to bool . | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
bool | Empty () const noexcept |
Check if the delegate is bound to a target function. | |
void | Clear () noexcept |
Clear the target function. | |
operator bool () const noexcept | |
Implicit conversion operator to bool . | |
Public Member Functions inherited from DelegateLib::Delegate< RetType(Args...)> | |
Public Member Functions inherited from DelegateLib::DelegateBase | |
DelegateBase ()=default | - | std::chrono::milliseconds | timeout ) | +std::chrono::milliseconds | timeout = WAIT_INFINITE ) |
+
|
+ +inlinenoexcept | +
Move constructor that transfers ownership of resources.
+[in] | rhs | The object to move from. |
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
The DelegateAsyncWaitMsg
does not duplicated and copy the function arguments into heap memory. The source thread waits on the destintation thread to complete, therefore argument data is shared between the source and destination threads and simultaneous access is prevented using a mutex.
[in] | args | The function arguments, if any. |
IsSuccess()
to determine if the return value is valid before use. IsSuccess()
to determine if the return value is valid before use. Reimplemented from DelegateLib::DelegateFreeAsync< RetType(Args...)>.
+
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
bool
. bool
. safe -= MakeDelegate(f2); // Should remove f2, not f1!
Depending on how usage, this may never be a issue but its worth noting.
-The DelegateMember<>
class has no such limitations and works under all conditions, including comparing two instance functions of the same class.
The other delegate class has no such limitations and works under all conditions, including comparing two instance functions of the same class.
RetType | The return type of the bound delegate function. |
+
|
+ +inlinenoexcept | +
Move constructor that transfers ownership of resources.
+[in] | rhs | The object to move from. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
bool
. bool
. Creates a copy of the current object.
-Clones the current instance of the class by creating a new object and copying the state of the current object to it.
ClassType
instance. Copy constructor that creates a copy of the given instance.
+This constructor initializes a new object as a copy of the provided rhs
(right-hand side) object. The rhs
object is used to set the state of the new instance.
[in] | rhs | The object to copy from. |
Invoke the delegate function on the destination thread.
-Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. Unlike DelegateAsyncWait
, a lock is not required between source and destination delegateMsg
access because the source thread is not waiting for the function call to complete.
Invoke the delegate function on the destination thread. Called by the destintation thread.
+Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. Unlike DelegateAsyncWait
, a lock is not required between source and destination delegateMsg
access because the source thread is not waiting for the function call to complete.
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
Get the synchronous target invoke flag.
-true
if operator()(Args... args)
is to invoke synchronously. false
means asychronously by sending a message. true
if operator()(Args... args)
is to invoke synchronously. false
means asychronously by sending a message. Invoke the bound delegate function asynchronously.
-Invoke delegate function asynchronously and do not wait for return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
Invoke the bound delegate function asynchronously. Called by the source thread.
+Invoke delegate function asynchronously and do not wait for return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
The DelegateAsyncMsg
duplicates and copies the function arguments into heap memory. The source thread is not required to place function arguments into the heap. The delegate library performs all necessary heap and argument coping for the caller. Ensure complex argument data types can be safely copied by creating a copy constructor if necessary.
[in] | args | The function arguments, if any. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
Public Member Functions | |
DelegateFunctionAsyncWait (FunctionType func, DelegateThread &thread, std::chrono::milliseconds timeout) | |
DelegateFunctionAsyncWait (FunctionType func, DelegateThread &thread, std::chrono::milliseconds timeout=WAIT_INFINITE) | |
DelegateFunctionAsyncWait (const ClassType &rhs) | |
DelegateFunctionAsyncWait ()=delete | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
virtual bool | operator== (const DelegateBase &rhs) const override |
Compares two delegate objects for equality. | |
virtual RetType | operator() (Args... args) override |
Invoke delegate function asynchronously and block for function return value. | |
Invoke delegate function asynchronously and block for function return value. Called by the source thread. | |
auto | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously and block for function return value. Called by the source thread. | |
virtual void | DelegateInvoke (std::shared_ptr< DelegateMsg > msg) override |
Invoke the delegate function on the destination thread. | |
Invoke the delegate function on the destination thread. Called by the destination thread. | |
bool | IsSuccess () |
RetType | GetRetVal () |
bool | IsSuccess () noexcept |
RetType | GetRetVal () noexcept |
Public Member Functions inherited from DelegateLib::DelegateFunctionAsync< RetType(Args...)> | |
DelegateFunctionAsync (FunctionType func, DelegateThread &thread) | |
Constructor to create a class instance. | |
DelegateFunctionAsync (const ClassType &rhs) | |
Creates a copy of the current object. | |
Copy constructor that creates a copy of the given instance. | |
DelegateFunctionAsync ()=delete | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
void | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously. Do not wait for return value. Called by the source thread. | |
DelegateThread & | GetThread () |
Get the destination thread that the target function is invoked on. | |
DelegateThread & | GetThread () noexcept |
Get the destination thread that the target function is invoked on. | |
Public Member Functions inherited from DelegateLib::DelegateFunction< RetType(Args...)> | |
DelegateFunction (FunctionType func) | |
Constructor to create a class instance. | |
DelegateFunction (const ClassType &rhs) | |
Creates a copy of the current object. | |
Copy constructor that creates a copy of the given instance. | |
DelegateFunction (ClassType &&rhs) noexcept | |
Move constructor that transfers ownership of resources. | |
DelegateFunction ()=default | |
Default constructor creates an empty delegate. | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
bool | Empty () const |
Check if the delegate is bound to a target function. | |
void | Clear () |
Clear the target function. | |
operator bool () const | |
Implicit conversion operator to bool . | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
bool | Empty () const noexcept |
Check if the delegate is bound to a target function. | |
void | Clear () noexcept |
Clear the target function. | |
operator bool () const noexcept | |
Implicit conversion operator to bool . | |
Public Member Functions inherited from DelegateLib::Delegate< RetType(Args...)> | |
Public Member Functions inherited from DelegateLib::DelegateBase | |
DelegateBase ()=default | - | std::chrono::milliseconds | timeout ) | +std::chrono::milliseconds | timeout = WAIT_INFINITE ) |
Invoke the delegate function on the destination thread.
-Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. A lock is used to protect source and destination thread shared data. A semaphore is used to signal the source thread when the destination thread completes the target function call.
Invoke the delegate function on the destination thread. Called by the destination thread.
+Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. A lock is used to protect source and destination thread shared data. A semaphore is used to signal the source thread when the destination thread completes the target function call.
If source thread timeout expires and before the destination thread invokes the target function, the target function is not called.
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
Invoke delegate function asynchronously and block for function return value.
-Invoke delegate function asynchronously and wait for the return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
Invoke delegate function asynchronously and block for function return value. Called by the source thread.
+Invoke delegate function asynchronously and wait for the return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
The DelegateAsyncWaitMsg
does not duplicated and copy the function arguments into heap memory. The source thread waits on the destintation thread to complete, therefore argument data is shared between the source and destination threads and simultaneous access is prevented using a mutex.
[in] | args | The function arguments, if any. |
IsSuccess()
to determine if the return value is valid before use. IsSuccess()
to determine if the return value is valid before use. Reimplemented from DelegateLib::DelegateFunctionAsync< RetType(Args...)>.
+
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
bool
. bool
.
+
|
+ +inlinenoexcept | +
Move constructor that transfers ownership of resources.
+[in] | rhs | The object to move from. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function.
+
DelegateMemberAsync<>
class asynchronously invokes a class member target function.
More...
#include <DelegateAsync.h>
bool
. bool
. DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function.
DelegateMemberAsync<>
class asynchronously invokes a class member target function.
TClass | The class type that contains the member function. |
RetType | The return type of the bound delegate function. |
Args | The argument types of the bound delegate function. |
Creates a copy of the current object.
-Clones the current instance of the class by creating a new object and copying the state of the current object to it.
ClassType
instance. Copy constructor that creates a copy of the given instance.
+This constructor initializes a new object as a copy of the provided rhs
(right-hand side) object. The rhs
object is used to set the state of the new instance.
[in] | rhs | The object to copy from. |
Invoke the delegate function on the destination thread.
-Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. Unlike DelegateAsyncWait
, a lock is not required between source and destination delegateMsg
access because the source thread is not waiting for the function call to complete.
Invoke the delegate function on the destination thread. Called by the destintation thread.
+Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. Unlike DelegateAsyncWait
, a lock is not required between source and destination delegateMsg
access because the source thread is not waiting for the function call to complete.
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
Get the synchronous target invoke flag.
-true
if operator()(Args... args)
is to invoke synchronously. false
means asychronously by sending a message. true
if operator()(Args... args)
is to invoke synchronously. false
means asychronously by sending a message. Invoke the bound delegate function asynchronously.
-Invoke delegate function asynchronously and do not wait for return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
Invoke the bound delegate function asynchronously. Called by the source thread.
+Invoke delegate function asynchronously and do not wait for return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
The DelegateAsyncMsg
duplicates and copies the function arguments into heap memory. The source thread is not required to place function arguments into the heap. The delegate library performs all necessary heap and argument coping for the caller. Ensure complex argument data types can be safely copied by creating a copy constructor if necessary.
[in] | args | The function arguments, if any. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
Public Member Functions | |
DelegateMemberAsyncWait (ObjectPtr object, MemberFunc func, DelegateThread &thread, std::chrono::milliseconds timeout) | |
DelegateMemberAsyncWait (ObjectPtr object, MemberFunc func, DelegateThread &thread, std::chrono::milliseconds timeout=WAIT_INFINITE) | |
DelegateMemberAsyncWait (ObjectPtr object, ConstMemberFunc func, DelegateThread &thread, std::chrono::milliseconds timeout) | |
DelegateMemberAsyncWait (const ClassType &rhs) | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
virtual bool | operator== (const DelegateBase &rhs) const override |
Compares two delegate objects for equality. | |
virtual RetType | operator() (Args... args) override |
Invoke delegate function asynchronously and block for function return value. | |
Invoke delegate function asynchronously and block for function return value. Called by the source thread. | |
auto | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously and block for function return value. Called by the source thread. | |
virtual void | DelegateInvoke (std::shared_ptr< DelegateMsg > msg) override |
Invoke the delegate function on the destination thread. | |
Invoke the delegate function on the destination thread. Called by the destination thread. | |
bool | IsSuccess () |
RetType | GetRetVal () |
bool | IsSuccess () noexcept |
RetType | GetRetVal () noexcept |
Public Member Functions inherited from DelegateLib::DelegateMemberAsync< TClass, RetType(Args...)> | |
DelegateMemberAsync (ObjectPtr object, MemberFunc func, DelegateThread &thread) | |
Constructor to create a class instance. | |
Constructor to create a class instance. | |
DelegateMemberAsync (const ClassType &rhs) | |
Creates a copy of the current object. | |
Copy constructor that creates a copy of the given instance. | |
DelegateMemberAsync ()=delete | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
void | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously. Do not wait for return value. Called by the source thread. | |
DelegateThread & | GetThread () |
Get the destination thread that the target function is invoked on. | |
DelegateThread & | GetThread () noexcept |
Get the destination thread that the target function is invoked on. | |
Public Member Functions inherited from DelegateLib::DelegateMember< TClass, RetType(Args...)> | |
DelegateMember (ObjectPtr object, MemberFunc func) | |
Constructor to create a class instance. | |
Constructor to create a class instance. | |
DelegateMember (const ClassType &rhs) | |
Creates a copy of the current object. | |
Copy constructor that creates a copy of the given instance. | |
DelegateMember (ClassType &&rhs) noexcept | |
Move constructor that transfers ownership of resources. | |
DelegateMember ()=default | |
Default constructor creates an empty delegate. | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
bool | Empty () const |
Check if the delegate is bound to a target function. | |
void | Clear () |
Clear the target function. | |
operator bool () const | |
Implicit conversion operator to bool . | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
bool | Empty () const noexcept |
Check if the delegate is bound to a target function. | |
void | Clear () noexcept |
Clear the target function. | |
operator bool () const noexcept | |
Implicit conversion operator to bool . | |
Public Member Functions inherited from DelegateLib::Delegate< RetType(Args...)> | |
Public Member Functions inherited from DelegateLib::DelegateBase | |
DelegateBase ()=default | - | std::chrono::milliseconds | timeout ) | +std::chrono::milliseconds | timeout = WAIT_INFINITE ) |
Invoke the delegate function on the destination thread.
-Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. A lock is used to protect source and destination thread shared data. A semaphore is used to signal the source thread when the destination thread completes the target function call.
Invoke the delegate function on the destination thread. Called by the destination thread.
+Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. A lock is used to protect source and destination thread shared data. A semaphore is used to signal the source thread when the destination thread completes the target function call.
If source thread timeout expires and before the destination thread invokes the target function, the target function is not called.
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
Invoke delegate function asynchronously and block for function return value.
-Invoke delegate function asynchronously and wait for the return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
Invoke delegate function asynchronously and block for function return value. Called by the source thread.
+Invoke delegate function asynchronously and wait for the return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
The DelegateAsyncWaitMsg
does not duplicated and copy the function arguments into heap memory. The source thread waits on the destintation thread to complete, therefore argument data is shared between the source and destination threads and simultaneous access is prevented using a mutex.
[in] | args | The function arguments, if any. |
IsSuccess()
to determine if the return value is valid before use. IsSuccess()
to determine if the return value is valid before use. Reimplemented from DelegateLib::DelegateMemberAsync< TClass, RetType(Args...)>.
+
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
bool
. bool
.
+
|
+ +inlinenoexcept | +
Move constructor that transfers ownership of resources.
+[in] | rhs | The object to move from. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
bool
. bool
. Creates a copy of the current object.
-Clones the current instance of the class by creating a new object and copying the state of the current object to it.
ClassType
instance. Copy constructor that creates a copy of the given instance.
+This constructor initializes a new object as a copy of the provided rhs
(right-hand side) object. The rhs
object is used to set the state of the new instance.
[in] | rhs | The object to copy from. |
Invoke the delegate function on the destination thread.
-Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. Unlike DelegateAsyncWait
, a lock is not required between source and destination delegateMsg
access because the source thread is not waiting for the function call to complete.
Invoke the delegate function on the destination thread. Called by the destintation thread.
+Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. Unlike DelegateAsyncWait
, a lock is not required between source and destination delegateMsg
access because the source thread is not waiting for the function call to complete.
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
Get the synchronous target invoke flag.
-true
if operator()(Args... args)
is to invoke synchronously. false
means asychronously by sending a message. true
if operator()(Args... args)
is to invoke synchronously. false
means asychronously by sending a message. Invoke the bound delegate function asynchronously.
-Invoke delegate function asynchronously and do not wait for return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
Invoke the bound delegate function asynchronously. Called by the source thread.
+Invoke delegate function asynchronously and do not wait for return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
The DelegateAsyncMsg
duplicates and copies the function arguments into heap memory. The source thread is not required to place function arguments into the heap. The delegate library performs all necessary heap and argument coping for the caller. Ensure complex argument data types can be safely copied by creating a copy constructor if necessary.
[in] | args | The function arguments, if any. |
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
Public Member Functions | |
DelegateMemberSpAsyncWait (ObjectPtr object, MemberFunc func, DelegateThread &thread, std::chrono::milliseconds timeout) | |
DelegateMemberSpAsyncWait (ObjectPtr object, MemberFunc func, DelegateThread &thread, std::chrono::milliseconds timeout=WAIT_INFINITE) | |
DelegateMemberSpAsyncWait (ObjectPtr object, ConstMemberFunc func, DelegateThread &thread, std::chrono::milliseconds timeout) | |
DelegateMemberSpAsyncWait (const ClassType &rhs) | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
virtual bool | operator== (const DelegateBase &rhs) const override |
Compares two delegate objects for equality. | |
virtual RetType | operator() (Args... args) override |
Invoke delegate function asynchronously and block for function return value. | |
Invoke delegate function asynchronously and block for function return value. Called by the source thread. | |
auto | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously and block for function return value. Called by the source thread. | |
virtual void | DelegateInvoke (std::shared_ptr< DelegateMsg > msg) override |
Invoke the delegate function on the destination thread. | |
Invoke the delegate function on the destination thread. Called by the destination thread. | |
bool | IsSuccess () |
RetType | GetRetVal () |
bool | IsSuccess () noexcept |
RetType | GetRetVal () noexcept |
Public Member Functions inherited from DelegateLib::DelegateMemberSpAsync< TClass, RetType(Args...)> | |
DelegateMemberSpAsync (ObjectPtr object, MemberFunc func, DelegateThread &thread) | |
Constructor to create a class instance. | |
Constructor to create a class instance. | |
DelegateMemberSpAsync (const ClassType &rhs) | |
Creates a copy of the current object. | |
Copy constructor that creates a copy of the given instance. | |
DelegateMemberSpAsync ()=delete | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
void | AsyncInvoke (Args... args) |
Invoke delegate function asynchronously. Do not wait for return value. Called by the source thread. | |
DelegateThread & | GetThread () |
Get the destination thread that the target function is invoked on. | |
DelegateThread & | GetThread () noexcept |
Get the destination thread that the target function is invoked on. | |
Public Member Functions inherited from DelegateLib::DelegateMemberSp< TClass, RetType(Args...)> | |
DelegateMemberSp (ObjectPtr object, MemberFunc func) | |
Constructor to create a class instance. | |
Constructor to create a class instance. | |
DelegateMemberSp (const ClassType &rhs) | |
Creates a copy of the current object. | |
Copy constructor that creates a copy of the given instance. | |
DelegateMemberSp (ClassType &&rhs) noexcept | |
Move constructor that transfers ownership of resources. | |
DelegateMemberSp ()=default | |
Default constructor creates an empty delegate. | |
ClassType & | operator= (const ClassType &rhs) |
Assignment operator that assigns the state of one object to another. | |
bool | Empty () const |
Check if the delegate is bound to a target function. | |
void | Clear () |
Clear the target function. | |
operator bool () const | |
Implicit conversion operator to bool . | |
ClassType & | operator= (ClassType &&rhs) noexcept |
Move assignment operator that transfers ownership of resources. | |
bool | Empty () const noexcept |
Check if the delegate is bound to a target function. | |
void | Clear () noexcept |
Clear the target function. | |
operator bool () const noexcept | |
Implicit conversion operator to bool . | |
Public Member Functions inherited from DelegateLib::Delegate< RetType(Args...)> | |
Public Member Functions inherited from DelegateLib::DelegateBase | |
DelegateBase ()=default | - | std::chrono::milliseconds | timeout ) | +std::chrono::milliseconds | timeout = WAIT_INFINITE ) |
Invoke the delegate function on the destination thread.
-Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. A lock is used to protect source and destination thread shared data. A semaphore is used to signal the source thread when the destination thread completes the target function call.
Invoke the delegate function on the destination thread. Called by the destination thread.
+Each source thread call to operator()
generate a call to DelegateInvoke()
on the destination thread. A lock is used to protect source and destination thread shared data. A semaphore is used to signal the source thread when the destination thread completes the target function call.
If source thread timeout expires and before the destination thread invokes the target function, the target function is not called.
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
[in] | msg | The delegate message created and sent within operator()(Args... args) . |
Invoke delegate function asynchronously and block for function return value.
-Invoke delegate function asynchronously and wait for the return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
Invoke delegate function asynchronously and block for function return value. Called by the source thread.
+Invoke delegate function asynchronously and wait for the return value. This function is called by the source thread. Dispatches the delegate data into the destination thread message queue. DelegateInvoke()
must be called by the destination thread to invoke the target function.
If the destination thread invokes the function within m_timeout
, the return value is obtained from the destination thread function call. If m_timeout
expires before the destination thread processes the request, the target function is not invoked and a default return value is returned to the caller with an undefined value. Use IsSuccess()
to check for success before using the return value. Alternatively, use AsyncInvoke()
and check the std::optional
return value.
The DelegateAsyncWaitMsg
does not duplicated and copy the function arguments into heap memory. The source thread waits on the destintation thread to complete, therefore argument data is shared between the source and destination threads and simultaneous access is prevented using a mutex.
[in] | args | The function arguments, if any. |
IsSuccess()
to determine if the return value is valid before use. IsSuccess()
to determine if the return value is valid before use. Reimplemented from DelegateLib::DelegateMemberSpAsync< TClass, RetType(Args...)>.
+
+
|
+ +inlinenoexcept | +
Move assignment operator that transfers ownership of resources.
+[in] | rhs | The object to move from. |
DelegateFunctionAsync<>
class asynchronously invokes a std::function
target function DelegateFunctionAsyncWait<>
class asynchronously block invokes a std::function target function DelegateMember<>
class synchronously invokes a class member target function using a class object pointer DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function DelegateMemberAsync<>
class asynchronously invokes a class member target function DelegateMemberAsyncWait<>
class asynchronously block invokes a class member target function DelegateMemberSp<>
class synchronously invokes a class member target function using a std::shared_ptr
object DelegateMemberSpAsync<>
class asynchronously invokes a std::shared_ptr target function DelegateFreeAsync<>
class asynchronously invokes a free target function DelegateFunctionAsync<>
class asynchronously invokes a std::function
target function DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function DelegateMemberAsync<>
class asynchronously invokes a class member target function DelegateMemberSpAsync<>
class asynchronously invokes a std::shared_ptr target function Delegate<>
instances. When invoked, each Delegate
instance within the invocation list is called. DelegateMemberAsync<>
class asynchronously invokes a class member target function. @tprarm TClass The class type that contains the member function. More...DelegateMemberAsync<>
class asynchronously invokes a class member target function. More...