Dataflow Runtime API
3.1.1.0
|
Serializes various data types into the given byte buffer. More...
#include <Imt.Base.Core.Serialization/Serializer.h>
Public Member Functions | |
Serializer (uint8_t buffer[], const uint32_t bufferSize) | |
Constructor. More... | |
virtual | ~Serializer (void) |
Destructor. More... | |
uint32_t | getBufferPos (void) const |
Returns the write position within the byte buffer. More... | |
void | setBufferPos (const uint32_t newPos) |
Sets the write position to the given position. More... | |
uint32_t | getBufferSize (void) const |
Returns the size of the byte buffer in number of bytes. More... | |
const uint8_t * | getBuffer (void) const |
Returns the pointer to the byte buffer. More... | |
uint32_t | getUnusedBufferSize (void) const |
Returns the remaining data to write from the current position until the buffer is full. More... | |
bool | isReset (void) const |
States if the serializer is reset (getBufferPos == 0). More... | |
bool | isFullySerialized (void) const |
States if the buffer is completely serialized. More... | |
const uint8_t & | getBufferByte (const uint32_t indexOfByte) const |
Returns the byte of the byte buffer at the given index. More... | |
void | reset (void) |
Resets the Serializer. More... | |
Serializer & | operator<< (const bool data) |
Puts a bool into the Serializer. More... | |
Serializer & | operator<< (const uint8_t data) |
Puts a uint8_t into the Serializer. More... | |
Serializer & | operator<< (const char_t data) |
Puts a character into the Serializer. More... | |
Serializer & | operator<< (const char_t *data) |
Puts a null terminated string into the Serializer. More... | |
Serializer & | operator<< (const int8_t data) |
Puts a int8_t into the Serializer. More... | |
Serializer & | operator<< (const uint16_t data) |
Puts a uint16_t into the Serializer. More... | |
Serializer & | operator<< (const int16_t data) |
Puts a int16_t into the Serializer. More... | |
Serializer & | operator<< (const uint32_t data) |
Puts a uint32_t into the Serializer. More... | |
Serializer & | operator<< (const int32_t data) |
Puts a int32_t into the Serializer. More... | |
Serializer & | operator<< (const uint64_t data) |
Puts a uint64_t into the Serializer. More... | |
Serializer & | operator<< (const int64_t data) |
Puts a int64_t into the Serializer. More... | |
Serializer & | operator<< (const float32_t data) |
Puts a float into the Serializer. More... | |
Serializer & | operator<< (const float64_t data) |
Puts a double into the Serializer. More... | |
Serializer & | pushData (const void *const pDataSrc, const uint32_t bytes) |
Puts data into the Serializer. More... | |
Serializer & | operator<< (const SerializableIfc &data) |
Puts data into the Serializer. More... | |
Serializes various data types into the given byte buffer.
The read position can be set to the beginning by calling reset. Important: The byte buffer passed with the constructor is storing the actual result.
|
explicit |
Constructor.
buffer[] | Byte buffer array to where the data should be written. Must be valid (!= NULL)! |
bufferSize | Size of the byte buffer in number of bytes. |
|
virtual |
Destructor.
const uint8_t* imt::base::core::serialization::Serializer::getBuffer | ( | void | ) | const |
Returns the pointer to the byte buffer.
const uint8_t& imt::base::core::serialization::Serializer::getBufferByte | ( | const uint32_t | indexOfByte | ) | const |
Returns the byte of the byte buffer at the given index.
indexOfByte | Index of the byte to return. |
uint32_t imt::base::core::serialization::Serializer::getBufferPos | ( | void | ) | const |
Returns the write position within the byte buffer.
uint32_t imt::base::core::serialization::Serializer::getBufferSize | ( | void | ) | const |
Returns the size of the byte buffer in number of bytes.
uint32_t imt::base::core::serialization::Serializer::getUnusedBufferSize | ( | void | ) | const |
Returns the remaining data to write from the current position until the buffer is full.
bool imt::base::core::serialization::Serializer::isFullySerialized | ( | void | ) | const |
States if the buffer is completely serialized.
bool imt::base::core::serialization::Serializer::isReset | ( | void | ) | const |
States if the serializer is reset (getBufferPos == 0).
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const bool | data | ) |
Puts a bool into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const char_t * | data | ) |
Puts a null terminated string into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const char_t | data | ) |
Puts a character into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const float32_t | data | ) |
Puts a float into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const float64_t | data | ) |
Puts a double into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const int16_t | data | ) |
Puts a int16_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const int32_t | data | ) |
Puts a int32_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const int64_t | data | ) |
Puts a int64_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const int8_t | data | ) |
Puts a int8_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const SerializableIfc & | data | ) |
Puts data into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const uint16_t | data | ) |
Puts a uint16_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const uint32_t | data | ) |
Puts a uint32_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const uint64_t | data | ) |
Puts a uint64_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::operator<< | ( | const uint8_t | data | ) |
Puts a uint8_t into the Serializer.
data | Data to put into the serializer. |
Serializer& imt::base::core::serialization::Serializer::pushData | ( | const void *const | pDataSrc, |
const uint32_t | bytes | ||
) |
Puts data into the Serializer.
pDataSrc | Pointer to the data source. |
bytes | Number of bytes to put into the serializer. |
void imt::base::core::serialization::Serializer::reset | ( | void | ) |
Resets the Serializer.
void imt::base::core::serialization::Serializer::setBufferPos | ( | const uint32_t | newPos | ) |
Sets the write position to the given position.
newPos | New write position. |