RSB
0.7.0
|
This push-style event receiving strategy filters and dispatches rsb::Event s in the context of the thread calling handle. More...
#include <DirectEventReceivingStrategy.h>
Public Member Functions | |
DirectEventReceivingStrategy (bool singleThreaded=false) | |
virtual | ~DirectEventReceivingStrategy () |
void | printContents (std::ostream &stream) const |
void | setHandlerErrorStrategy (const ParticipantConfig::ErrorStrategy &strategy) |
Defines the strategy to use for handling dispatching errors to the client handler. | |
virtual void | addHandler (rsb::HandlerPtr handler, const bool &wait) |
Adds a new handler that will be notified about new events. | |
virtual void | removeHandler (rsb::HandlerPtr handler, const bool &wait) |
Removes a handler that will will then not be notified anymore. | |
virtual void | addFilter (filter::FilterPtr filter) |
virtual void | removeFilter (filter::FilterPtr filter) |
void | handle (EventPtr e) |
Dispatches the event to the listener. |
Static Public Member Functions | |
static EventReceivingStrategy * | create (const rsc::runtime::Properties &props) |
Private Types | |
typedef std::list < rsb::HandlerPtr > | HandlerList |
Private Member Functions | |
bool | filter (EventPtr event) |
void | deliver (rsb::HandlerPtr handler, EventPtr event) |
void | handleDispatchError (const std::string &message) |
bool | filterNoLock (EventPtr e) |
void | handleNoLock (EventPtr e) |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
boost::shared_mutex | filtersMutex |
std::set< filter::FilterPtr > | filters |
boost::shared_mutex | errorStrategyMutex |
ParticipantConfig::ErrorStrategy | errorStrategy |
boost::shared_mutex | handlerMutex |
HandlerList | handlers |
bool | singleThreaded |
This push-style event receiving strategy filters and dispatches rsb::Event s in the context of the thread calling handle.
Even calls to rsb::Handler s run in this thread, so stack exhaustion and deadlocks are possible.
Additionally, all locking can be disabled for situation in which it can be guaranteed that only one thread at a time calls any of the classes methods.
Definition at line 61 of file DirectEventReceivingStrategy.h.
|
private |
Definition at line 84 of file DirectEventReceivingStrategy.h.
rsb::eventprocessing::DirectEventReceivingStrategy::DirectEventReceivingStrategy | ( | bool | singleThreaded = false | ) |
Definition at line 53 of file DirectEventReceivingStrategy.cpp.
|
virtual |
Definition at line 59 of file DirectEventReceivingStrategy.cpp.
|
virtual |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 209 of file DirectEventReceivingStrategy.cpp.
References filters, and filtersMutex.
|
virtual |
Adds a new handler that will be notified about new events.
handler | handler to add |
wait | if set to true , this method must only return after the handler has been install completely so that the next event will be delivered to it |
Implements rsb::eventprocessing::PushEventReceivingStrategy.
Definition at line 195 of file DirectEventReceivingStrategy.cpp.
References handlerMutex, and handlers.
|
static |
Definition at line 49 of file DirectEventReceivingStrategy.cpp.
Referenced by rsb::eventprocessing::registerDefaultEventProcessingStrategies().
|
private |
Definition at line 143 of file DirectEventReceivingStrategy.cpp.
References handleDispatchError(), and logger.
Referenced by handleNoLock().
|
private |
Definition at line 76 of file DirectEventReceivingStrategy.cpp.
References filterNoLock(), filtersMutex, handleDispatchError(), and singleThreaded.
Referenced by handleNoLock().
|
private |
Definition at line 111 of file DirectEventReceivingStrategy.cpp.
References filters.
Referenced by filter().
|
virtual |
Dispatches the event to the listener.
event | the event to dispatch |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 175 of file DirectEventReceivingStrategy.cpp.
References handleNoLock(), handlerMutex, and singleThreaded.
|
private |
Definition at line 121 of file DirectEventReceivingStrategy.cpp.
References errorStrategy, errorStrategyMutex, rsb::ParticipantConfig::EXIT, rsb::ParticipantConfig::LOG, logger, and rsb::ParticipantConfig::PRINT.
Referenced by deliver(), and filter().
|
private |
void rsb::eventprocessing::DirectEventReceivingStrategy::printContents | ( | std::ostream & | stream | ) | const |
Definition at line 62 of file DirectEventReceivingStrategy.cpp.
References errorStrategy, errorStrategyMutex, filters, filtersMutex, and singleThreaded.
|
virtual |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 215 of file DirectEventReceivingStrategy.cpp.
References filters, and filtersMutex.
|
virtual |
Removes a handler that will will then not be notified anymore.
handler | handler to remove |
wait | if set to true , this method must only return after the handler has been removed completely and will not receive any more notifications |
Implements rsb::eventprocessing::PushEventReceivingStrategy.
Definition at line 202 of file DirectEventReceivingStrategy.cpp.
References handlerMutex, and handlers.
|
virtual |
Defines the strategy to use for handling dispatching errors to the client handler.
strategy | the new strategy to use |
Implements rsb::eventprocessing::PushEventReceivingStrategy.
Definition at line 70 of file DirectEventReceivingStrategy.cpp.
References errorStrategy, and errorStrategyMutex.
|
private |
Definition at line 103 of file DirectEventReceivingStrategy.h.
Referenced by handleDispatchError(), printContents(), and setHandlerErrorStrategy().
|
mutableprivate |
Definition at line 102 of file DirectEventReceivingStrategy.h.
Referenced by handleDispatchError(), printContents(), and setHandlerErrorStrategy().
|
private |
Definition at line 100 of file DirectEventReceivingStrategy.h.
Referenced by addFilter(), filterNoLock(), printContents(), and removeFilter().
|
mutableprivate |
Definition at line 99 of file DirectEventReceivingStrategy.h.
Referenced by addFilter(), filter(), printContents(), and removeFilter().
|
mutableprivate |
Definition at line 105 of file DirectEventReceivingStrategy.h.
Referenced by addHandler(), handle(), and removeHandler().
|
private |
Definition at line 106 of file DirectEventReceivingStrategy.h.
Referenced by addHandler(), handleNoLock(), and removeHandler().
|
private |
Definition at line 97 of file DirectEventReceivingStrategy.h.
Referenced by deliver(), and handleDispatchError().
|
private |
Definition at line 108 of file DirectEventReceivingStrategy.h.
Referenced by filter(), handle(), and printContents().