RSB  0.19.0
rsb::eventprocessing::ScopeDispatcher< T > Class Template Reference

Maps scopes to sets of sinks of type T. More...

#include <ScopeDispatcher.h>

Collaboration diagram for rsb::eventprocessing::ScopeDispatcher< T >:
Collaboration graph

Public Member Functions

bool empty () const
 Indicates whether there are scopes with associated sinks. More...
 
size_t size () const
 Returns number of scopes with associated sinks. More...
 
void addSink (const Scope &scope, const T &sink)
 Associates sink with scope. More...
 
void removeSink (const Scope &scope, const T &sink)
 Removes sink from the list of sinks associated to scope. More...
 
void mapSinks (const Scope &scope, boost::function< void(const T &)> function) const
 Calls function for each sink associated to scope-scopes of scope. More...
 
void mapAllSinks (boost::function< void(const T &)> function) const
 Calls function for each sink in the dispatcher. More...
 

Protected Types

typedef std::list< T > SinkList
 
typedef std::map< Scope, SinkListSinkMap
 

Protected Attributes

SinkMap sinks
 

Detailed Description

template<typename T>
class rsb::eventprocessing::ScopeDispatcher< T >

Maps scopes to sets of sinks of type T.

Sinks are usually objects to which events are dispatched based on their scopes.

Author
jmoringe

Definition at line 51 of file ScopeDispatcher.h.

Member Typedef Documentation

template<typename T>
typedef std::list<T> rsb::eventprocessing::ScopeDispatcher< T >::SinkList
protected

Definition at line 145 of file ScopeDispatcher.h.

template<typename T>
typedef std::map<Scope, SinkList> rsb::eventprocessing::ScopeDispatcher< T >::SinkMap
protected

Definition at line 146 of file ScopeDispatcher.h.

Member Function Documentation

template<typename T>
void rsb::eventprocessing::ScopeDispatcher< T >::addSink ( const Scope scope,
const T &  sink 
)
inline

Associates sink with scope.

Parameters
scopeThe scope with which sink should be associated.
sinkThe sink which should be added to the list of sinks associated to scope.

Definition at line 79 of file ScopeDispatcher.h.

Referenced by rsb::transport::socket::BusImpl::addSink().

Here is the caller graph for this function:

template<typename T>
bool rsb::eventprocessing::ScopeDispatcher< T >::empty ( ) const
inline

Indicates whether there are scopes with associated sinks.

Returns
if there are no scopes with associated sinks, otherwise

Definition at line 59 of file ScopeDispatcher.h.

Referenced by rsb::transport::socket::BusImpl::~BusImpl().

Here is the caller graph for this function:

template<typename T>
void rsb::eventprocessing::ScopeDispatcher< T >::mapAllSinks ( boost::function< void(const T &)>  function) const
inline

Calls function for each sink in the dispatcher.

Parameters
functionThe function that should be called for each sink.

Definition at line 134 of file ScopeDispatcher.h.

template<typename T>
void rsb::eventprocessing::ScopeDispatcher< T >::mapSinks ( const Scope scope,
boost::function< void(const T &)>  function 
) const
inline

Calls function for each sink associated to scope-scopes of scope.

Relevant sinks are computed by taking the union of the sinks respectively associated to all super-scopes of scope.

Parameters
scopeDetermines relevant sinks.
functionThe function that should be called for each relevant sink.

Definition at line 112 of file ScopeDispatcher.h.

template<typename T>
void rsb::eventprocessing::ScopeDispatcher< T >::removeSink ( const Scope scope,
const T &  sink 
)
inline

Removes sink from the list of sinks associated to scope.

Parameters
scopeThe scope from which sink should be removed.
sinkThe sink which should be removed from the list of sinks associated to scope.

Definition at line 90 of file ScopeDispatcher.h.

template<typename T>
size_t rsb::eventprocessing::ScopeDispatcher< T >::size ( ) const
inline

Returns number of scopes with associated sinks.

Returns
The number of scopes with associated sinks.

Definition at line 68 of file ScopeDispatcher.h.

Referenced by rsb::transport::socket::BusImpl::printContents(), and rsb::transport::socket::BusImpl::~BusImpl().

Here is the caller graph for this function:

Member Data Documentation


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