YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
yarp::os::StampWithFrame Class Reference

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.
 

Detailed Description

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.

Member Typedef Documentation

◆ count_t

Definition at line 25 of file StampWithFrame.h.

Constructor & Destructor Documentation

◆ StampWithFrame() [1/4]

StampWithFrame::StampWithFrame ( )
explicit

Construct an invalid StampWithFrame.

Definition at line 64 of file StampWithFrame.cpp.

◆ StampWithFrame() [2/4]

StampWithFrame::StampWithFrame ( StampWithFrame::count_t  count,
yarp::conf::float64_t  time,
std::string  frameId = {} 
)

Construct a StampWithFrame with a given sequence number and time.

Parameters
countthe sequence number.
timethe time stamp (in seconds, relative to an arbitrary zero time).
frameIdthe frame id.

Definition at line 58 of file StampWithFrame.cpp.

◆ StampWithFrame() [3/4]

StampWithFrame::StampWithFrame ( const StampWithFrame &  rhs)

Copy constructor.

Parameters
rhsthe StampWithFrame to copy

Definition at line 69 of file StampWithFrame.cpp.

◆ StampWithFrame() [4/4]

StampWithFrame::StampWithFrame ( StampWithFrame &&  rhs)
noexcept

Move constructor.

Parameters
rhsthe StampWithFrame to be moved

Definition at line 74 of file StampWithFrame.cpp.

◆ ~StampWithFrame()

StampWithFrame::~StampWithFrame ( )
override

Destructor.

Definition at line 79 of file StampWithFrame.cpp.

Member Function Documentation

◆ count()

StampWithFrame::count_t StampWithFrame::count ( ) const

Get the sequence number.

Returns
the sequence number.

Definition at line 100 of file StampWithFrame.cpp.

◆ frameId()

std::string StampWithFrame::frameId ( ) const

Get the frame id.

Returns
the frame id.

Definition at line 110 of file StampWithFrame.cpp.

◆ isValid()

bool StampWithFrame::isValid ( ) const

Check if this StampWithFrame is valid.

Returns
true if this is a valid StampWithFrame

Definition at line 115 of file StampWithFrame.cpp.

◆ operator=() [1/2]

StampWithFrame & StampWithFrame::operator= ( const StampWithFrame &  rhs)

Copy assignment operator.

Parameters
rhsthe StampWithFrame to copy
Returns
this object

Definition at line 84 of file StampWithFrame.cpp.

◆ operator=() [2/2]

StampWithFrame & StampWithFrame::operator= ( StampWithFrame &&  rhs)
noexcept

Move assignment operator.

Parameters
rhsthe StampWithFrame to be moved
Returns
this object

Definition at line 92 of file StampWithFrame.cpp.

◆ read()

bool StampWithFrame::read ( ConnectionReader &  reader)
overridevirtual

Read this object from a network connection.

Override this for your particular class.

Parameters
readeran interface to the network connection for reading
Returns
true iff the object is successfully read

Implements yarp::os::Portable.

Definition at line 135 of file StampWithFrame.cpp.

◆ setFrameId()

void StampWithFrame::setFrameId ( std::string  frameId)

Set the frame id for this StampWithFrame.

Parameters
frameIdthe new frame id for this StampWithFrame

Definition at line 130 of file StampWithFrame.cpp.

◆ timeStamp()

yarp::conf::float64_t StampWithFrame::timeStamp ( ) const

Get the time stamp.

Returns
the time stamp.

Definition at line 105 of file StampWithFrame.cpp.

◆ update() [1/2]

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.

◆ update() [2/2]

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.

◆ write()

bool StampWithFrame::write ( ConnectionWriter &  writer) const
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

Parameters
writeran interface to the network connection for writing
Returns
true iff the object is successfully written

Implements yarp::os::Portable.

Definition at line 140 of file StampWithFrame.cpp.

Member Data Documentation

◆ npos

constexpr count_t yarp::os::StampWithFrame::npos = static_cast<count_t>(-1)
staticconstexpr

Maximum sequence number, after which an incrementing sequence should return to zero.

Definition at line 31 of file StampWithFrame.h.


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