TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
Loading...
Searching...
No Matches
tec::NdTypes Struct Reference

Core type definitions and metadata for a lightweight binary serialization format. More...

#include <tec_nd_types.hpp>

Inheritance diagram for tec::NdTypes:
tec::NetData

Classes

struct  ElemHeader
 Per-element header describing the following data item. More...
 
struct  Header
 Global header placed at the start of every serialized buffer. More...
 
struct  Meta
 Bit-flag definitions for interpreting the Tag field. More...
 
struct  Tags
 Concrete tag values for all supported data types. More...
 

Public Types

using ID = uint16_t
 Unique identifier type for serialized objects/messages.
 
using Tag = uint16_t
 Tag type used to encode element kind and properties.
 
using Size = uint32_t
 Size type for individual element payload (in bytes).
 
using Count = uint16_t
 Count type for number of elements in sequences/containers.
 
using Bool = uint8_t
 Boolean storage type (always 1 byte).
 
using String = std::string
 String storage type.
 

Public Member Functions

constexpr Count to_count (size_t count)
 Convert a size_t count to Count, clamping at maximum.
 
ElemHeader get_scalar_info (const char &)
 Get element info for signed char.
 
ElemHeader get_scalar_info (const unsigned char &)
 Get element info for unsigned char.
 
ElemHeader get_scalar_info (const short &)
 Get element info for signed short.
 
ElemHeader get_scalar_info (const unsigned short &)
 Get element info for unsigned short.
 
ElemHeader get_scalar_info (const int &)
 Get element info for signed int.
 
ElemHeader get_scalar_info (const unsigned int &)
 Get element info for unsigned int.
 
ElemHeader get_scalar_info (const long &)
 Get element info for signed long.
 
ElemHeader get_scalar_info (const unsigned long &)
 Get element info for unsigned long.
 
ElemHeader get_scalar_info (const long long &)
 Get element info for signed long long.
 
ElemHeader get_scalar_info (const unsigned long long &)
 Get element info for unsigned long long.
 
ElemHeader get_scalar_info (const bool &)
 Get element info for bool.
 
ElemHeader get_scalar_info (const float &)
 Get element info for float.
 
ElemHeader get_scalar_info (const double &)
 Get element info for double.
 
ElemHeader get_scalar_info (const long double &)
 Get element info for long double (platform-dependent size).
 
ElemHeader get_seq_info (const String &str)
 Get element info for std::string (character sequence).
 
ElemHeader get_seq_info (const Blob &bytes)
 Get element info for Blob (raw byte sequence).
 
template<typename TContainer >
ElemHeader get_container_info (const TContainer &c)
 Get element info for flat containers (vector, array, etc.).
 
template<typename TMap >
ElemHeader get_map_info (const TMap &m)
 Get element info for map-like containers.
 
template<typename TObject >
ElemHeader get_object_info (const TObject &)
 Get element info for user-defined serializable objects.
 
template<typename T >
ElemHeader get_info (const T &val)
 Generic dispatcher to determine ElemHeader for any supported type.
 

Detailed Description

Core type definitions and metadata for a lightweight binary serialization format.

This structure defines tags, sizes, and helper functions used to describe serialized data elements in a compact, platform-independent way.

Member Function Documentation

◆ get_container_info()

template<typename TContainer >
ElemHeader tec::NdTypes::get_container_info ( const TContainer c)
inline

Get element info for flat containers (vector, array, etc.).

Template Parameters
TContainerContainer type.

◆ get_info()

template<typename T >
ElemHeader tec::NdTypes::get_info ( const T val)
inline

Generic dispatcher to determine ElemHeader for any supported type.

Uses compile-time trait checks to route to the appropriate specialization.

Template Parameters
TValue type.
Parameters
valReference to the value (used only for overload resolution).
Returns
Corresponding ElemHeader.

◆ get_map_info()

template<typename TMap >
ElemHeader tec::NdTypes::get_map_info ( const TMap m)
inline

Get element info for map-like containers.

Template Parameters
TMapMap type.

◆ get_object_info()

template<typename TObject >
ElemHeader tec::NdTypes::get_object_info ( const TObject )
inline

Get element info for user-defined serializable objects.

Template Parameters
TObjectSerializable type.

◆ to_count()

constexpr Count tec::NdTypes::to_count ( size_t  count)
inlineconstexpr

Convert a size_t count to Count, clamping at maximum.

Parameters
countOriginal count.
Returns
Clamped Count value.

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