Go to the documentation of this file.
35 #ifndef SICK_SAFETYSCANNERS_DATA_PROCESSING_READWRITEHELPER_HPP
36 #define SICK_SAFETYSCANNERS_DATA_PROCESSING_READWRITEHELPER_HPP
41 namespace read_write_helper {
53 inline void writeUint8(std::vector<uint8_t>::iterator it,
const uint8_t v)
89 inline void writeInt8(std::vector<uint8_t>::iterator it,
const uint8_t v)
127 *(it + 0) = (v & 0xff00) >> 8;
128 *(it + 1) = v & 0xff;
140 *(it + 0) = v & 0xff;
141 *(it + 1) = (v & 0xff00) >> 8;
154 *(it + 0) = (v & 0xff000000) >> 24;
155 *(it + 1) = (v & 0xff0000) >> 16;
156 *(it + 2) = (v & 0xff00) >> 8;
157 *(it + 3) = v & 0xff;
169 *(it + 3) = (v & 0xff000000) >> 24;
170 *(it + 2) = (v & 0xff0000) >> 16;
171 *(it + 1) = (v & 0xff00) >> 8;
172 *(it + 0) = v & 0xff;
184 *(it + 3) = (v & 0xff000000) >> 24;
185 *(it + 2) = (v & 0xff0000) >> 16;
186 *(it + 1) = (v & 0xff00) >> 8;
187 *(it + 0) = v & 0xff;
198 inline uint8_t
readUint8(std::vector<uint8_t>::const_iterator it)
237 inline int8_t
readInt8(std::vector<uint8_t>::const_iterator it)
278 return (*(it + 0) << 8) + *(it + 1);
291 return (*(it + 1) << 8) + *(it + 0);
330 return (*(it + 0) << 24) + (*(it + 1) << 16) + (*(it + 2) << 8) + *(it + 3);
343 return (*(it + 3) << 24) + (*(it + 2) << 16) + (*(it + 1) << 8) + *(it + 0);
356 return (*(it + 0) << 24) + (*(it + 1) << 16) + (*(it + 2) << 8) + *(it + 3);
370 return (*(it + 3) << 24) + (*(it + 2) << 16) + (*(it + 1) << 8) + *(it + 0);
376 #endif // SICK_SAFETYSCANNERS_DATA_PROCESSING_READWRITEHELPER_HPP
uint8_t readUint8(std::vector< uint8_t >::const_iterator it)
Read an unsigned 8-bit integer at offset.
void writeUint16BigEndian(std::vector< uint8_t >::iterator it, const uint16_t v)
Writes an unsigned 16-bit integer to a buffer at offset in big endian encoding.
void writeUint8(std::vector< uint8_t >::iterator it, const uint8_t v)
Helper Functions read and write data at a certain place in a buffer.
uint32_t readUint32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.
uint8_t readUint8LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 8-bit integer at offset in big little encoding.
void writeUint16LittleEndian(std::vector< uint8_t >::iterator it, const uint16_t v)
Writes an unsigned 16-bit integer to a buffer at offset in little endian encoding.
void writeUint32LittleEndian(std::vector< uint8_t >::iterator it, const uint32_t v)
Writes an unsigned 32-bit integer to a buffer at offset in little endian encoding.
uint32_t readUint32BigEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in big endian encoding.
void writeInt8(std::vector< uint8_t >::iterator it, const uint8_t v)
Writes a signed 8-bit integer to a buffer at offset.
int16_t readInt16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read a signed 16-bit integer at offset in little endian encoding.
int16_t readInt16BigEndian(std::vector< uint8_t >::const_iterator it)
Read a signed 16-bit integer at offset in big endian encoding.
void writeInt8LittleEndian(std::vector< uint8_t >::iterator it, const uint8_t v)
Writes a signed 8-bit integer to a buffer at offset in little endian encoding.
uint8_t readUint8BigEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 8-bit integer at offset in big endian encoding.
int8_t readInt8LittleEndian(std::vector< uint8_t >::const_iterator it)
Read a signed 8-bit integer at offset in little endian encoding.
void writeUint8LittleEndian(std::vector< uint8_t >::iterator it, const uint8_t v)
Writes an unsigned 8-bit integer to a buffer at offset in little endian encoding.
void writeUint32BigEndian(std::vector< uint8_t >::iterator it, const uint32_t v)
Writes an unsigned 32-bit integer to a buffer at offset in big endian encoding.
void writeInt8BigEndian(std::vector< uint8_t >::iterator it, const uint8_t v)
Writes a signed 8-bit integer to a buffer at offset in big endian encoding.
int8_t readInt8(std::vector< uint8_t >::const_iterator it)
Read a signed 8-bit integer at offset.
int32_t readInt32BigEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in big endian encoding.
int8_t readInt8BigEndian(std::vector< uint8_t >::const_iterator it)
Read a signed 8-bit integer at offset in big endian encoding.
uint16_t readUint16BigEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in big endian encoding.
void writeUint8BigEndian(std::vector< uint8_t >::iterator it, const uint8_t v)
Writes an unsigned 8-bit integer to a buffer at offset in big endian encoding.
uint16_t readUint16LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 16-bit integer at offset in little endian encoding.
void writeInt32LittleEndian(std::vector< uint8_t >::iterator it, const int32_t v)
Writes an unsigned 32-bit integer to a buffer at offset in little endian encoding.
int32_t readInt32LittleEndian(std::vector< uint8_t >::const_iterator it)
Read an unsigned 32-bit integer at offset in little endian encoding.