PLCnext API Documentation 25.0.2.69
|
Use this class to register and invoke several delegates (function pointer in OOP design) in synced manner, so that it might be used in asynchronous context. More...
#include <synced_event.hxx>
Public Member Functions | |
synced_event (void) | |
Constructs a synced_event instance. More... | |
synced_event & | operator+= (delegate_type &&rhs) |
Adds a delegate to this event. More... | |
synced_event & | operator+= (const delegate_type &rhs) |
Adds a delegate to this event. More... | |
synced_event & | operator-= (const delegate_type &rhs) |
Removes a delegate from this event. More... | |
void | operator() (Args... args) const |
Fires this event instance. More... | |
bool | is_empty (void) const |
Checks if this event has any delegates to be invoked. More... | |
size_t | count (void) const |
Gets the number of delegates to be invoked. More... | |
Use this class to register and invoke several delegates (function pointer in OOP design) in synced manner, so that it might be used in asynchronous context.
The type of this generic synced_event class depends only on the signature of the delegates to be invoked, but not on the type of the objects on which the member function pointers of the delegates are invoked.
This class is leaned on the event mechansim of .NET.
A delegate is a function pointer (callback) in OOP design, which only depends on the signature of the (member) function pointer but not on the type of the object on which the member function pointer is invoked.
|
inlinedefault |
Constructs a synced_event instance.
Args | The argument types of this event. |
M | The mutex tpye to be used for synchronization. It shall provide a nested lock guard type called LockGuard . |
|
inline |
Gets the number of delegates to be invoked.
M | The mutex tpye to be used for synchronization. It shall provide a nested lock guard type called LockGuard . |
|
inline |
Checks if this event has any delegates to be invoked.
true
if this event has any delegates to be invoked, otherwise false
.Args | The argument types of this event. |
M | The mutex tpye to be used for synchronization. It shall provide a nested lock guard type called LockGuard . |
|
inline |
Fires this event instance.
args | The arguments passed to the invoked delegates. |
All added delegates are invoked in reversed insertion order by passing the arguments accordingly. The invocation in reversed order ensures backward compatibility.
Args | The argument types of this event. |
M | The mutex tpye to be used for synchronization. It shall provide a nested lock guard type called LockGuard . |
|
inline |
|
inline |
|
inline |