An abstraction for a block of bytes, with optional responsibility for allocating/destroying that block.
More...
#include <yarp/os/ManagedBytes.h>
An abstraction for a block of bytes, with optional responsibility for allocating/destroying that block.
Definition at line 24 of file ManagedBytes.h.
◆ ManagedBytes() [1/4]
ManagedBytes::ManagedBytes |
( |
| ) |
|
|
explicit |
◆ ManagedBytes() [2/4]
ManagedBytes::ManagedBytes |
( |
size_t |
len | ) |
|
|
explicit |
Constructor.
Makes a data block of the specified length that will be deleted if this object is destroyed.
- Parameters
-
Definition at line 28 of file ManagedBytes.cpp.
◆ ManagedBytes() [3/4]
ManagedBytes::ManagedBytes |
( |
const Bytes & |
ext, |
|
|
bool |
owned = false |
|
) |
| |
Constructor.
Represent external data.
- Parameters
-
ext | address and length of data |
owned | true if data should be deleted if this object is destroyed |
Definition at line 36 of file ManagedBytes.cpp.
◆ ManagedBytes() [4/4]
Copy constructor.
- Parameters
-
alt | the data to copy. If it is "owned" an independent copy is made. |
Definition at line 44 of file ManagedBytes.cpp.
◆ ~ManagedBytes()
ManagedBytes::~ManagedBytes |
( |
| ) |
|
|
virtual |
◆ allocate()
void ManagedBytes::allocate |
( |
size_t |
len | ) |
|
Makes a data block of the specified length that will be deleted if this object is destroyed.
- Parameters
-
Definition at line 74 of file ManagedBytes.cpp.
◆ allocateOnNeed()
bool ManagedBytes::allocateOnNeed |
( |
size_t |
neededLen, |
|
|
size_t |
allocateLen |
|
) |
| |
◆ bytes() [1/2]
const Bytes & ManagedBytes::bytes |
( |
| ) |
const |
- Returns
- description of data block associated with this object (const version)
Definition at line 138 of file ManagedBytes.cpp.
◆ bytes() [2/2]
Bytes & ManagedBytes::bytes |
( |
| ) |
|
- Returns
- description of data block associated with this object
Definition at line 142 of file ManagedBytes.cpp.
◆ clear()
void ManagedBytes::clear |
( |
| ) |
|
Disassociate object with any data block (deleting block if appropriate).
Definition at line 126 of file ManagedBytes.cpp.
◆ copy()
void ManagedBytes::copy |
( |
| ) |
|
Makes sure data block is owned, making a copy if necessary.
Definition at line 99 of file ManagedBytes.cpp.
◆ get() [1/2]
const char * ManagedBytes::get |
( |
| ) |
const |
◆ get() [2/2]
char * ManagedBytes::get |
( |
| ) |
|
◆ isOwner()
bool yarp::os::ManagedBytes::isOwner |
( |
| ) |
const |
|
inline |
- Returns
- true iff the managed data block is owned by this object
Definition at line 146 of file ManagedBytes.h.
◆ length()
size_t ManagedBytes::length |
( |
| ) |
const |
◆ operator=()
Assignment operator.
- Parameters
-
alt | the data to copy. If it is "owned" an independent copy is made. |
- Returns
- this object
Definition at line 55 of file ManagedBytes.cpp.
◆ read()
Read this object from a network connection.
Override this for your particular class.
- Parameters
-
reader | an interface to the network connection for reading |
- Returns
- true iff the object is successfully read
Implements yarp::os::Portable.
Definition at line 163 of file ManagedBytes.cpp.
◆ resetUsed()
size_t ManagedBytes::resetUsed |
( |
| ) |
|
◆ setUsed()
size_t ManagedBytes::setUsed |
( |
size_t |
used | ) |
|
explicitly declare how many of the bytes are in use.
- Parameters
-
- Returns
- a confirmation of the number of bytes declared to be in use.
Definition at line 150 of file ManagedBytes.cpp.
◆ used()
size_t ManagedBytes::used |
( |
| ) |
const |
◆ usedBytes()
Bytes ManagedBytes::usedBytes |
( |
| ) |
|
- Returns
- description of used portion of data block associated with this object
Definition at line 146 of file ManagedBytes.cpp.
◆ write()
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
-
writer | an interface to the network connection for writing |
- Returns
- true iff the object is successfully written
Implements yarp::os::Portable.
Definition at line 184 of file ManagedBytes.cpp.
Bytes yarp::os::ManagedBytes::b |
|
private |
◆ owned
bool yarp::os::ManagedBytes::owned |
|
private |
◆ use
size_t yarp::os::ManagedBytes::use |
|
private |
◆ use_set
bool yarp::os::ManagedBytes::use_set |
|
private |
The documentation for this class was generated from the following files: