RAVENNAKIT
Loading...
Searching...
No Matches
rav::SubscriberList< T, void > Class Template Reference

Specialize the void case. More...

#include <subscriber_list.hpp>

Public Member Functions

 SubscriberList ()=default
 SubscriberList (const SubscriberList &)=delete
SubscriberList & operator= (const SubscriberList &)=delete
 SubscriberList (SubscriberList &&)=default
SubscriberList & operator= (SubscriberList &&)=default
auto begin () const
auto end () const
auto begin ()
auto end ()
bool add (T *subscriber)
 Adds the given subscriber to the list.
bool remove (const T *subscriber)
 Removes the given subscriber from the list.
void clear ()
 Clears the list.
void foreach (const std::function< void(T *)> &f, const T *excluding=nullptr)
 Calls given function for each subscriber.
size_t size () const
bool empty () const
bool contains (T *subscriber) const
 Checks if the list contains the given subscriber.
 ~SubscriberList ()
bool add_or_update_context (T *subscriber, void context)
 Adds the given subscriber to the list.
bool update_context (T *subscriber, void context)
 Updates the context of the given subscriber.

Detailed Description

template<class T>
class rav::SubscriberList< T, void >

Specialize the void case.

Definition at line 220 of file subscriber_list.hpp.

Constructor & Destructor Documentation

◆ SubscriberList() [1/3]

template<class T>
rav::SubscriberList< T, void >::SubscriberList ( )
default

◆ SubscriberList() [2/3]

template<class T>
rav::SubscriberList< T, void >::SubscriberList ( const SubscriberList< T, void > & )
delete

◆ SubscriberList() [3/3]

template<class T>
rav::SubscriberList< T, void >::SubscriberList ( SubscriberList< T, void > && )
default

◆ ~SubscriberList()

rav::SubscriberList< T, void >::~SubscriberList ( )
inline

Definition at line 45 of file subscriber_list.hpp.

Member Function Documentation

◆ add()

template<class T>
bool rav::SubscriberList< T, void >::add ( T * subscriber)
inlinenodiscard

Adds the given subscriber to the list.

If subscriber is already in the list it will not be added.

Parameters
subscriberThe subscriber to add.
Returns
true if the subscriber was added, or false if it was already in the list.

Definition at line 263 of file subscriber_list.hpp.

◆ add_or_update_context()

bool rav::SubscriberList< T, void >::add_or_update_context ( T * subscriber,
void context )
inlinenodiscard

Adds the given subscriber to the list.

If subscriber is already in the list it will be updated with the new context.

Parameters
subscriberThe subscriber to add.
contextThe context to add.
Returns
true if the subscriber was added, or false if it was already in the list. In both cases the context will be updated.

Definition at line 109 of file subscriber_list.hpp.

◆ begin() [1/2]

template<class T>
auto rav::SubscriberList< T, void >::begin ( )
inline
Returns
An iterator to the beginning of the list.

Definition at line 247 of file subscriber_list.hpp.

◆ begin() [2/2]

template<class T>
auto rav::SubscriberList< T, void >::begin ( ) const
inline
Returns
An iterator to the beginning of the list.

Definition at line 233 of file subscriber_list.hpp.

◆ clear()

template<class T>
void rav::SubscriberList< T, void >::clear ( )
inline

Clears the list.

Definition at line 291 of file subscriber_list.hpp.

◆ contains()

template<class T>
bool rav::SubscriberList< T, void >::contains ( T * subscriber) const
inlinenodiscard

Checks if the list contains the given subscriber.

Parameters
subscriberThe subscriber to check.
Returns
true if the list contains the subscriber, or false if not.

Definition at line 327 of file subscriber_list.hpp.

◆ empty()

template<class T>
bool rav::SubscriberList< T, void >::empty ( ) const
inlinenodiscard
Returns
true if there are no subscribers.

Definition at line 318 of file subscriber_list.hpp.

◆ end() [1/2]

template<class T>
auto rav::SubscriberList< T, void >::end ( )
inline
Returns
An iterator to the end of the list.

Definition at line 254 of file subscriber_list.hpp.

◆ end() [2/2]

template<class T>
auto rav::SubscriberList< T, void >::end ( ) const
inline
Returns
An iterator to the end of the list.

Definition at line 240 of file subscriber_list.hpp.

◆ foreach()

template<class T>
void rav::SubscriberList< T, void >::foreach ( const std::function< void(T *)> & f,
const T * excluding = nullptr )
inline

Calls given function for each subscriber.

Parameters
fThe function to call for each subscriber. Must be not null.
excludingThe subscriber to exclude from the call.

Definition at line 300 of file subscriber_list.hpp.

◆ operator=() [1/2]

template<class T>
SubscriberList & rav::SubscriberList< T, void >::operator= ( const SubscriberList< T, void > & )
delete

◆ operator=() [2/2]

template<class T>
SubscriberList & rav::SubscriberList< T, void >::operator= ( SubscriberList< T, void > && )
default

◆ remove()

template<class T>
bool rav::SubscriberList< T, void >::remove ( const T * subscriber)
inlinenodiscard

Removes the given subscriber from the list.

Parameters
subscriberThe subscriber to remove.
Returns
true if the subscriber was removed, or false if it was not in the list.

Definition at line 279 of file subscriber_list.hpp.

◆ size()

template<class T>
size_t rav::SubscriberList< T, void >::size ( ) const
inlinenodiscard
Returns
The number of subscribers.

Definition at line 311 of file subscriber_list.hpp.

◆ update_context()

bool rav::SubscriberList< T, void >::update_context ( T * subscriber,
void context )
inlinenodiscard

Updates the context of the given subscriber.

Parameters
subscriberThe subscriber to update.
contextThe new context.
Returns
true if the subscriber was updated, or false if it was not in the list.

Definition at line 126 of file subscriber_list.hpp.


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