Class cerializer::Target
ClassList > cerializer > Target
An example message class for representing a target.
#include <serializer.hpp>
Inherits the following classes: cerializer::Message
Public Types inherited from cerializer::Message
| Type | Name |
|---|---|
| typedef std::array< char,(sizeof(FieldTypes)+...)+2 *sizeof(uint16_t)+sizeof(uint8_t)> | BinaryMessage A type alias for the array holding the full binary message, including headers and footers. |
| typedef std::array< char, 4+(std::get< 0 >(formatSize< FieldTypes >())+...)> | MessageFormat A type alias for the array holding the message's format string. |
Public Attributes
| Type | Name |
|---|---|
| const uint32_t | id A unique identifier for the target. |
| const bool | valid Flag indicating if the target data is valid. |
| const uint16_t | x The x-coordinate of the target. |
| const uint16_t | y The y-coordinate of the target. |
| const uint16_t | z The z-coordinate of the target. |
Public Static Attributes inherited from cerializer::Message
| Type | Name |
|---|---|
| const bool | registered = /* multi line expression */A static flag that triggers registration with the MessageMaker factory upon program start. |
Public Functions
| Type | Name |
|---|---|
| constexpr | Target (uint32_t initial_id, bool initial_valid, uint16_t initial_x, uint16_t initial_y, uint16_t initial_z) noexcept Constructs a new Target message. |
| constexpr std::array< char, Size()> | encode () const Encodes the message fields into a character array. |
Public Functions inherited from cerializer::Message
| Type | Name |
|---|---|
| virtual constexpr uint8_t | Code () override Gets the unique code for this message type. |
| constexpr BinaryMessage | ToBinary () const Generates the binary representation of the message. This method serializes the message fields, adds the magic head/foot and type code. |
Public Functions inherited from cerializer::BasePacket
| Type | Name |
|---|---|
| virtual constexpr uint8_t | Code () = 0 Gets the unique 8-bit code that identifies the message type. |
| virtual | ~BasePacket () = default |
Public Static Functions inherited from cerializer::Message
| Type | Name |
|---|---|
| constexpr MessageFormat | Format () Generates the format string for the message. |
| constexpr Derived | LoadBinary (BinaryMessage & binaryData) Deserializes a message from a character array. |
| constexpr Derived | LoadBinary (const std::span< char > & binaryData) Deserializes a message from a span of characters. |
| constexpr unsigned int | Size () Gets the total size of the message payload in bytes. |
| constexpr uint8_t | Type () Gets the unique code for this message type (static version). |
Public Attributes Documentation
variable id
A unique identifier for the target.
const uint32_t cerializer::Target::id;
variable valid
Flag indicating if the target data is valid.
const bool cerializer::Target::valid;
variable x
The x-coordinate of the target.
const uint16_t cerializer::Target::x;
variable y
The y-coordinate of the target.
const uint16_t cerializer::Target::y;
variable z
The z-coordinate of the target.
const uint16_t cerializer::Target::z;
Public Functions Documentation
function Target
Constructs a new Target message.
inline constexpr cerializer::Target::Target (
uint32_t initial_id,
bool initial_valid,
uint16_t initial_x,
uint16_t initial_y,
uint16_t initial_z
) noexcept
Parameters:
idA unique identifier for the target.validFlag indicating if the target data is valid.xThe x-coordinate of the target.yThe y-coordinate of the target.zThe z-coordinate of the target.
function encode
Encodes the message fields into a character array.
inline constexpr std::array< char, Size ()> cerializer::Target::encode () const
Returns:
A std::array<char, Size()> containing the serialized payload.
The documentation for this class was generated from the following file serializer.hpp