19 sequenceNumber = count;
31 return sequenceNumber;
41 return sequenceNumber >= 0;
66 if (len != 2 && len != 3) {
105 std::snprintf(buf, 512,
"%d %.*g", sequenceNumber,
DBL_DIG, timeStamp);
121 return std::numeric_limits<int>::max();
129 if (sequenceNumber > getMaxCount() || sequenceNumber < 0) {
138 if (sequenceNumber > getMaxCount() || sequenceNumber < 0) {
#define BOTTLE_TAG_FLOAT64
#define BOTTLE_TAG_STRING
A mini-server for performing network communication in the background.
An interface for reading from a network connection.
virtual std::string expectString()
Read a string from the network connection.
virtual bool isTextMode() const =0
Check if the connection is text mode.
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
virtual std::string expectText(const char terminatingChar='\n')=0
Read some text from the network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
virtual bool isError() const =0
virtual yarp::conf::float64_t expectFloat64()=0
Read a 64-bit floating point number from the network connection.
An interface for writing to a network connection.
virtual bool isError() const =0
virtual bool isTextMode() const =0
Check if the connection is text mode.
virtual void appendText(const std::string &str, const char terminate='\n')=0
Send a terminated string to the network connection.
virtual bool convertTextMode()=0
Converts a standard description in binary into a textual description, if the connection is in text-mo...
virtual void appendInt32(std::int32_t data)=0
Send a representation of a 32-bit integer to the network connection.
virtual void appendFloat64(yarp::conf::float64_t data)=0
Send a representation of a 64-bit floating point number to the network connection.
int getMaxCount() const
Get the maximum sequence number, after which an incrementing sequence should return to zero.
bool read(ConnectionReader &connection) override
Read this object from a network connection.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
double getTime() const
Get the time stamp.
bool isValid() const
Check if this Stamp is valid.
bool write(ConnectionWriter &connection) const override
Write this object to a network connection.
Stamp()
Construct an invalid Stamp.
int getCount() const
Get the sequence number.
double now()
Return the current time in seconds, relative to an arbitrary starting point.