An abstraction for a sequence number, time stamp and/or frame id. More...
#include <yarp/os/Header.h>
Classes | |
class | Private |
Public Types | |
using | count_t = std::uint32_t |
Public Member Functions | |
Header () | |
Construct an invalid Header. | |
Header (count_t count, yarp::conf::float64_t time, std::string frameId={}) | |
Construct a Header with a given sequence number and time. | |
Header (const Header &rhs) | |
Copy constructor. | |
Header (Header &&rhs) noexcept | |
Move constructor. | |
~Header () override | |
Destructor. | |
Header & | operator= (const Header &rhs) |
Copy assignment operator. | |
Header & | operator= (Header &&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 Header 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 header. | |
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. | |
![]() | |
virtual Type | getType () const |
![]() | |
virtual | ~PortReader () |
Destructor. | |
virtual Type | getReadType () const |
![]() | |
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 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
using yarp::os::Header::count_t = std::uint32_t |
|
explicit |
Construct an invalid Header.
Definition at line 71 of file Header.cpp.
Header::Header | ( | Header::count_t | count, |
yarp::conf::float64_t | time, | ||
std::string | frameId = {} |
||
) |
Construct a Header 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 65 of file Header.cpp.
|
noexcept |
|
override |
Destructor.
Definition at line 86 of file Header.cpp.
Header::count_t Header::count | ( | ) | const |
std::string Header::frameId | ( | ) | const |
bool Header::isValid | ( | ) | const |
Check if this Header is valid.
Definition at line 122 of file Header.cpp.
Copy assignment operator.
rhs | the Header to copy |
Definition at line 91 of file Header.cpp.
Move assignment operator.
rhs | the Header to be moved |
Definition at line 99 of file Header.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 127 of file Header.cpp.
void Header::setFrameId | ( | std::string | frameId | ) |
Set the frame id for this header.
frameId | the new frame id for this header |
Definition at line 235 of file Header.cpp.
yarp::conf::float64_t Header::timeStamp | ( | ) | const |
void Header::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 225 of file Header.cpp.
void Header::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 230 of file Header.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 198 of file Header.cpp.
|
staticconstexpr |