SBB Host
Host communication with the self balancing bike.
Loading...
Searching...
No Matches
Packet< T, Size > Class Template Reference

A templated-class for managing data packet. More...

#include <Packet.h>

Public Member Functions

 Packet ()
 Constructor. More...
 
getValue (unsigned int i)
 Get a value of the packet. More...
 

Public Attributes

value [Size] = { 0 }
 Buffer with base type T and size Size. More...
 
unsigned int id [Size]
 Zero-based index of data elements (from 0 to Size-1). More...
 
const unsigned int size = Size
 Number of element of the packet. More...
 
const unsigned int bytes = Size * sizeof(T)
 Number of bytes of the packet according to sizeof(T) and Size. More...
 

Detailed Description

template<typename T, size_t Size>
class Packet< T, Size >

A templated-class for managing data packet.

Templated-class for managing data-packet with used-defined type and size, used in SBBHostCore.

See also
SBBHostCore
Template Parameters
TThe base type of the packet.
SizeThe size of the packet (number of element with type T).
Author
Stefano Lovato
Date
2022

Constructor & Destructor Documentation

◆ Packet()

template<typename T , size_t Size>
Packet< T, Size >::Packet ( )
inline

Constructor.

Default constructor.

Member Function Documentation

◆ getValue()

template<typename T , size_t Size>
T Packet< T, Size >::getValue ( unsigned int  i)
inline

Get a value of the packet.

Function to get a value of the packet.

Parameters
iThe index of the value.
Returns
The value of type T.

Member Data Documentation

◆ bytes

template<typename T , size_t Size>
const unsigned int Packet< T, Size >::bytes = Size * sizeof(T)

Number of bytes of the packet according to sizeof(T) and Size.

◆ id

template<typename T , size_t Size>
unsigned int Packet< T, Size >::id[Size]

Zero-based index of data elements (from 0 to Size-1).

◆ size

template<typename T , size_t Size>
const unsigned int Packet< T, Size >::size = Size

Number of element of the packet.

◆ value

template<typename T , size_t Size>
T Packet< T, Size >::value[Size] = { 0 }

Buffer with base type T and size Size.