PLCnext API Documentation 23.0.2.9
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | List of all members
Arp::event< void > Class Reference

Use this class to register and invoke several delegates (function pointer in OOP design). More...

#include <event.hxx>

Public Types

using delegate_type = delegate< void()>
 The delegate type of this event.
 
using slim_delegate_type = slim_delegate< void()>
 The slim_delegate type of this event.
 

Public Member Functions

 event (void)=default
 Constructs a event instance.
 
 event (const event &arg)=default
 Constructs a event instance. More...
 
 event (event &&arg)=default
 Constructs a event instance. More...
 
 ~event (void)=default
 Destructs this instance..
 
eventoperator= (const event &arg)=default
 The default assignment operator. More...
 
eventoperator= (event &&arg)=default
 The move assignment operator. More...
 
eventoperator+= (slim_delegate_type &&rhs)
 Adds a slim_delegate to this event. More...
 
eventoperator+= (const slim_delegate_type &rhs)
 Adds a slim_delegate to this event. More...
 
eventoperator-= (const slim_delegate_type &rhs)
 Removes a slim_delegate from this event. More...
 
eventoperator+= (delegate_type &&rhs)
 Adds a delegate to this event. More...
 
eventoperator+= (const delegate_type &rhs)
 Adds a delegate to this event. More...
 
eventoperator-= (const delegate_type &rhs)
 Removes a delegate from this event. More...
 
void operator() (void) const
 Fires this event instance. More...
 
bool is_empty (void) const
 Checks if this event has any delegates to be invoked. More...
 

Detailed Description

Use this class to register and invoke several delegates (function pointer in OOP design).

The type of this generic 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.

See also
delegate

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.

Constructor & Destructor Documentation

◆ event() [1/2]

Arp::event< void >::event ( const event< void > &  arg)
default

Constructs a event instance.

Parameters
argThe argument to copy.

◆ event() [2/2]

Arp::event< void >::event ( event< void > &&  arg)
default

Constructs a event instance.

Parameters
argThe argument to move.

Member Function Documentation

◆ is_empty()

bool Arp::event< void >::is_empty ( void  ) const
inline

Checks if this event has any delegates to be invoked.

Returns
true if this event has any delegates to be invoked, otherwise false.

◆ operator()()

void Arp::event< void >::operator() ( void  ) const
inline

Fires this event instance.

All added delegates are invoked in arbitrary order by passing the arguments accordingly.

◆ operator+=() [1/4]

event & Arp::event< void >::operator+= ( const delegate_type rhs)
inline

Adds a delegate to this event.

Parameters
rhsThe delegate to add to this event.
Returns
This instance as reference.

◆ operator+=() [2/4]

event & Arp::event< void >::operator+= ( const slim_delegate_type rhs)
inline

Adds a slim_delegate to this event.

Parameters
rhsThe slim_delegate to add to this event.
Returns
This instance as reference.

◆ operator+=() [3/4]

event & Arp::event< void >::operator+= ( delegate_type &&  rhs)
inline

Adds a delegate to this event.

Parameters
rhsThe delegate to add to this event.
Returns
This instance as reference.

◆ operator+=() [4/4]

event & Arp::event< void >::operator+= ( slim_delegate_type &&  rhs)
inline

Adds a slim_delegate to this event.

Parameters
rhsThe slim_delegate to add to this event.
Returns
This instance as reference.

◆ operator-=() [1/2]

event & Arp::event< void >::operator-= ( const delegate_type rhs)
inline

Removes a delegate from this event.

Parameters
rhsThe delegate to remove from this event.
Returns
This instance as reference.

◆ operator-=() [2/2]

event & Arp::event< void >::operator-= ( const slim_delegate_type rhs)
inline

Removes a slim_delegate from this event.

Parameters
rhsThe slim_delegate to remove from this event.
Returns
This instance as reference.

◆ operator=() [1/2]

event & Arp::event< void >::operator= ( const event< void > &  arg)
default

The default assignment operator.

Parameters
argThe argument to assign to this instance.
Returns
This instance as reference.

◆ operator=() [2/2]

event & Arp::event< void >::operator= ( event< void > &&  arg)
default

The move assignment operator.

Parameters
argThe argument to move into this instance.
Returns
This instance as reference.

The documentation for this class was generated from the following file: