14#include <argos3/core/utility/datatypes/datatypes.h>
15#include <argos3/core/utility/configuration/argos_exception.h>
41 m_vecBuffer(c_byte_array.m_vecBuffer) {}
66 inline size_t Size()
const {
67 return m_vecBuffer.size();
85 m_vecBuffer.resize(un_size, un_value);
93 m_vecBuffer.swap(c_other.m_vecBuffer);
101 return m_vecBuffer.empty();
113 return !
Empty() ? &m_vecBuffer[0] : NULL;
125 return !
Empty() ? &m_vecBuffer[0] : NULL;
159 return m_vecBuffer.at(un_index);
170 return m_vecBuffer.at(un_index);
224 ssize_t un_end = -1);
454 std::vector<UInt8> m_vecBuffer;
signed int SInt32
32-bit signed integer.
unsigned int UInt32
32-bit unsigned integer.
signed short SInt16
16-bit signed integer.
unsigned char UInt8
8-bit unsigned integer.
signed long long SInt64
64-bit signed integer.
unsigned long long UInt64
64-bit unsigned integer.
unsigned short UInt16
16-bit unsigned integer.
signed char SInt8
8-bit signed integer.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
The namespace containing all the ARGoS related code.
Byte array utility class.
void Zero()
Sets the contents of the byte array to all zeros.
CByteArray(const CByteArray &c_byte_array)
Class copy constructor.
CByteArray & operator=(const CByteArray &c_byte_array)
Assignment operator.
void Clear()
Clears the byte array.
T PopFront()
Removes data from the beginning of the byte array and returns it.
size_t Size() const
Returns the current size of the byte array.
CByteArray & AddBuffer(const UInt8 *pun_buffer, size_t un_size)
Appends bytes to the byte array.
CByteArray & FetchBuffer(UInt8 *pun_buffer, size_t un_size)
Moves elements from the byte array into the passed buffer.
UInt8 & operator[](size_t un_index)
Read/write index operator.
void Swap(CByteArray &c_other)
Swaps the content of this byte array with the content of the passed one.
bool Empty() const
Returns true if the byte array is empty.
CByteArray()
Class constructor.
bool operator==(const CByteArray &c_byte_array) const
Equality comparison operator.
CByteArray & operator>>(UInt8 &un_value)
Moves an 8-bit unsigned integer from the beginning of the byte array to the target variable.
const UInt8 * ToCArray() const
Returns the contents of the byte array as a const c-style array.
UInt8 * ToCArray()
Returns the contents of the byte array as a c-style array.
UInt8 operator[](size_t un_index) const
Read-only index operator.
friend std::ostream & operator<<(std::ostream &c_os, const CByteArray &c_byte_array)
Stream operator.
void Resize(size_t un_size, UInt8 un_value=0)
Resizes the byte array to the wanted size.
CByteArray * operator()(size_t un_start, ssize_t un_end=-1)
Returns a new byte array that corresponds to a part of this byte array.