32 std::string&& frameId) :
82 mPriv(std::exchange(
rhs.mPriv,
nullptr))
94 *mPriv = *(
rhs.mPriv);
102 std::swap(mPriv,
rhs.mPriv);
109 return mPriv->sequenceNumber;
114 return mPriv->timeStamp;
119 return mPriv->frameId;
124 return mPriv->sequenceNumber !=
npos;
136 if (
ret != 2 && used > 0) {
140 mPriv->sequenceNumber =
seqNum;
141 mPriv->timeStamp = ts;
153 if (len != 2 && len != 3) {
184 mPriv->frameId.clear();
201 static constexpr size_t buf_size = 512;
203 if (!mPriv->frameId.empty()) {
204 std::snprintf(buf,
buf_size,
"%d %.*g %s", mPriv->sequenceNumber,
DBL_DIG, mPriv->timeStamp, mPriv->frameId.c_str());
206 std::snprintf(buf,
buf_size,
"%d %.*g", mPriv->sequenceNumber,
DBL_DIG, mPriv->timeStamp);
211 connection.
appendInt32(mPriv->frameId.empty() ? 2 : 3);
213 connection.
appendInt32(
static_cast<std::int32_t
>(mPriv->sequenceNumber));
216 if (!mPriv->frameId.empty()) {
237 mPriv->frameId = std::move(
frameId);
#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.
void appendString(const std::string &str)
Send a string to the network connection.
#define yCAssert(component, x)
#define YARP_OS_LOG_COMPONENT(name, name_string)
double now()
Return the current time in seconds, relative to an arbitrary starting point.