Class for reading data from a CoLaCommand. More...
#include <CoLaParameterReader.h>
Public Member Functions | |
CoLaParameterReader (CoLaCommand command) | |
bool | readBool () |
Read a boolean and advance the position by 1 byte. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
int32_t | readDInt () |
Read a signed double int (32 bit) and advances position by 4 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
std::string | readFixedString (uint16_t len) |
Read a string (with a known and fixed length), and advance position according to string size. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
std::string | readFlexString () |
Read a flex string, and advance position according to string size. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
int16_t | readInt () |
Read a signed int (16 bit, range [-32768, 32767]) and advances position by 2 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
double | readLReal () |
Read a IEEE-754 double precision (64 bit) and advances position by 8 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
float | readReal () |
Read a IEEE-754 single precision (32 bit) and advances position by 4 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
int8_t | readSInt () |
Read a signed short int (8 bit, range [-128, 127]) and advances position by 1 byte. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
uint32_t | readUDInt () |
Read a unsigned int (32 bit) and advances position by 4 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
uint16_t | readUInt () |
Read a unsigned int (16 bit, range [0, 65535]) and advances position by 2 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
uint8_t | readUSInt () |
Read a unsigned short int (8 bit, range [0, 255]) and advances position by 1 byte. Throws an std::out_of_range exception if CoLaCommand is invalid More... | |
void | rewind () |
Rewind the position to the first parameter. More... | |
~CoLaParameterReader () | |
Private Member Functions | |
void | checkSize (size_t pos, size_t size) |
Private Attributes | |
CoLaCommand | m_command |
size_t | m_currentPosition |
Class for reading data from a CoLaCommand.
Definition at line 17 of file CoLaParameterReader.h.
visionary::CoLaParameterReader::CoLaParameterReader | ( | CoLaCommand | command | ) |
Definition at line 12 of file CoLaParameterReader.cpp.
|
default |
|
private |
Definition at line 19 of file CoLaParameterReader.cpp.
bool visionary::CoLaParameterReader::readBool | ( | ) |
Read a boolean and advance the position by 1 byte. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 94 of file CoLaParameterReader.cpp.
int32_t visionary::CoLaParameterReader::readDInt | ( | ) |
Read a signed double int (32 bit) and advances position by 4 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 62 of file CoLaParameterReader.cpp.
std::string visionary::CoLaParameterReader::readFixedString | ( | uint16_t | len | ) |
Read a string (with a known and fixed length), and advance position according to string size. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 106 of file CoLaParameterReader.cpp.
std::string visionary::CoLaParameterReader::readFlexString | ( | ) |
Read a flex string, and advance position according to string size. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 99 of file CoLaParameterReader.cpp.
int16_t visionary::CoLaParameterReader::readInt | ( | ) |
Read a signed int (16 bit, range [-32768, 32767]) and advances position by 2 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 46 of file CoLaParameterReader.cpp.
double visionary::CoLaParameterReader::readLReal | ( | ) |
Read a IEEE-754 double precision (64 bit) and advances position by 8 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 86 of file CoLaParameterReader.cpp.
float visionary::CoLaParameterReader::readReal | ( | ) |
Read a IEEE-754 single precision (32 bit) and advances position by 4 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 78 of file CoLaParameterReader.cpp.
int8_t visionary::CoLaParameterReader::readSInt | ( | ) |
Read a signed short int (8 bit, range [-128, 127]) and advances position by 1 byte. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 32 of file CoLaParameterReader.cpp.
uint32_t visionary::CoLaParameterReader::readUDInt | ( | ) |
Read a unsigned int (32 bit) and advances position by 4 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 70 of file CoLaParameterReader.cpp.
uint16_t visionary::CoLaParameterReader::readUInt | ( | ) |
Read a unsigned int (16 bit, range [0, 65535]) and advances position by 2 bytes. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 54 of file CoLaParameterReader.cpp.
uint8_t visionary::CoLaParameterReader::readUSInt | ( | ) |
Read a unsigned short int (8 bit, range [0, 255]) and advances position by 1 byte. Throws an std::out_of_range exception if CoLaCommand is invalid
Definition at line 39 of file CoLaParameterReader.cpp.
void visionary::CoLaParameterReader::rewind | ( | ) |
Rewind the position to the first parameter.
Definition at line 27 of file CoLaParameterReader.cpp.
|
private |
Definition at line 21 of file CoLaParameterReader.h.
|
private |
Definition at line 22 of file CoLaParameterReader.h.