RSB
0.7.0
|
Framework-supplied meta data attached to each event that give information e.g. More...
#include <MetaData.h>
Public Member Functions | |
MetaData () | |
virtual | ~MetaData () |
std::string | getClassName () const |
void | printContents (std::ostream &stream) const |
rsc::misc::UUID | getSenderId () const |
Returns the ID (a UUID) of the sending participant. | |
void | setSenderId (const rsc::misc::UUID &senderId) |
Sets the ID (a UUID) of the sending participant. | |
bool | operator== (const MetaData &other) const |
framework timestamps | |
Timestamps supplied by the framework itself. | |
boost::uint64_t | getCreateTime () const |
Returns a time stamp that is automatically filled with the time the event instance was created by the language binding. | |
void | setCreateTime (const boost::uint64_t &time=0) |
Sets the time stamp that is automatically filled with the time the event instance was created by the language binding. | |
void | setCreateTime (const double &time) |
void | setCreateTime (const boost::posix_time::ptime &time) |
boost::uint64_t | getSendTime () const |
Returns the time at which the generated notification for an event was sent on the bus (after serialization). | |
void | setSendTime (const boost::uint64_t &time=0) |
Sets the time at which the generated notification for an event was sent on the bus (after serialization). | |
void | setSendTime (const double &time) |
void | setSendTime (const boost::posix_time::ptime &time) |
boost::uint64_t | getReceiveTime () const |
Returns the time at which an event is received by listener in its encoded form. | |
void | setReceiveTime (const boost::uint64_t &time=0) |
Sets the time at which an event is received by listener in its encoded form. | |
void | setReceiveTime (const double &time) |
void | setReceiveTime (const boost::posix_time::ptime &time) |
boost::uint64_t | getDeliverTime () const |
Returns the time at which an event was decoded and will be dispatched to the client as soon as possible (set directly before passing it to the client handler). | |
void | setDeliverTime (const boost::uint64_t &time=0) |
Sets the time at which an event was decoded and will be dispatched to the client as soon as possible (set directly before passing it to the client handler). | |
void | setDeliverTime (const double &time) |
void | setDeliverTime (const boost::posix_time::ptime &time) |
user timestamps | |
Additional timestamps that can be filled by the framework client. Keys are unique. | |
std::set< std::string > | userTimeKeys () const |
Returns the keys of all available user times. | |
bool | hasUserTime (const std::string &key) const |
Checks whether a user-provided timestamp with the given key exists. | |
boost::uint64_t | getUserTime (const std::string &key) const |
Returns the user timestamp stored under the provided key. | |
void | setUserTime (const std::string &key, const boost::uint64_t &time=0) |
Sets a user timestamp and replaces existing entries. | |
void | setUserTime (const std::string &key, const double &time) |
void | setUserTime (const std::string &key, const boost::posix_time::ptime &time) |
std::map< std::string, boost::uint64_t > ::const_iterator | userTimesBegin () const |
std::map< std::string, boost::uint64_t > ::const_iterator | userTimesEnd () const |
user infos | |
A set of key-value style string infos that can be used by the client. Keys are unique. | |
std::set< std::string > | userInfoKeys () const |
Returns all keys of user-defined infos. | |
bool | hasUserInfo (const std::string &key) const |
Checks whether a user info exists under the provided key. | |
std::string | getUserInfo (const std::string &key) const |
Returns the user-defined string for the given key. | |
void | setUserInfo (const std::string &key, const std::string &value) |
Sets a user info with the specified key and value or replaces and already existing one. | |
std::map< std::string, std::string >::const_iterator | userInfosBegin () const |
std::map< std::string, std::string >::const_iterator | userInfosEnd () const |
Private Member Functions | |
void | checkedTimeStampSet (boost::uint64_t ×tamp, const boost::uint64_t &proposedValue) |
void | checkedTimeStampSet (boost::uint64_t ×tamp, const double &proposedValue) |
void | checkedTimeStampSet (boost::uint64_t ×tamp, const boost::posix_time::ptime &proposedValue) |
Private Attributes | |
rsc::misc::UUID | senderId |
boost::uint64_t | createTime |
boost::uint64_t | sendTime |
boost::uint64_t | receiveTime |
boost::uint64_t | deliverTime |
std::map< std::string, boost::uint64_t > | userTimes |
std::map< std::string, std::string > | userInfos |
Static Private Attributes | |
static const boost::posix_time::ptime | UNIX_EPOCH |
Framework-supplied meta data attached to each event that give information e.g.
about timing issues.
For all timestamps UTC unix timestamps are assumed. For the conversion from boost::posix_time::ptime the client has to ensure that the ptim is given in UTC (e.g. using universal_time).
Definition at line 54 of file MetaData.h.
rsb::MetaData::MetaData | ( | ) |
Definition at line 41 of file MetaData.cpp.
|
virtual |
Definition at line 46 of file MetaData.cpp.
|
private |
Definition at line 84 of file MetaData.cpp.
Referenced by setCreateTime(), setDeliverTime(), setReceiveTime(), setSendTime(), and setUserTime().
|
private |
Definition at line 72 of file MetaData.cpp.
|
private |
Definition at line 93 of file MetaData.cpp.
References UNIX_EPOCH.
string rsb::MetaData::getClassName | ( | ) | const |
Definition at line 49 of file MetaData.cpp.
boost::uint64_t rsb::MetaData::getCreateTime | ( | ) | const |
Returns a time stamp that is automatically filled with the time the event instance was created by the language binding.
This should usually reflect the time at which the notified condition most likely occurred in the sender. If event instances are reused, it has to be reset manually by the client.
This timestamp is initially set to the creating time stamp of this instance.
Definition at line 68 of file MetaData.cpp.
References createTime.
boost::uint64_t rsb::MetaData::getDeliverTime | ( | ) | const |
Returns the time at which an event was decoded and will be dispatched to the client as soon as possible (set directly before passing it to the client handler).
Definition at line 148 of file MetaData.cpp.
References deliverTime.
boost::uint64_t rsb::MetaData::getReceiveTime | ( | ) | const |
Returns the time at which an event is received by listener in its encoded form.
Definition at line 132 of file MetaData.cpp.
References receiveTime.
rsc::misc::UUID rsb::MetaData::getSenderId | ( | ) | const |
Returns the ID (a UUID) of the sending participant.
Definition at line 60 of file MetaData.cpp.
References senderId.
boost::uint64_t rsb::MetaData::getSendTime | ( | ) | const |
Returns the time at which the generated notification for an event was sent on the bus (after serialization).
Definition at line 116 of file MetaData.cpp.
References sendTime.
string rsb::MetaData::getUserInfo | ( | const std::string & | key | ) | const |
Returns the user-defined string for the given key.
key | key to look up |
std::invalid_argument | no info set for the specified key |
Definition at line 223 of file MetaData.cpp.
References userInfos.
boost::uint64_t rsb::MetaData::getUserTime | ( | const std::string & | key | ) | const |
Returns the user timestamp stored under the provided key.
key | key of the user-provided timestamp |
std::invalid_argument | no timestamp stored und the provided key |
Definition at line 177 of file MetaData.cpp.
References userTimes.
bool rsb::MetaData::hasUserInfo | ( | const std::string & | key | ) | const |
Checks whether a user info exists under the provided key.
key | key to check |
true
if an info for the key is defined, else false
Definition at line 219 of file MetaData.cpp.
References userInfos.
bool rsb::MetaData::hasUserTime | ( | const std::string & | key | ) | const |
Checks whether a user-provided timestamp with the given key exists.
key | the key to check |
true
if a timestamp for the given key exists, else false
Definition at line 173 of file MetaData.cpp.
References userTimes.
bool rsb::MetaData::operator== | ( | const MetaData & | other | ) | const |
Definition at line 245 of file MetaData.cpp.
References createTime, deliverTime, receiveTime, senderId, sendTime, userInfos, and userTimes.
void rsb::MetaData::printContents | ( | std::ostream & | stream | ) | const |
Definition at line 53 of file MetaData.cpp.
References createTime, deliverTime, receiveTime, senderId, sendTime, userInfos, and userTimes.
void rsb::MetaData::setCreateTime | ( | const boost::uint64_t & | time = 0 | ) |
Sets the time stamp that is automatically filled with the time the event instance was created by the language binding.
This should usually reflect the time at which the notified condition most likely occurred in the sender. If event instances are reused, it has to be reset manually by the client.
time | timestamp in microseconds or 0 to use current system time |
Definition at line 104 of file MetaData.cpp.
References checkedTimeStampSet(), and createTime.
Referenced by rsb::transport::socket::notificationToEvent().
void rsb::MetaData::setCreateTime | ( | const double & | time | ) |
Definition at line 108 of file MetaData.cpp.
References checkedTimeStampSet(), and createTime.
void rsb::MetaData::setCreateTime | ( | const boost::posix_time::ptime & | time | ) |
Definition at line 112 of file MetaData.cpp.
References checkedTimeStampSet(), and createTime.
void rsb::MetaData::setDeliverTime | ( | const boost::uint64_t & | time = 0 | ) |
Sets the time at which an event was decoded and will be dispatched to the client as soon as possible (set directly before passing it to the client handler).
time | timestamp in microseconds or 0 to use current system time |
Definition at line 152 of file MetaData.cpp.
References checkedTimeStampSet(), and deliverTime.
void rsb::MetaData::setDeliverTime | ( | const double & | time | ) |
Definition at line 156 of file MetaData.cpp.
References checkedTimeStampSet(), and deliverTime.
void rsb::MetaData::setDeliverTime | ( | const boost::posix_time::ptime & | time | ) |
Definition at line 160 of file MetaData.cpp.
References checkedTimeStampSet(), and deliverTime.
void rsb::MetaData::setReceiveTime | ( | const boost::uint64_t & | time = 0 | ) |
Sets the time at which an event is received by listener in its encoded form.
time | timestamp in microseconds or 0 to use current system time |
Definition at line 136 of file MetaData.cpp.
References checkedTimeStampSet(), and receiveTime.
Referenced by rsb::transport::socket::notificationToEvent().
void rsb::MetaData::setReceiveTime | ( | const double & | time | ) |
Definition at line 140 of file MetaData.cpp.
References checkedTimeStampSet(), and receiveTime.
void rsb::MetaData::setReceiveTime | ( | const boost::posix_time::ptime & | time | ) |
Definition at line 144 of file MetaData.cpp.
References checkedTimeStampSet(), and receiveTime.
void rsb::MetaData::setSenderId | ( | const rsc::misc::UUID & | senderId | ) |
Sets the ID (a UUID) of the sending participant.
senderId | id of the sending participant |
Definition at line 64 of file MetaData.cpp.
References senderId.
void rsb::MetaData::setSendTime | ( | const boost::uint64_t & | time = 0 | ) |
Sets the time at which the generated notification for an event was sent on the bus (after serialization).
time | timestamp in microseconds or 0 to use current system time |
Definition at line 120 of file MetaData.cpp.
References checkedTimeStampSet(), and sendTime.
Referenced by rsb::transport::socket::notificationToEvent().
void rsb::MetaData::setSendTime | ( | const double & | time | ) |
Definition at line 124 of file MetaData.cpp.
References checkedTimeStampSet(), and sendTime.
void rsb::MetaData::setSendTime | ( | const boost::posix_time::ptime & | time | ) |
Definition at line 128 of file MetaData.cpp.
References checkedTimeStampSet(), and sendTime.
void rsb::MetaData::setUserInfo | ( | const std::string & | key, |
const std::string & | value | ||
) |
Sets a user info with the specified key and value or replaces and already existing one.
key | the key to set |
value | the user value |
Definition at line 232 of file MetaData.cpp.
References userInfos.
Referenced by rsb::transport::socket::notificationToEvent().
void rsb::MetaData::setUserTime | ( | const std::string & | key, |
const boost::uint64_t & | time = 0 |
||
) |
Sets a user timestamp and replaces existing entries.
key | the key for the timestamp |
time | time in microseconds or 0 to use current system time |
Definition at line 186 of file MetaData.cpp.
References checkedTimeStampSet(), and userTimes.
Referenced by rsb::transport::socket::notificationToEvent().
void rsb::MetaData::setUserTime | ( | const std::string & | key, |
const double & | time | ||
) |
Definition at line 191 of file MetaData.cpp.
References checkedTimeStampSet(), and userTimes.
void rsb::MetaData::setUserTime | ( | const std::string & | key, |
const boost::posix_time::ptime & | time | ||
) |
Definition at line 196 of file MetaData.cpp.
References checkedTimeStampSet(), and userTimes.
set< string > rsb::MetaData::userInfoKeys | ( | ) | const |
Returns all keys of user-defined infos.
Definition at line 210 of file MetaData.cpp.
References userInfos.
map< string, string >::const_iterator rsb::MetaData::userInfosBegin | ( | ) | const |
Definition at line 237 of file MetaData.cpp.
References userInfos.
map< string, string >::const_iterator rsb::MetaData::userInfosEnd | ( | ) | const |
Definition at line 241 of file MetaData.cpp.
References userInfos.
set< string > rsb::MetaData::userTimeKeys | ( | ) | const |
Returns the keys of all available user times.
Definition at line 164 of file MetaData.cpp.
References userTimes.
map< string, boost::uint64_t >::const_iterator rsb::MetaData::userTimesBegin | ( | ) | const |
Definition at line 202 of file MetaData.cpp.
References userTimes.
map< string, boost::uint64_t >::const_iterator rsb::MetaData::userTimesEnd | ( | ) | const |
Definition at line 206 of file MetaData.cpp.
References userTimes.
|
private |
Definition at line 257 of file MetaData.h.
Referenced by getCreateTime(), operator==(), printContents(), and setCreateTime().
|
private |
Definition at line 260 of file MetaData.h.
Referenced by getDeliverTime(), operator==(), printContents(), and setDeliverTime().
|
private |
Definition at line 259 of file MetaData.h.
Referenced by getReceiveTime(), operator==(), printContents(), and setReceiveTime().
|
private |
Definition at line 249 of file MetaData.h.
Referenced by getSenderId(), operator==(), printContents(), and setSenderId().
|
private |
Definition at line 258 of file MetaData.h.
Referenced by getSendTime(), operator==(), printContents(), and setSendTime().
|
staticprivate |
Definition at line 255 of file MetaData.h.
Referenced by checkedTimeStampSet().
|
private |
Definition at line 263 of file MetaData.h.
Referenced by getUserInfo(), hasUserInfo(), operator==(), printContents(), setUserInfo(), userInfoKeys(), userInfosBegin(), and userInfosEnd().
|
private |
Definition at line 262 of file MetaData.h.
Referenced by getUserTime(), hasUserTime(), operator==(), printContents(), setUserTime(), userTimeKeys(), userTimesBegin(), and userTimesEnd().