RSB
0.7.0
|
A Listener receives events published by rsb::Informer objects by participating in a channel with a suitable scope. More...
#include <Listener.h>
Classes | |
class | Impl |
Public Member Functions | |
Listener (const std::vector< transport::InPushConnectorPtr > &connectors, const Scope &scope, const ParticipantConfig &config) | |
Constructs a new Listener assigned to the specified scope. | |
virtual | ~Listener () |
std::string | getClassName () const |
void | addFilter (filter::FilterPtr filter) |
Adds a filter that will be applied after some time (but not immediately after this call) for all handlers. | |
void | removeFilter (filter::FilterPtr filter) |
Removes a previously installed filter if it is present by pointer comparison some time after this call. | |
virtual void | addHandler (HandlerPtr h, bool wait=true) |
Adds a rsb::Handler to the Listener. | |
void | removeHandler (HandlerPtr h, bool wait=true) |
Removes a Handler instance to process newly received events. | |
Public Member Functions inherited from rsb::Participant | |
virtual | ~Participant () |
void | printContents (std::ostream &stream) const |
rsc::misc::UUID | getId () const |
Returns the unique id of the participant. | |
ScopePtr | getScope () const |
Returns the scope of this participant. | |
ParticipantConfig | getConfig () const |
Returns a copy of the participant's configuration. |
Private Member Functions | |
void | initialize (const std::vector< transport::InPushConnectorPtr > &connectors, const Scope &scope, const ParticipantConfig &config) |
Private Attributes | |
boost::scoped_ptr< Impl > | d |
Additional Inherited Members | |
Protected Member Functions inherited from rsb::Participant | |
Participant (const Scope &scope, const ParticipantConfig &config) |
A Listener receives events published by rsb::Informer objects by participating in a channel with a suitable scope.
Handler objects have to be added to the listener to actually process received events. These events can be filtered for all handlers by adding Filter instances to this class. Filter form a conjunction.
Usage example:
Definition at line 80 of file Listener.h.
rsb::Listener::Listener | ( | const std::vector< transport::InPushConnectorPtr > & | connectors, |
const Scope & | scope, | ||
const ParticipantConfig & | config | ||
) |
Constructs a new Listener assigned to the specified scope.
The Listener connects to the bus using the supplied connectors.
connectors | a list of connectors that the listener should use to communicate with the bus. |
scope | the scope where the data is received from. |
config | the configuration that was used to setup this listener |
Definition at line 47 of file Listener.cpp.
References d, and initialize().
|
virtual |
Definition at line 55 of file Listener.cpp.
void rsb::Listener::addFilter | ( | filter::FilterPtr | filter | ) |
Adds a filter that will be applied after some time (but not immediately after this call) for all handlers.
filter | filter to add |
Definition at line 83 of file Listener.cpp.
References d.
|
virtual |
Adds a rsb::Handler to the Listener.
Events which match the restrictions described by the associated filters are passed to all handlers.
h | a pointer to the Handler. |
wait | if set to true , this method will return only after the handler has completely been installed and will receive the next available message. Otherwise it may return earlier. |
Definition at line 75 of file Listener.cpp.
References d.
string rsb::Listener::getClassName | ( | ) | const |
Definition at line 58 of file Listener.cpp.
|
private |
Definition at line 62 of file Listener.cpp.
References d, and rsb::Participant::getConfig().
Referenced by Listener().
void rsb::Listener::removeFilter | ( | filter::FilterPtr | filter | ) |
Removes a previously installed filter if it is present by pointer comparison some time after this call.
filter | filter to remove if present |
Definition at line 87 of file Listener.cpp.
References d.
void rsb::Listener::removeHandler | ( | HandlerPtr | h, |
bool | wait = true |
||
) |
Removes a Handler instance to process newly received events.
h | handler to remove if present (comparison based on pointer) |
wait | if set to true , this method will return only after the handler has been completely removed from the event processing and will not be called anymore from this listener. |
Definition at line 79 of file Listener.cpp.
References d.
|
private |
Definition at line 142 of file Listener.h.
Referenced by addFilter(), addHandler(), initialize(), Listener(), removeFilter(), and removeHandler().