Publish-subscribe event (forever subscribed)
More...
#include <InternalTypes.hpp>
|
| void | subscribe (callback_type callback) noexcept |
| | Subscribe forever.
|
| |
| void | clear () noexcept |
| | Clear all subscriptions.
|
| |
| void | operator() (const Args &...args) |
| | Dispatch event to all subscribed callbacks.
|
| |
| void | operator() (const Args &...args) const |
| | Dispatch event to all subscribed callbacks (const)
|
| |
| ::std::size_t | subscribed () |
| | Get the number of subscribed callbacks.
|
| |
| type & | operator= (type &&source) noexcept |
| | Move-assignment.
|
| |
| type & | operator= (const type &source) noexcept |
| | Copy-assignment.
|
| |
|
constexpr | static_event () noexcept=default |
| | Default constructor.
|
| |
| | static_event (const type &source) |
| | Copy constructor.
|
| |
| | static_event (type &&source) |
| | Move constructor.
|
| |
| constexpr bool | operator== (const type &other) const noexcept |
| | Equality operator.
|
| |
template<class... Args>
class static_event< Args >
Publish-subscribe event (forever subscribed)
- Warning
- Not thread safe. All subscribers must subscribe in the same thread. Subscription must not take place while the event is dispatching in another thread.
- Author
- Ángel Fernández Pineda. Madrid. Spain. 2026. https://github.com/afpineda/cpp-publish-subscribe-observable
- Copyright
- EUPL 1.2 License
- Template Parameters
-
| Args | Callback argument types |
Definition at line 518 of file InternalTypes.hpp.
◆ callback_type
template<class... Args>
| using static_event< Args >::callback_type = typename ::std::add_pointer<void(Args...)>::type |
◆ type
◆ static_event() [1/2]
Copy constructor.
- Parameters
-
| source | Instance to be copied |
Definition at line 619 of file InternalTypes.hpp.
◆ static_event() [2/2]
◆ clear()
Clear all subscriptions.
- Warning
- To be used exclusively in test units.
Definition at line 543 of file InternalTypes.hpp.
◆ operator()() [1/2]
template<class... Args>
| void static_event< Args >::operator() |
( |
const Args &... | args | ) |
|
|
inline |
Dispatch event to all subscribed callbacks.
- Parameters
-
Definition at line 553 of file InternalTypes.hpp.
◆ operator()() [2/2]
template<class... Args>
| void static_event< Args >::operator() |
( |
const Args &... | args | ) |
const |
|
inline |
Dispatch event to all subscribed callbacks (const)
- Parameters
-
Definition at line 566 of file InternalTypes.hpp.
◆ operator=() [1/2]
Copy-assignment.
- Parameters
-
| source | Instance to be copied |
- Returns
- type& Reference to this instance
Definition at line 602 of file InternalTypes.hpp.
◆ operator=() [2/2]
Move-assignment.
- Parameters
-
- Returns
- type& Reference to this instance
Definition at line 590 of file InternalTypes.hpp.
◆ operator==()
Equality operator.
- Note
- Mostly for testing purposes.
- Parameters
-
| other | Instance to compare to |
- Returns
- true If equal
-
false If not equal
Definition at line 643 of file InternalTypes.hpp.
◆ subscribe()
Subscribe forever.
- Parameters
-
| callback | Callback function to be called on event dispatch |
Definition at line 531 of file InternalTypes.hpp.
◆ subscribed()
Get the number of subscribed callbacks.
- Returns
- ::std::size_t Count of subscribed callbacks
Definition at line 579 of file InternalTypes.hpp.
The documentation for this class was generated from the following file: