An abstraction for a sequence number, time stamp and/or frame id. More...
#include <yarp/os/StampWithFrame.h>
Inheritance diagram for yarp::os::StampWithFrame:Classes | |
| class | Private |
Public Types | |
| using | count_t = std::uint32_t |
Public Member Functions | |
| StampWithFrame () | |
| Construct an invalid StampWithFrame. | |
| StampWithFrame (count_t count, yarp::conf::float64_t time, std::string frameId={}) | |
| Construct a StampWithFrame with a given sequence number and time. | |
| StampWithFrame (const StampWithFrame &rhs) | |
| Copy constructor. | |
| StampWithFrame (StampWithFrame &&rhs) noexcept | |
| Move constructor. | |
| ~StampWithFrame () override | |
| Destructor. | |
| StampWithFrame & | operator= (const StampWithFrame &rhs) |
| Copy assignment operator. | |
| StampWithFrame & | operator= (StampWithFrame &&rhs) noexcept |
| Move assignment operator. | |
| count_t | count () const |
| Get the sequence number. | |
| yarp::conf::float64_t | timeStamp () const |
| Get the time stamp. | |
| std::string | frameId () const |
| Get the frame id. | |
| bool | isValid () const |
| Check if this StampWithFrame is valid. | |
| void | update () |
| Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequence number exceeds npos) | |
| void | update (yarp::conf::float64_t time) |
| Set the timestamp to a given time, and increments the sequence number (wrapping to 0 if the sequence exceeds npos) | |
| void | setFrameId (std::string frameId) |
| Set the frame id for this StampWithFrame. | |
| bool | read (ConnectionReader &connection) override |
| Read this object from a network connection. | |
| bool | write (ConnectionWriter &connection) const override |
| Write this object to a network connection. | |
Public Member Functions inherited from yarp::os::Portable | |
| virtual Type | getType () const |
Public Member Functions inherited from yarp::os::PortReader | |
| virtual | ~PortReader () |
| Destructor. | |
| virtual Type | getReadType () const |
Public Member Functions inherited from yarp::os::PortWriter | |
| virtual | ~PortWriter () |
| Destructor. | |
| virtual void | onCompletion () const |
| This is called when the port has finished all writing operations. | |
| virtual void | onCommencement () const |
| This is called when the port is about to begin writing operations. | |
| virtual yarp::os::Type | getWriteType () const |
Static Public Attributes | |
| static constexpr count_t | npos = static_cast<count_t>(-1) |
| Maximum sequence number, after which an incrementing sequence should return to zero. | |
Additional Inherited Members | |
Static Public Member Functions inherited from yarp::os::Portable | |
| static bool | copyPortable (const PortWriter &writer, PortReader &reader) |
| Copy one portable to another, via writing and reading. | |
An abstraction for a sequence number, time stamp and/or frame id.
This class is compatible with the Stamp class
Definition at line 21 of file StampWithFrame.h.
| using yarp::os::StampWithFrame::count_t = std::uint32_t |
Definition at line 25 of file StampWithFrame.h.
|
explicit |
Construct an invalid StampWithFrame.
Definition at line 64 of file StampWithFrame.cpp.
| StampWithFrame::StampWithFrame | ( | StampWithFrame::count_t | count, |
| yarp::conf::float64_t | time, | ||
| std::string | frameId = {} |
||
| ) |
Construct a StampWithFrame with a given sequence number and time.
| count | the sequence number. |
| time | the time stamp (in seconds, relative to an arbitrary zero time). |
| frameId | the frame id. |
Definition at line 58 of file StampWithFrame.cpp.
| StampWithFrame::StampWithFrame | ( | const StampWithFrame & | rhs | ) |
Copy constructor.
| rhs | the StampWithFrame to copy |
Definition at line 69 of file StampWithFrame.cpp.
|
noexcept |
Move constructor.
| rhs | the StampWithFrame to be moved |
Definition at line 74 of file StampWithFrame.cpp.
|
override |
Destructor.
Definition at line 79 of file StampWithFrame.cpp.
| StampWithFrame::count_t StampWithFrame::count | ( | ) | const |
Get the sequence number.
Definition at line 100 of file StampWithFrame.cpp.
| std::string StampWithFrame::frameId | ( | ) | const |
| bool StampWithFrame::isValid | ( | ) | const |
Check if this StampWithFrame is valid.
Definition at line 115 of file StampWithFrame.cpp.
| StampWithFrame & StampWithFrame::operator= | ( | const StampWithFrame & | rhs | ) |
Copy assignment operator.
| rhs | the StampWithFrame to copy |
Definition at line 84 of file StampWithFrame.cpp.
|
noexcept |
Move assignment operator.
| rhs | the StampWithFrame to be moved |
Definition at line 92 of file StampWithFrame.cpp.
|
overridevirtual |
Read this object from a network connection.
Override this for your particular class.
| reader | an interface to the network connection for reading |
Implements yarp::os::Portable.
Definition at line 135 of file StampWithFrame.cpp.
| void StampWithFrame::setFrameId | ( | std::string | frameId | ) |
Set the frame id for this StampWithFrame.
| frameId | the new frame id for this StampWithFrame |
Definition at line 130 of file StampWithFrame.cpp.
| yarp::conf::float64_t StampWithFrame::timeStamp | ( | ) | const |
| void StampWithFrame::update | ( | ) |
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequence number exceeds npos)
Definition at line 120 of file StampWithFrame.cpp.
| void StampWithFrame::update | ( | yarp::conf::float64_t | time | ) |
Set the timestamp to a given time, and increments the sequence number (wrapping to 0 if the sequence exceeds npos)
Definition at line 125 of file StampWithFrame.cpp.
|
overridevirtual |
Write this object to a network connection.
Override this for your particular class. Be aware that depending on the nature of the connections a port has, and what protocol they use, and how efficient the YARP implementation is, this method may be called once, twice, or many times, as the result of a single call to Port::write
| writer | an interface to the network connection for writing |
Implements yarp::os::Portable.
Definition at line 140 of file StampWithFrame.cpp.
|
staticconstexpr |
Maximum sequence number, after which an incrementing sequence should return to zero.
Definition at line 31 of file StampWithFrame.h.