YARP  2.3.68+272-20170522.1+git50f0ae7
Yet Another Robot Platform
yarp::os::Stamp Class Reference

An abstraction for a time stamp and/or sequence number. More...

#include <yarp/os/Stamp.h>

+ Inheritance diagram for yarp::os::Stamp:

Public Member Functions

 Stamp ()
 Constuct an invalid Stamp. More...
 
 Stamp (int count, double time)
 Constuct a Stamp with a given sequence number and time. More...
 
int getCount ()
 Get the sequence number. More...
 
double getTime ()
 Get the time stamp. More...
 
bool isValid ()
 Check if this Stamp is valid. More...
 
int getMaxCount ()
 Get the maximum sequence number, after which an incrementing sequence should return to zero. More...
 
void update ()
 Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequence number exceeds Stamp::getMaxCount()) More...
 
void update (double time)
 Set the timestamp to a given time, and increments the sequence number (wrapping to 0 if the sequence exceeds Stamp::getMaxCount()) More...
 
virtual bool read (ConnectionReader &connection)
 Read this object from a network connection. More...
 
virtual bool write (ConnectionWriter &connection)
 Write this object to a network connection. More...
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType ()
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType ()
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual void onCompletion ()
 This is called when the port has finished all writing operations. More...
 
virtual void onCommencement ()
 This is called when the port is about to begin writing operations. More...
 
virtual Type getWriteType ()
 

Private Attributes

NetInt32 sequenceNumber
 
NetFloat64 timeStamp
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (PortWriter &writer, PortReader &reader)
 Copy one portable to another, via writing and reading. More...
 

Detailed Description

An abstraction for a time stamp and/or sequence number.

Definition at line 24 of file Stamp.h.

Constructor & Destructor Documentation

◆ Stamp() [1/2]

yarp::os::Stamp::Stamp ( )
explicit

Constuct an invalid Stamp.

Definition at line 20 of file Stamp.cpp.

◆ Stamp() [2/2]

yarp::os::Stamp::Stamp ( int  count,
double  time 
)

Constuct a Stamp with a given sequence number and time.

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

Definition at line 15 of file Stamp.cpp.

Member Function Documentation

◆ getCount()

int yarp::os::Stamp::getCount ( )

Get the sequence number.

Returns
the sequence number.

Definition at line 25 of file Stamp.cpp.

◆ getMaxCount()

int yarp::os::Stamp::getMaxCount ( )

Get the maximum sequence number, after which an incrementing sequence should return to zero.

Returns
the maximum sequence number.

Definition at line 77 of file Stamp.cpp.

◆ getTime()

double yarp::os::Stamp::getTime ( )

Get the time stamp.

Returns
the time stamp

Definition at line 29 of file Stamp.cpp.

◆ isValid()

bool yarp::os::Stamp::isValid ( )

Check if this Stamp is valid.

Returns
true if this is a valid Stamp

Definition at line 33 of file Stamp.cpp.

◆ read()

bool yarp::os::Stamp::read ( ConnectionReader reader)
virtual

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 37 of file Stamp.cpp.

◆ update() [1/2]

void yarp::os::Stamp::update ( )

Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequence number exceeds Stamp::getMaxCount())

Definition at line 82 of file Stamp.cpp.

◆ update() [2/2]

void yarp::os::Stamp::update ( double  time)

Set the timestamp to a given time, and increments the sequence number (wrapping to 0 if the sequence exceeds Stamp::getMaxCount())

Definition at line 92 of file Stamp.cpp.

◆ write()

bool yarp::os::Stamp::write ( ConnectionWriter writer)
virtual

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 66 of file Stamp.cpp.

Member Data Documentation

◆ sequenceNumber

NetInt32 yarp::os::Stamp::sequenceNumber
private

Definition at line 26 of file Stamp.h.

◆ timeStamp

NetFloat64 yarp::os::Stamp::timeStamp
private

Definition at line 27 of file Stamp.h.


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