LSSTApplications
10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
|
This object allows creation of the system's event transmitters and receivers, which can be specified at the beginning, and later used by specifying the topic to receive from or send on. More...
#include <EventSystem.h>
Public Member Functions | |
~EventSystem () | |
destructor More... | |
void | createTransmitter (std::string const &hostName, std::string const &topicName, int hostPort=EventBroker::DEFAULTHOSTPORT) |
create an EventTransmitter to send messages to the message broker More... | |
void | createReceiver (std::string const &hostName, std::string const &topicName, int hostPort=EventBroker::DEFAULTHOSTPORT) |
create an EventReceiver which will receive message More... | |
void | createReceiver (std::string const &hostName, std::string const &topicName, std::string const &selector, int hostPort=EventBroker::DEFAULTHOSTPORT) |
create an EventReceiver which will receive message More... | |
void | publishEvent (std::string const &topicName, Event &event) |
send an event on a topic More... | |
Event * | receiveEvent (std::string const &topicName) |
blocking receive for events. Waits until an event is received for the topic specified in the constructor More... | |
Event * | receiveEvent (std::string const &topicName, const long timeout) |
blocking receive for events, with timeout (in milliseconds). Waits until an event is received for the topic specified in the constructor, or until the timeout expires. More... | |
LocationId::Ptr | createOriginatorId () const |
create an LocationId More... | |
StatusEvent * | castToStatusEvent (Event *event) |
cast an Event to StatusEvent More... | |
CommandEvent * | castToCommandEvent (Event *event) |
cast an Event to CommandEvent More... | |
Static Public Member Functions | |
static EventSystem & | getDefaultEventSystem () |
return the default EventSystem object, which can access all previously created Transmitters and receivers More... | |
Protected Member Functions | |
EventSystem () | |
Static Protected Attributes | |
static list< boost::shared_ptr < EventTransmitter > > | _transmitters |
static list< boost::shared_ptr < EventReceiver > > | _receivers |
Private Member Functions | |
boost::shared_ptr < EventTransmitter > | getTransmitter (std::string const &name) |
boost::shared_ptr< EventReceiver > | getReceiver (std::string const &name) |
Static Private Attributes | |
static EventSystem * | defaultEventSystem = 0 |
This object allows creation of the system's event transmitters and receivers, which can be specified at the beginning, and later used by specifying the topic to receive from or send on.
Definition at line 65 of file EventSystem.h.
lsst::ctrl::events::EventSystem::~EventSystem | ( | ) |
|
protected |
Definition at line 62 of file EventSystem.cc.
CommandEvent * lsst::ctrl::events::EventSystem::castToCommandEvent | ( | Event * | event | ) |
cast an Event to CommandEvent
event | an Event |
Definition at line 159 of file EventSystem.cc.
StatusEvent * lsst::ctrl::events::EventSystem::castToStatusEvent | ( | Event * | event | ) |
cast an Event to StatusEvent
event | an Event |
Definition at line 155 of file EventSystem.cc.
LocationId::Ptr lsst::ctrl::events::EventSystem::createOriginatorId | ( | ) | const |
void lsst::ctrl::events::EventSystem::createReceiver | ( | std::string const & | hostName, |
std::string const & | topicName, | ||
int | hostPort = EventBroker::DEFAULTHOSTPORT |
||
) |
create an EventReceiver which will receive message
hostName | the location of the message broker to use |
topicName | the topic to receive messages from |
hostPort | the port where the broker can be reached |
lsst::pex::exceptions::RuntimeError | if topic is already registered |
Definition at line 89 of file EventSystem.cc.
void lsst::ctrl::events::EventSystem::createReceiver | ( | std::string const & | hostName, |
std::string const & | topicName, | ||
std::string const & | selector, | ||
int | hostPort = EventBroker::DEFAULTHOSTPORT |
||
) |
create an EventReceiver which will receive message
hostName | the location of the message broker to use |
topicName | the topic to receive messages from |
selector | the message selector to specify which messages to receive |
hostPort | the port where the broker can be reached |
Definition at line 99 of file EventSystem.cc.
void lsst::ctrl::events::EventSystem::createTransmitter | ( | std::string const & | hostName, |
std::string const & | topicName, | ||
int | hostPort = EventBroker::DEFAULTHOSTPORT |
||
) |
create an EventTransmitter to send messages to the message broker
hostName | the location of the message broker to use |
topicName | the topic to transmit events to |
hostPort | the port where the broker can be reached |
lsst::pex::exceptions::RuntimeError | if topic is already registered |
Definition at line 79 of file EventSystem.cc.
|
static |
return the default EventSystem object, which can access all previously created Transmitters and receivers
Definition at line 69 of file EventSystem.cc.
|
private |
private method used to retrieve the named EventReceiver object
Definition at line 145 of file EventSystem.cc.
|
private |
private method to retrieve a transmitter from the internal list
Definition at line 115 of file EventSystem.cc.
void lsst::ctrl::events::EventSystem::publishEvent | ( | std::string const & | topicName, |
Event & | event | ||
) |
send an event on a topic
topicName | the topic to send messages to |
event | the Event to send |
Runtime | exception if the topic wasn't already registered using the createTransmitter method |
Definition at line 105 of file EventSystem.cc.
Event * lsst::ctrl::events::EventSystem::receiveEvent | ( | std::string const & | topicName | ) |
blocking receive for events. Waits until an event is received for the topic specified in the constructor
topicName | the topic to listen on |
Definition at line 126 of file EventSystem.cc.
Event * lsst::ctrl::events::EventSystem::receiveEvent | ( | std::string const & | topicName, |
const long | timeout | ||
) |
blocking receive for events, with timeout (in milliseconds). Waits until an event is received for the topic specified in the constructor, or until the timeout expires.
topicName | the topic to listen on |
timeout | the time in milliseconds to wait before returning |
Definition at line 130 of file EventSystem.cc.
|
staticprotected |
Definition at line 165 of file EventSystem.h.
|
staticprotected |
Definition at line 164 of file EventSystem.h.
|
staticprivate |
Definition at line 155 of file EventSystem.h.