13 #ifndef ROBOT_DATA_HPP_ 14 #define ROBOT_DATA_HPP_ 20 #include <ecl/containers.hpp> 64 payloadBase(
const bool is_dynamic_ =
false,
const unsigned char length_ = 0 )
66 , is_dynamic(is_dynamic_)
88 if (buffer.
size() <
sizeof(T))
90 V =
static_cast<unsigned char>(buffer.
pop_front());
92 unsigned int size_value(
sizeof(T));
93 for (
unsigned int i = 1; i < size_value; i++)
95 V |= ((
static_cast<unsigned char>(buffer.
pop_front())) << (8 * i));
102 unsigned int size_value(
sizeof(T));
103 for (
unsigned int i = 0; i < size_value; i++)
105 buffer.
push_back(static_cast<unsigned char>((V >> (i * 8)) & 0xff));
119 if (buffer.size() < 4)
122 ui =
static_cast<unsigned char>(buffer.pop_front());
124 unsigned int size_value(4);
125 for (
unsigned int i = 1; i < size_value; i++)
127 ui |= ((
static_cast<unsigned char>(buffer.pop_front())) << (8 * i));
130 V =
reinterpret_cast<float&
>(ui);
136 if (buffer.size() < 4)
138 unsigned int size_value(4);
139 unsigned int ui(reinterpret_cast<const unsigned int&>(V));
140 for (
unsigned int i = 0; i < size_value; i++)
142 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)