13 #ifndef ROBOT_DATA_HPP_ 14 #define ROBOT_DATA_HPP_ 64 payloadBase(
const bool is_dynamic_ =
false,
const unsigned char length_ = 0 )
66 , is_dynamic(is_dynamic_)
84 if (buffer.
size() <
sizeof(T))
86 V =
static_cast<unsigned char>(buffer.
pop_front());
88 unsigned int size_value(
sizeof(T));
89 for (
unsigned int i = 1; i < size_value; i++)
91 V |= ((
static_cast<unsigned char>(buffer.
pop_front())) << (8 * i));
98 unsigned int size_value(
sizeof(T));
99 for (
unsigned int i = 0; i < size_value; i++)
101 buffer.
push_back(static_cast<unsigned char>((V >> (i * 8)) & 0xff));
115 if (buffer.size() < 4)
118 ui =
static_cast<unsigned char>(buffer.pop_front());
120 unsigned int size_value(4);
121 for (
unsigned int i = 1; i < size_value; i++)
123 ui |= ((
static_cast<unsigned char>(buffer.pop_front())) << (8 * i));
126 V =
reinterpret_cast<float&
>(ui);
132 if (buffer.size() < 4)
134 unsigned int size_value(4);
135 unsigned int ui(reinterpret_cast<const unsigned int&>(V));
136 for (
unsigned int i = 0; i < size_value; i++)
138 buffer.push_back(static_cast<unsigned char>((ui >> (i * 8)) & 0xff));
unsigned int size() const
const unsigned char length
virtual bool deserialise(ecl::PushAndPop< unsigned char > &byteStream)=0
Provides base class for payloads.
void push_back(const Type &datum)
virtual bool serialise(ecl::PushAndPop< unsigned char > &byteStream)=0
payloadBase(const bool is_dynamic_=false, const unsigned char length_=0)
void buildVariable(T &V, ecl::PushAndPop< unsigned char > &buffer)
void buildBytes(const T &V, ecl::PushAndPop< unsigned char > &buffer)