Library: Foundation
Package: Events
Header: Poco/DefaultStrategy.h
Description
Default notification strategy.
Internally, a std::vector<> is used to store delegate objects. Delegates are invoked in the order in which they have been registered.
Inheritance
Direct Base Classes: NotificationStrategy < TArgs, TDelegate >
All Base Classes: NotificationStrategy < TArgs, TDelegate >
Member Summary
Member Functions: add, clear, detach, detachAll, empty, notify, operator =, remove
Types Aliases
DelegateHandle
using DelegateHandle = TDelegate *;
DelegatePtr
using DelegatePtr = SharedPtr < TDelegate >;
Delegates
using Delegates = std::vector < DelegatePtr >;
Iterator
using Iterator = typename Delegates::iterator;
Constructors
DefaultStrategy
DefaultStrategy() = default;
DefaultStrategy
DefaultStrategy(
const DefaultStrategy & s
);
Destructor
~DefaultStrategy
~DefaultStrategy() = default;
Member Functions
add
DelegateHandle add(
const TDelegate & delegate
);
clear
void clear();
detach
DelegatePtr detach(
const TDelegate & delegate
);
Removes a matching delegate from the internal list without disabling it, and returns the detached delegate (or an empty DelegatePtr if no match). The caller is responsible for calling disable() on the returned delegate. This separation allows AbstractEvent to call disable() outside its own mutex, breaking the lock-order edge M_event -> M_delegate.
detach
DelegatePtr detach(
DelegateHandle delegateHandle
);
detachAll
Delegates detachAll();
Removes all delegates from the internal list without disabling them, and returns them so the caller can call disable() outside its mutex. See detach().
empty
bool empty() const;
notify
void notify(
const void * sender,
TArgs & arguments
);
operator =
DefaultStrategy & operator = (
const DefaultStrategy & s
);
remove
void remove(
const TDelegate & delegate
);
remove
void remove(
DelegateHandle delegateHandle
);
Variables
_delegates
Delegates _delegates;