PhoenixSerializer  3.0.0
PhoenixSerializer is a framework to save/load/serialize/deserialize data
Loading...
Searching...
No Matches
Serializer< SerializeIter, SerializeMode::READ, bool > Struct Reference

How to read bool from a message. More...

#include <data_stream_message.h>

Inheritance diagram for Serializer< SerializeIter, SerializeMode::READ, bool >:
Collaboration diagram for Serializer< SerializeIter, SerializeMode::READ, bool >:

Static Public Member Functions

static bool phoenix_serialize (SerializeIter &ds, bool &data)
 Read the bool in the message.
static bool phoenix_serialize (SerializeIter &ds, bool *data, size_t nbElement)
 Read the bool in the message.

Detailed Description

How to read bool from a message.

Definition at line 14 of file data_stream_message.h.

Member Function Documentation

◆ phoenix_serialize() [1/2]

bool Serializer< SerializeIter, SerializeMode::READ, bool >::phoenix_serialize ( SerializeIter & ds,
bool & data )
static

Read the bool in the message.

Parameters
[out]ds: message to be read
[out]data: data to be set
Returns
true on success, false otherwise

Definition at line 14 of file data_stream_message.cpp.

14 {
15 char * srcByte = reinterpret_cast<char *>(&data); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) the data is read or written as raw bytes
16 memcpy(srcByte, ds, sizeof(bool));
17 ds += sizeof(bool); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) the message iterator moves forward after each read or write, the message is allocated with data_size
18 return true;
19}
Generic Serializer class.

◆ phoenix_serialize() [2/2]

bool Serializer< SerializeIter, SerializeMode::READ, bool >::phoenix_serialize ( SerializeIter & ds,
bool * data,
size_t nbElement )
static

Read the bool in the message.

Parameters
[out]ds: message to be read
[out]data: data to be set
nbElement: number of element of the data
Returns
true on success, false otherwise

Definition at line 27 of file data_stream_message.cpp.

27 {
28 char * srcByte = reinterpret_cast<char *>(data); // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast) the data is read or written as raw bytes
29 memcpy(srcByte, ds, sizeof(bool) * nbElement);
30 ds += sizeof(bool) * nbElement; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) the message iterator moves forward after each read or write, the message is allocated with data_size
31 return true;
32}

The documentation for this struct was generated from the following files: