11#ifndef ROVECOMM_PACKET_H
12#define ROVECOMM_PACKET_H
23#if defined(__ROVECOMM_WINDOWS_MODE__) && __ROVECOMM_WINDOWS_MODE__ == 1
24#if !defined(ssize_t) && defined(_MSC_VER)
28#define _WIN32_WINNT 0x0600
29#elif _WIN32_WINNT < 0x0600
31#define _WIN32_WINNT 0x0600
41#include <sys/socket.h>
48#define htonll(x) ((1 == htonl(1)) ? (x) : (((uint64_t) htonl((x) & 0xFFFFFFFFUL)) << 32) | htonl((uint32_t) ((x) >> 32)))
49#define ntohll(x) ((1 == ntohl(1)) ? (x) : (((uint64_t) ntohl((x) & 0xFFFFFFFFUL)) << 32) | ntohl((uint32_t) ((x) >> 32)))
90 std::vector<uint8_t>
PackPacket(
const RoveCommPacket<T>& stPacket);
93 RoveCommPacket<T>
UnpackData(std::span<const uint8_t> stData);
113 template<manifest::ManifestEntry Entry>
116 template<manifest::ManifestEntry Entry>
120 stPacket.
vData.resize(Entry.DATA_COUNT);
129 static_assert(
sizeof...(Args) == Entry.
DATA_COUNT,
"The number of arguments provided does not match the data count specified in the manifest entry.");
130 return {.unDataId = Entry.
DATA_ID, .vData = {args...}};
133 template<manifest::ManifestEntry Entry>
141 template<manifest::ManifestEntry Entry>
Defines Global Constants within RoveComm C++.
Allows constraining templates to only RoveComm supported types.
Definition RoveCommManifest.h:53
constexpr size_t DataTypeSize(DataTypes eDataType)
Definition RoveCommManifest.h:1244
DataTypes
Enumeration of Data Types to be used in RoveComm.
Definition RoveCommManifest.h:34
@ UINT8_T
Definition RoveCommManifest.h:36
The RoveComm namespace contains all of the functionality for the RoveComm library....
Definition RoveCommConsts.h:23
typename manifest::Helpers::RoveCommToCType< Entry.DATA_TYPE >::c_type EntryType
Definition RoveCommPacket.h:114
RoveCommPacket< T > UnpackData(std::span< const uint8_t > spBytes)
Create a RoveCommPacket structure from a RoveCommData structure.
Definition RoveCommPacket.cpp:144
std::vector< uint8_t > PackPacket(const RoveCommPacket< T > &stPacket)
Create a RoveCommData structure from a RoveCommPacket structure.
Definition RoveCommPacket.cpp:44
RoveCommPacket< EntryType< Entry > > CreatePacket()
Definition RoveCommPacket.h:117
Definition RoveCommManifest.h:1263
Definition RoveCommManifest.h:1331
Manifest Entry Object for RoveComm.
Definition RoveCommManifest.h:106
int DATA_COUNT
Definition RoveCommManifest.h:109
int DATA_ID
Definition RoveCommManifest.h:108
Identifies one callback registered with a node's On(), so Clear() can remove that callback without to...
Definition RoveCommPacket.h:104
uint64_t ullID
Definition RoveCommPacket.h:108
uint16_t unDataId
Definition RoveCommPacket.h:106
manifest::DataTypes eDataType
Definition RoveCommPacket.h:107
The RoveCommPacket struct is used to store data in a packet format for transmission over a network....
Definition RoveCommPacket.h:75
uint16_t unDataId
Definition RoveCommPacket.h:77
uint8_t GetDataType() const
Definition RoveCommPacket.h:85
static constexpr manifest::DataTypes eDataType
Definition RoveCommPacket.h:79
size_t GetDataSize() const
Definition RoveCommPacket.h:83
uint16_t GetDataCount() const
Definition RoveCommPacket.h:81
std::vector< T > vData
Definition RoveCommPacket.h:78