TEC
A lightweight C++ library enabling safe, efficient execution in multithreaded and concurrent systems.
Loading...
Searching...
No Matches
tec_serialize.hpp File Reference

The base interface for serializable objects. More...

#include <cstdint>
#include <string>
#include <type_traits>
#include "tec/tec_def.hpp"

Go to the source code of this file.

Classes

struct  tec::Serializable
 Base interface for objects that support binary serialization. More...
 
struct  tec::NdRoot
 Root class for serializable objects used in RPC communications. More...
 
struct  tec::JsonSerializable
 Base interface for objects that support JSON serialization. More...
 

Typedefs

using tec::rpcid_t = uint16_t
 Type alias for RPC identifiers, represented as a 16-bit unsigned integer.
 

Variables

template<typename T >
constexpr bool tec::is_serializable_v = std::is_base_of<Serializable, T>::value
 Variable template to check at compile-time whether a type is serializable.
 
template<typename T >
constexpr bool tec::is_root_v = std::is_base_of<NdRoot, T>::value
 Variable template to check at compile-time whether a type is a root object for binary serizalization.
 
template<typename T >
constexpr bool tec::is_json_serializable_v = std::is_base_of<JsonSerializable, T>::value
 Variable template to check at compile-time whether a type is JSON serializable.
 

Detailed Description

The base interface for serializable objects.

Author
The Emacs Cat
Date
2025-11-29

Variable Documentation

◆ is_json_serializable_v

template<typename T >
constexpr bool tec::is_json_serializable_v = std::is_base_of<JsonSerializable, T>::value
inlineconstexpr

Variable template to check at compile-time whether a type is JSON serializable.

A type T is considered serializable if it publicly inherits from tec::JsonSerializable.

Template Parameters
TType to test

◆ is_root_v

template<typename T >
constexpr bool tec::is_root_v = std::is_base_of<NdRoot, T>::value
inlineconstexpr

Variable template to check at compile-time whether a type is a root object for binary serizalization.

A type T is considered a root object if it publicly inherits from tec::NdRoot.

Template Parameters
TType to test

◆ is_serializable_v

template<typename T >
constexpr bool tec::is_serializable_v = std::is_base_of<Serializable, T>::value
inlineconstexpr

Variable template to check at compile-time whether a type is serializable.

A type T is considered serializable if it publicly inherits from tec::Serializable.

Template Parameters
TType to test
struct MyComponent : tec::Serializable { ... };
static_assert(tec::is_serializable_v<MyComponent>);
static_assert(!tec::is_serializable_v<int>);
Base interface for objects that support binary serialization.
Definition tec_serialize.hpp:60