Go to the documentation of this file.
120 template <
typename T>
124 throw UrException(
"Could not parse received package. This can occur if the driver is started while the robot is "
125 "booting - please restart the driver once the robot has finished booting. "
126 "If the problem persists after the robot has booted, please contact the package maintainer.");
128 std::memcpy(&val,
buf_pos_,
sizeof(T));
138 template <
typename T>
153 parse<uint64_t>(inner);
154 std::memcpy(&val, &inner,
sizeof(
double));
164 parse<uint32_t>(inner);
165 std::memcpy(&val, &inner,
sizeof(
float));
180 parse<uint8_t>(inner);
191 for (
size_t i = 0; i < val.size(); ++i)
204 for (
size_t i = 0; i < val.size(); ++i)
217 for (
size_t i = 0; i < val.size(); ++i)
230 for (
size_t i = 0; i < val.size(); ++i)
242 void rawData(std::unique_ptr<uint8_t[]>& buffer,
size_t& buffer_length)
245 buffer.reset(
new uint8_t[buffer_length]);
246 memcpy(buffer.get(),
buf_pos_, buffer_length);
266 void parse(std::string& val,
size_t len)
268 val.assign(
reinterpret_cast<char*
>(
buf_pos_), len);
281 parse(val,
size_t(len));
291 template <
typename T,
size_t N>
294 for (
size_t i = 0; i < N; i++)
307 template <
typename T,
size_t N>
312 set = std::bitset<N>(val);
350 template <
typename T>
353 size_t size =
sizeof(T);
T peek()
Parses the next bytes as given type without moving the buffer pointer.
bool checkSize(void)
Checks if enough bytes for a given type remain unparsed in the buffer.
void parse(double &val)
Parses the next bytes as a double.
void parse(vector3d_t &val)
Parses the next bytes as a vector of 3 doubles.
BinParser(BinParser &parent, size_t sub_len)
Creates a new BinParser object for part of a buffer from a parent BinParser.
std::array< double, 6 > vector6d_t
#define URCL_LOG_DEBUG(...)
void parse(std::string &val)
Special string parse function that assumes uint8_t len followed by chars.
void parse(std::array< T, N > &array)
Parses the next bytes as an array of a given type and size.
uint64_t decode(uint64_t val)
void parse(std::bitset< N > &set)
Parses the next bytes as a value of a given type, but also copies it to a bitset.
uint16_t decode(uint16_t val)
void parse(vector6uint32_t &val)
Parses the next bytes as a vector of 6 unsigned 32 bit integers.
std::array< uint32_t, 6 > vector6uint32_t
std::array< int32_t, 6 > vector6int32_t
Our base class for exceptions. Specialized exceptions should inherit from those.
void parseRemainder(std::string &val)
Parses the remaining bytes as a string.
uint32_t decode(uint32_t val)
bool empty()
Checks if no unparsed bytes remain in the buffer.
void consume()
Sets the current buffer position to the end of the buffer, finishing parsing.
bool checkSize(size_t bytes)
Checks if at least a given number of bytes is still remaining unparsed in the buffer.
void parse(float &val)
Parses the next bytes as a float.
void parse(bool &val)
Parses the next byte as a bool.
~BinParser()
Deconstructor for the BinParser.
int16_t decode(int16_t val)
int64_t decode(int64_t val)
void parse(std::string &val, size_t len)
Parses a given number of bytes as a string.
void parse(vector6d_t &val)
Parses the next bytes as a vector of 6 doubles.
std::array< double, 3 > vector3d_t
int32_t decode(int32_t val)
void consume(size_t bytes)
Moves the current buffer position ahead by a given amount.
void parse(T &val)
Parses the next bytes as given type.
The BinParser class handles a byte buffer and functionality to iteratively parse the content.
BinParser(uint8_t *buffer, size_t buf_len)
Creates a new BinParser object from a given buffer.
void parse(vector6int32_t &val)
Parses the next bytes as a vector of 6 32 bit integers.
void rawData(std::unique_ptr< uint8_t[]> &buffer, size_t &buffer_length)
Writes the remaining bytes into a given buffer without parsing them.
void debug()
Logs debugging information about the BinParser object.
ur_client_library
Author(s): Thomas Timm Andersen, Simon Rasmussen, Felix Exner, Lea Steffen, Tristan Schnell
autogenerated on Mon May 26 2025 02:35:58