BufferSet
class BufferSet
Functions
| Name | Description |
|---|---|
| BufferSet | Construct a BufferSet copyAllData, : set to true if data should always be copied |
| add | Add empty buffer (COPY type) to the BufferSet. |
| add | Add a buffer to the BufferSet size : - size of buffer type : - BufferContents::COPY means buffer is COPY type BufferContents::NO_COPY_BYTEARRAY_CONTENTS means buffer where space allocated in char array (NO_COPY_BYTEARRAY_CONTENTS type) |
| updateSize | Update the size of the current buffer to reflect the size of the vector is refers to |
| back | Return the last buffer in the BufferSet |
| current | Return the current buffer in the BufferSet Return : |
| rewind | Rewind the BufferSet to the first position |
| next | Advance to the next buffer in the BufferSet Return : true if a next buffer exists, false otherwise |
| emplaceBack | Emplace a ByteArray at the back of the BufferSet |
| emplaceBack | Emplace a shared pointer to a vector at the end of the BufferSet |
| appendTo | Append the contents of this BufferSet to another BufferSet other: : the BufferSet to append to copy : |
| currentAsByteArray | Return the current buffer as a ByteArray Return : |
| clear | Clear the BufferSet |
| totalSize | Return the combined byte size of all buffers in the BufferSet. |
| containsNonCopies | Will return true if any data in the BufferSet is a reference or a pointer to data not managed by the BufferSet. |
| appendTo | Append the buffers of this BufferSet to, for instance, a vector of boost asio buffers, const or mutable boost_buffers : to a append to |
| currentIsByteArrayCopy | Returns true if the current buffer is a copy of a ByteArray Return : |
| sizes | Return : Returns vector of sizes of this BufferSet |
| types | Return : Returns vector of buffer types for this BufferSet |
Function Details
BufferSet
explicit BufferSet(bool copyAllData = false)
Construct a BufferSet
copyAllData,
: set to true if data should always be copied
add
void add()
Add empty buffer (COPY type) to the BufferSet.
No new buffer is added if the last buffer is still empty and of COPY type. Also makes internal information about size of last buffer (before adding a new one) consistent.
void add(std::size_t size, int type)
Add a buffer to the BufferSet
size
: - size of buffer
type
: - BufferContents::COPY means buffer is COPY type
BufferContents::NO_COPY_BYTEARRAY_CONTENTS means buffer where space allocated in char array
(NO_COPY_BYTEARRAY_CONTENTS type)
appendTo
void appendTo(BufferSet& other, bool copy = true) const
Append the contents of this BufferSet to another BufferSet
other:
: the BufferSet to append to
copy
:
template <typename BufferSequenceType> void appendTo(BufferSequenceType& boost_buffers) const
Append the buffers of this BufferSet to, for instance, a vector of boost asio buffers, const or mutable
boost_buffers
: to a append to
back
BufferType& back() const
Return the last buffer in the BufferSet
clear
void clear()
Clear the BufferSet
containsNonCopies
inline bool containsNonCopies() const
Will return true if any data in the BufferSet is a reference or a pointer to data not managed by the BufferSet.
current
BufferType& current() const
Return the current buffer in the BufferSet
Return :
currentAsByteArray
karabo::data::ByteArray currentAsByteArray() const
Return the current buffer as a ByteArray
Return :
currentIsByteArrayCopy
bool currentIsByteArrayCopy() const
Returns true if the current buffer is a copy of a ByteArray
Return :
emplaceBack
void emplaceBack(const karabo::data::ByteArray& array, bool writeSize = true)
Emplace a ByteArray at the back of the BufferSet
void emplaceBack(const std::shared_ptr<BufferType>& ptr)
Emplace a shared pointer to a vector at the end of the BufferSet
next
bool next() const
Advance to the next buffer in the BufferSet
Return : true if a next buffer exists, false otherwise
rewind
void rewind() const
Rewind the BufferSet to the first position
sizes
std::vector<unsigned int> sizes() const
Return : Returns vector of sizes of this BufferSet
totalSize
size_t totalSize() const
Return the combined byte size of all buffers in the BufferSet.
Return :
types
std::vector<int> types() const
Return : Returns vector of buffer types for this BufferSet
updateSize
void updateSize()
Update the size of the current buffer to reflect the size of the vector is refers to