|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
32 b(
Bytes(new char[len], len)),
65 use_set = other.use_set;
90 use_set = alt.use_set;
108 char* buf =
new char[len];
117 if (
length() < neededLen && allocateLen >= neededLen) {
118 char* buf =
new char[allocateLen];
125 b =
Bytes(buf, allocateLen);
136 char* buf =
new char[len];
138 memcpy(buf,
get(), len);
151 return use_set ? use :
length();
167 if (
get() !=
nullptr) {
172 b =
Bytes(
nullptr, 0);
210 std::int32_t listTag;
211 std::int32_t listLen;
212 std::int32_t blobLen;
223 if (
get() ==
nullptr) {
void copy()
Makes sure data block is owned, making a copy if necessary.
This is a base class for objects that can be both read from and be written to the YARP network.
ManagedBytes & operator=(ManagedBytes &&other) noexcept
Move assignment operator.
bool read(ConnectionReader &reader) override
Read this object from a network connection.
size_t setUsed(size_t used)
explicitly declare how many of the bytes are in use.
static void assertion(bool shouldBeTrue)
An assertion.
void clear()
Disassociate object with any data block (deleting block if appropriate).
ManagedBytes()
Constructor.
bool write(ConnectionWriter &writer) const override
Write this object to a network connection.
bool allocateOnNeed(size_t neededLen, size_t allocateLen)
const Bytes & bytes() const
virtual bool isError() const =0
virtual std::int32_t expectInt32()=0
Read a 32-bit integer from the network connection.
An abstraction for a block of bytes, with optional responsibility for allocating/destroying that bloc...
An interface for writing to a network connection.
virtual bool convertTextMode()=0
Reads in a standard description in text mode, and converts it to a standard description in binary.
A simple abstraction for a block of bytes.
void allocate(size_t len)
Makes a data block of the specified length that will be deleted if this object is destroyed.
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.
An interface for reading from a network connection.
An interface to the operating system, including Port based communication.
virtual ~ManagedBytes()
Destructor.
virtual void appendExternalBlock(const char *data, size_t len)=0
Send a block of data to the network connection, without making a copy.
virtual bool expectBlock(char *data, size_t len)=0
Read a block of data from the network connection.