RSB
0.7.0
|
Basic message that is exchanged between informers and listeners. More...
#include <Event.h>
Classes | |
class | Impl |
Public Member Functions | |
Event () | |
Event (const Event &event) | |
Event (ScopePtr scope, boost::shared_ptr< void > payload, const std::string &type, const std::string &method="") | |
Constructor. | |
Event (Scope scope, boost::shared_ptr< void > payload, const std::string &type, const std::string &method="") | |
virtual | ~Event () |
std::string | getClassName () const |
void | printContents (std::ostream &stream) const |
DEPRECATED (boost::uint64_t getSequenceNumber() const) | |
DEPRECATED (rsc::misc::UUID getId() const) | |
Returns a UUID for the event. | |
EventId | getEventId () const |
Returns the id of this event. | |
void | setEventId (const rsc::misc::UUID &senderId, const boost::uint32_t &sequenceNumber) |
Sets all information necessary to generate an id for this event. | |
std::string | getType () const |
void | setType (const std::string &type) |
VoidPtr | getData () |
void | setData (VoidPtr d) |
std::string | getMethod () const |
Returns the method associated with this event. | |
void | setMethod (const std::string &method) |
Sets the method associated with this event. | |
scope access | |
There are two ways of getting and setting scopes for events. One uses copies of Scopes, which may be expensive and one uses ScopePtr s to avoid the copy operation. Setting the scope with one method makes it also available using the copy getter and vice versa. | |
ScopePtr | getScopePtr () const |
Scope | getScope () const |
void | setScopePtr (ScopePtr scope) |
void | setScope (const Scope &scope) |
cause handling | |
Events are often caused by other events, which e.g. means that their contained payload was calculated on the payload of one or more other events. To express these relations each event contains a set of EventIds that express the direct causes of the event. This means, transitive event causes are not modeled. Cause handling is inspired by the ideas proposed in: David Luckham, The Power of Events, Addison-Wessley, 2007 | |
bool | addCause (const EventId &id) |
Adds the id of one event to the causes of this event. | |
bool | removeCause (const EventId &id) |
Removes a causing event from the set of causes for this event. | |
bool | isCause (const EventId &id) const |
Tells whether the id of one event is already marked as a cause of this event. | |
std::set< EventId > | getCauses () const |
Returns all causing events marked so far. | |
meta-data access | |
MetaData | getMetaData () const |
Returns a copy of the current meta-data state of this event. | |
MetaData & | mutableMetaData () |
Returns an in-place mutable version of the event's meta-data. | |
void | setMetaData (const MetaData &metaData) |
Replaces the event's meta-data with a new instance. |
Private Attributes | |
boost::scoped_ptr< Impl > | d |
Basic message that is exchanged between informers and listeners.
It is a combination of metadata and the actual data to publish / subscribe as payload.
rsb::Event::Event | ( | ScopePtr | scope, |
boost::shared_ptr< void > | payload, | ||
const std::string & | type, | ||
const std::string & | method = "" |
||
) |
rsb::Event::Event | ( | Scope | scope, |
boost::shared_ptr< void > | payload, | ||
const std::string & | type, | ||
const std::string & | method = "" |
||
) |
bool rsb::Event::addCause | ( | const EventId & | id | ) |
rsb::Event::DEPRECATED | ( | boost::uint64_t getSequenceNumber() | const | ) |
rsb::Event::DEPRECATED | ( | rsc::misc::UUID getId() | const | ) |
Returns a UUID for the event.
This is now generated using the sending participant and a sequence ID. Hence, it is not defined before the event is sent.
rsc::misc::IllegalStateException | if there cannot be an id because the event was not sent so far. |
set< EventId > rsb::Event::getCauses | ( | ) | const |
EventId rsb::Event::getEventId | ( | ) | const |
MetaData rsb::Event::getMetaData | ( | ) | const |
string rsb::Event::getMethod | ( | ) | const |
bool rsb::Event::isCause | ( | const EventId & | id | ) | const |
MetaData & rsb::Event::mutableMetaData | ( | ) |
void rsb::Event::printContents | ( | std::ostream & | stream | ) | const |
bool rsb::Event::removeCause | ( | const EventId & | id | ) |
void rsb::Event::setEventId | ( | const rsc::misc::UUID & | senderId, |
const boost::uint32_t & | sequenceNumber | ||
) |
void rsb::Event::setMetaData | ( | const MetaData & | metaData | ) |
void rsb::Event::setMethod | ( | const std::string & | method | ) |
void rsb::Event::setScope | ( | const Scope & | scope | ) |
void rsb::Event::setScopePtr | ( | ScopePtr | scope | ) |
void rsb::Event::setType | ( | const std::string & | type | ) |
|
private |
Definition at line 246 of file Event.h.
Referenced by addCause(), Event(), getCauses(), getData(), getEventId(), getMetaData(), getMethod(), getScope(), getScopePtr(), getType(), isCause(), mutableMetaData(), printContents(), removeCause(), setData(), setEventId(), setMetaData(), setMethod(), setScope(), setScopePtr(), and setType().