DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dueca::UCallbackOrActivity Class Reference

Small helper class to provide flexibility in the creation of ReadAccessToken and WriteAccessToken, accepts either a callback or activity, and will do only one call or activation. More...

#include <UCallbackOrActivity.hxx>

Inheritance diagram for dueca::UCallbackOrActivity:
Inheritance graph
[legend]
Collaboration diagram for dueca::UCallbackOrActivity:
Collaboration graph
[legend]

Public Member Functions

 UCallbackOrActivity (Activity *act)
 Constructor from an Activity pointer.
 
 UCallbackOrActivity (GenericCallback *cb)
 Constructor from a GenericCallback pointer.
 
 UCallbackOrActivity (std::nullptr_t ncb)
 Constructor from a null pointer.
 
 UCallbackOrActivity ()
 Empty constructor.
 
 UCallbackOrActivity (const UCallbackOrActivity &o)
 Copy constructor.
 
void operator() (const TimeSpec &ts)
 Run the thing - is effective once only.
 
void reset ()
 Reset to null.
 
 ~UCallbackOrActivity ()
 Destructor.
 
 operator bool () const
 Test whether any callback can be run.
 

Detailed Description

Small helper class to provide flexibility in the creation of ReadAccessToken and WriteAccessToken, accepts either a callback or activity, and will do only one call or activation.

This class features constructors that enable implicit conversion from a GenericCallback pointer (GenericCallback*) or from an Activity/ ActivityCallback pointer, when creating a ReadAccessToken or a WriteAccessToken. You can thus use a pointer to either of these objects, instead of a UCallbackOrActivity in your constructor call.

When the token becomes valid, the callback or activity is called.

When using a GenericCallback*, the callback is immediate in some cases when the token is implicitly vallid. If the callback comes later, it will be handled by the administration thread ActivityManager (priority 0).

When using an Activity, you must supply the priority where the callback will be done. By taking the same priority as the process that uses the token to write or read the data, you can avoid threading problems. Validity is in this case always signalled later, as a separate activity.

Constructor & Destructor Documentation

◆ UCallbackOrActivity() [1/4]

dueca::UCallbackOrActivity::UCallbackOrActivity ( Activity * act)

Constructor from an Activity pointer.

Note that the pointer must remain valid for the lifetime of the token where this is used.

◆ UCallbackOrActivity() [2/4]

dueca::UCallbackOrActivity::UCallbackOrActivity ( GenericCallback * cb)

Constructor from a GenericCallback pointer.

Note that the pointer must remain valid for the lifetime of the token where this is used.

◆ UCallbackOrActivity() [3/4]

dueca::UCallbackOrActivity::UCallbackOrActivity ( std::nullptr_t ncb)

Constructor from a null pointer.

Will not perform a callback.

◆ UCallbackOrActivity() [4/4]

dueca::UCallbackOrActivity::UCallbackOrActivity ( )

Empty constructor.

Will also not perform a callback.


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