![]() |
TSDuck v3.45-4766
MPEG Transport Stream Toolkit
|
Base class for subscription to events. More...
#include <tsSubscriptionBase.h>

Public Member Functions | |
| SubscriptionBase ()=default | |
| Default constructor. | |
| virtual | ~SubscriptionBase () |
| Virtual destructor. | |
| void | addSubscription (SubscriptionHandlerInterface *handler) |
| Add a subscriber to open/close events. | |
| void | cancelSubscription (SubscriptionHandlerInterface *handler) |
| Remove a subscriber to open/close events. | |
Protected Member Functions | |
| template<typename HANDLER , typename F > requires std::derived_from<HANDLER, SubscriptionHandlerInterface> | |
| void | callSubscribers (F &&func) |
| Call a handler on all subscribers, using a lambda expression. | |
Base class for subscription to events.
Used as base class in Socket and other socket wrappers which intercept socket events.
Important: the subcription mechanism is not thread-safe. The instance of SubscriptionBase and all its subscribers must be used from one single thread.
| void ts::SubscriptionBase::addSubscription | ( | SubscriptionHandlerInterface * | handler | ) |
Add a subscriber to open/close events.
| [in] | handler | The object to call on open() and close(). |
| void ts::SubscriptionBase::cancelSubscription | ( | SubscriptionHandlerInterface * | handler | ) |
Remove a subscriber to open/close events.
| [in] | handler | The object to no longer call on open() and close(). |
|
inlineprotected |
Call a handler on all subscribers, using a lambda expression.
| [in] | func | Function to call as lambda expression. |