RSB  0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rsb::MetaData Class Reference

Framework-supplied meta data attached to each event that give information e.g. More...

#include <MetaData.h>

Inheritance diagram for rsb::MetaData:
Inheritance graph
Collaboration diagram for rsb::MetaData:
Collaboration graph

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 &timestamp, const boost::uint64_t &proposedValue)
void checkedTimeStampSet (boost::uint64_t &timestamp, const double &proposedValue)
void checkedTimeStampSet (boost::uint64_t &timestamp, 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

Detailed Description

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).

Author
jwienke

Definition at line 54 of file MetaData.h.

Constructor & Destructor Documentation

rsb::MetaData::MetaData ( )

Definition at line 41 of file MetaData.cpp.

rsb::MetaData::~MetaData ( )
virtual

Definition at line 46 of file MetaData.cpp.

Member Function Documentation

void rsb::MetaData::checkedTimeStampSet ( boost::uint64_t &  timestamp,
const boost::uint64_t &  proposedValue 
)
private

Definition at line 84 of file MetaData.cpp.

Referenced by setCreateTime(), setDeliverTime(), setReceiveTime(), setSendTime(), and setUserTime().

Here is the caller graph for this function:

void rsb::MetaData::checkedTimeStampSet ( boost::uint64_t &  timestamp,
const double &  proposedValue 
)
private

Definition at line 72 of file MetaData.cpp.

void rsb::MetaData::checkedTimeStampSet ( boost::uint64_t &  timestamp,
const boost::posix_time::ptime &  proposedValue 
)
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.

Returns
timestamp in microseconds

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).

Returns
timestamp in microseconds

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.

Returns
timestamp in microseconds

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.

Returns
A copy of the sender id UUID object.

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).

Returns
timestamp in microseconds

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.

Parameters
keykey to look up
Returns
user info given for this key
Exceptions
std::invalid_argumentno 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.

Parameters
keykey of the user-provided timestamp
Returns
timestamp
Exceptions
std::invalid_argumentno 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.

Parameters
keykey to check
Returns
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.

Parameters
keythe key to check
Returns
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.

Parameters
timetimestamp 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().

Here is the call graph for this function:

Here is the caller graph for this function:

void rsb::MetaData::setCreateTime ( const double &  time)

Definition at line 108 of file MetaData.cpp.

References checkedTimeStampSet(), and createTime.

Here is the call graph for this function:

void rsb::MetaData::setCreateTime ( const boost::posix_time::ptime &  time)

Definition at line 112 of file MetaData.cpp.

References checkedTimeStampSet(), and createTime.

Here is the call graph for this function:

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).

Parameters
timetimestamp in microseconds or 0 to use current system time

Definition at line 152 of file MetaData.cpp.

References checkedTimeStampSet(), and deliverTime.

Here is the call graph for this function:

void rsb::MetaData::setDeliverTime ( const double &  time)

Definition at line 156 of file MetaData.cpp.

References checkedTimeStampSet(), and deliverTime.

Here is the call graph for this function:

void rsb::MetaData::setDeliverTime ( const boost::posix_time::ptime &  time)

Definition at line 160 of file MetaData.cpp.

References checkedTimeStampSet(), and deliverTime.

Here is the call graph for this function:

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.

Parameters
timetimestamp 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().

Here is the call graph for this function:

Here is the caller graph for this function:

void rsb::MetaData::setReceiveTime ( const double &  time)

Definition at line 140 of file MetaData.cpp.

References checkedTimeStampSet(), and receiveTime.

Here is the call graph for this function:

void rsb::MetaData::setReceiveTime ( const boost::posix_time::ptime &  time)

Definition at line 144 of file MetaData.cpp.

References checkedTimeStampSet(), and receiveTime.

Here is the call graph for this function:

void rsb::MetaData::setSenderId ( const rsc::misc::UUID &  senderId)

Sets the ID (a UUID) of the sending participant.

Parameters
senderIdid 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).

Parameters
timetimestamp 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().

Here is the call graph for this function:

Here is the caller graph for this function:

void rsb::MetaData::setSendTime ( const double &  time)

Definition at line 124 of file MetaData.cpp.

References checkedTimeStampSet(), and sendTime.

Here is the call graph for this function:

void rsb::MetaData::setSendTime ( const boost::posix_time::ptime &  time)

Definition at line 128 of file MetaData.cpp.

References checkedTimeStampSet(), and sendTime.

Here is the call graph for this function:

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.

Parameters
keythe key to set
valuethe user value

Definition at line 232 of file MetaData.cpp.

References userInfos.

Referenced by rsb::transport::socket::notificationToEvent().

Here is the caller graph for this function:

void rsb::MetaData::setUserTime ( const std::string &  key,
const boost::uint64_t &  time = 0 
)

Sets a user timestamp and replaces existing entries.

Parameters
keythe key for the timestamp
timetime 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().

Here is the call graph for this function:

Here is the caller graph for this function:

void rsb::MetaData::setUserTime ( const std::string &  key,
const double &  time 
)

Definition at line 191 of file MetaData.cpp.

References checkedTimeStampSet(), and userTimes.

Here is the call graph for this function:

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.

Here is the call graph for this function:

set< string > rsb::MetaData::userInfoKeys ( ) const

Returns all keys of user-defined infos.

Returns
set of all defined keys

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.

Returns
set of all keys

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.

Member Data Documentation

boost::uint64_t rsb::MetaData::createTime
private

Definition at line 257 of file MetaData.h.

Referenced by getCreateTime(), operator==(), printContents(), and setCreateTime().

boost::uint64_t rsb::MetaData::deliverTime
private

Definition at line 260 of file MetaData.h.

Referenced by getDeliverTime(), operator==(), printContents(), and setDeliverTime().

boost::uint64_t rsb::MetaData::receiveTime
private

Definition at line 259 of file MetaData.h.

Referenced by getReceiveTime(), operator==(), printContents(), and setReceiveTime().

rsc::misc::UUID rsb::MetaData::senderId
private

Definition at line 249 of file MetaData.h.

Referenced by getSenderId(), operator==(), printContents(), and setSenderId().

boost::uint64_t rsb::MetaData::sendTime
private

Definition at line 258 of file MetaData.h.

Referenced by getSendTime(), operator==(), printContents(), and setSendTime().

const boost::posix_time::ptime rsb::MetaData::UNIX_EPOCH
staticprivate
Initial value:
boost::posix_time::ptime(
boost::gregorian::date(1970, boost::date_time::Jan, 1))

Definition at line 255 of file MetaData.h.

Referenced by checkedTimeStampSet().

std::map<std::string, std::string> rsb::MetaData::userInfos
private
std::map<std::string, boost::uint64_t> rsb::MetaData::userTimes
private

The documentation for this class was generated from the following files: