123#define VLINK_INTRA_DATA_DECLARE(target_type, declare_name) \
124 struct declare_name##Type : public vlink::IntraDataType { \
127 static constexpr vlink::Serializer::Type kValueType = vlink::Serializer::get_type_of<target_type>(); \
129 static_assert(vlink::Serializer::is_supported(kValueType), \
130 "VLINK_INTRA_DATA_DECLARE(target_type) is not a supported Serializer type."); \
132 bool operator<<(const vlink::Bytes& bytes) noexcept { \
133 return vlink::Serializer::deserialize<kValueType>(bytes, value); \
136 bool operator>>(vlink::Bytes& bytes) const noexcept { \
137 return vlink::Serializer::serialize<kValueType>(value, bytes); \
140 [[nodiscard]] size_t get_serialized_size() const noexcept { \
141 return vlink::Serializer::get_serialized_size<kValueType>(value); \
144 [[nodiscard]] static std::string get_serialized_type() noexcept { \
145 return vlink::Serializer::get_serialized_type<kValueType, target_type>(); \
148 [[nodiscard]] static constexpr vlink::SchemaType get_schema_type() noexcept { \
149 return vlink::Serializer::get_schema_type<kValueType, target_type>(); \
153 struct declare_name : public std::shared_ptr<declare_name##Type> { \
154 using Base = std::shared_ptr<declare_name##Type>; \
158 declare_name() noexcept = default; \
160 declare_name(Base&& other) noexcept : Base(std::move(other)) {} \
162 declare_name(const Base& other) noexcept : Base(other) {} \
164 [[nodiscard]] static declare_name create() noexcept { \
165 return declare_name(std::make_shared<declare_name##Type>()); \
std::shared_ptr< IntraDataType > IntraData
Shared-ownership handle for an IntraDataType payload.
Definition intra_data.h:96
Compile-time type-detection and serialisation utilities for VLink messages.
virtual ~IntraDataType()=default
Core type definitions shared across all VLink node implementations.