|
VLink 2.0.0
A high-performance communication middleware
|
Enumerations | |
| enum | Type : uint8_t { kUnknownType = 0 , kBytesType = 1 , kDynamicType = 2 , kCustomType = 3 , kCdrType = 4 , kProtoType = 5 , kProtoPtrType = 6 , kFlatTableType = 7 , kFlatPtrType = 8 , kFlatBuilderType = 9 , kStringType = 10 , kCharsType = 11 , kStreamType = 12 , kStandardType = 13 , kStandardPtrType = 14 } |
| Identifies the serialisation codec to use for a given C++ type. More... | |
Functions | |
| constexpr bool | is_supported (Type type) noexcept |
Returns true when type identifies a supported serializer. | |
| template<typename T> | |
| constexpr Type | get_type_of () noexcept |
Deduces the Type enumerator for T at compile time. | |
| template<Type TypeT, typename T> | |
| std::string | get_serialized_type () noexcept |
Returns the serialisation type name string for T with explicit TypeT. | |
| template<typename T> | |
| std::string | get_serialized_type () noexcept |
Returns the serialisation type name string for T (type auto-detected). | |
| template<Type TypeT, typename T> | |
| size_t | get_serialized_size (const T &src) noexcept |
Returns the exact serialised byte size for a given src value. | |
| template<typename T> | |
| size_t | get_serialized_size (const T &src) noexcept |
| Returns the serialized byte size (type auto-detected). | |
| template<Type TypeT, typename T> | |
| bool | serialize (const T &src, Bytes &des, TransportType transport, uint8_t offset) |
Serializes src into des with explicit type and transport hints. | |
| template<typename T> | |
| bool | serialize (const T &src, Bytes &des) |
Serializes src into des (type and transport auto-detected). | |
| template<Type TypeT, typename T> | |
| bool | deserialize (const Bytes &src, T &des, TransportType transport) |
Deserializes src bytes into des with explicit type and transport hints. | |
| template<typename T> | |
| bool | deserialize (const Bytes &src, T &des) |
Deserializes src bytes into des (type and transport auto-detected). | |
| template<typename SrcT, typename DesT> | |
| bool | convert (const SrcT &src, DesT &des) |
Converts between two types where at least one is Bytes. | |
| template<typename T> | |
| constexpr auto & | deref (const T &t) noexcept |
Dereferences a value, unwrapping shared_ptr if necessary. | |
| template<typename T> | |
| constexpr bool | is_bytes_type () noexcept |
Returns true if T is exactly Bytes. | |
| template<typename T> | |
| constexpr bool | is_dynamic_type () noexcept |
Returns true if T is a VLink dynamic data type. | |
| template<typename T> | |
| constexpr bool | is_cdr_type () noexcept |
Returns true if T is a FastDDS CDR-serialisable type. | |
| template<typename T> | |
| constexpr bool | is_proto_type () noexcept |
Returns true if T is a Protobuf message value type. | |
| template<typename T> | |
| constexpr bool | is_proto_ptr_type () noexcept |
Returns true if T is a raw pointer to a Protobuf message. | |
| template<typename T> | |
| constexpr bool | is_flat_table_type () noexcept |
Returns true if T is a FlatBuffers NativeTable type. | |
| template<typename T> | |
| constexpr bool | is_flat_builder_type () noexcept |
Returns true if T is a FlatBuffers builder type. | |
| template<typename T> | |
| constexpr bool | is_flat_ptr_type () noexcept |
Returns true if T is a raw pointer to a flatbuffers::Table. | |
| template<typename T> | |
| constexpr bool | is_custom_type () noexcept |
Returns true if T provides custom operator>> / operator<<. | |
| template<typename T> | |
| constexpr bool | is_string_type () noexcept |
Returns true if T is std::string. | |
| template<typename T> | |
| constexpr bool | is_chars_type () noexcept |
Returns true if T is constructible from std::string (but is not std::string). | |
| template<typename T> | |
| constexpr bool | is_stream_type () noexcept |
Returns true if T supports both operator<< and operator>> with std::stringstream. | |
| template<typename T> | |
| constexpr bool | is_standard_type () noexcept |
Returns true if T is a trivial standard-layout value type (POD). | |
| template<typename T> | |
| constexpr bool | is_standard_ptr_type () noexcept |
Returns true if T is a pointer to a trivial standard-layout type. | |
| enum vlink::Serializer::Type : uint8_t |
Identifies the serialisation codec to use for a given C++ type.
Resolved at compile time by get_type_of<T>(). The value is stored in the Publisher / Subscriber etc. as a constexpr member so that all codec dispatch is zero-cost at runtime.
| Enumerator | |
|---|---|
| kUnknownType | Unsupported type – |
| kBytesType |
|
| kDynamicType | Dynamic typed data via |
| kCustomType | User-defined via |
| kCdrType | FastDDS CDR via |
| kProtoType | Protobuf value ( |
| kProtoPtrType | Protobuf raw pointer (Arena-managed). |
| kFlatTableType | FlatBuffers NativeTable (object API). |
| kFlatPtrType | Pointer to |
| kFlatBuilderType | FlatBuffers builder ( |
| kStringType |
|
| kCharsType |
|
| kStreamType | Stream-serialisable via |
| kStandardType | Trivial standard-layout struct (POD value). |
| kStandardPtrType | Pointer to trivial standard-layout struct (POD pointer). |
|
inline |
Converts between two types where at least one is Bytes.
A compile-time static_assert enforces that SrcT or DesT (or both) is Bytes. The three cases are:
Bytes: shallow-copies src to des.DesT == Bytes: calls serialize(src, des).SrcT == Bytes: calls deserialize(src, des).| SrcT | Source type. |
| DesT | Destination type. |
| src | Source value. |
| des | Destination value. |
true on success.
|
inlinenodiscardconstexprnoexcept |
Dereferences a value, unwrapping shared_ptr if necessary.
If T is a shared_ptr, returns *t; otherwise returns t. Used internally so serialisation code handles both value and shared-ptr message types uniformly.
| T | The input type (value or shared_ptr). |
| t | Input value. |
|
inline |
Deserializes src bytes into des (type and transport auto-detected).
| T | C++ message type. |
| src | Source Bytes buffer. |
| des | Destination value. |
true on success.
|
inline |
Deserializes src bytes into des with explicit type and transport hints.
The transport activates transport-specific fast paths (e.g. kDds dereferences a CDR pointer stored in src instead of copying bytes).
| TypeT | Serializer type. |
| T | C++ message type. |
| src | Source Bytes buffer. |
| des | Destination value to fill. |
| transport | Active transport backend. |
true on success; false on parse failure.
|
inlinenodiscardnoexcept |
Returns the serialized byte size (type auto-detected).
| T | C++ message type. |
| src | Source value to measure. |
0 if unknown.
|
inlinenodiscardnoexcept |
Returns the exact serialised byte size for a given src value.
Used to pre-allocate loaned buffers before serializing. Returns 0 for types whose serialized size is not known ahead of time (e.g. kBytesType, kStringType, kFlatTableType). For kStandardType returns sizeof(T).
| TypeT | Serializer type. |
| T | C++ message type. |
| src | Source value to measure. |
src; 0 if unknown.
|
inlinenodiscardnoexcept |
Returns the serialisation type name string for T (type auto-detected).
| T | C++ message type. |
|
inlinenodiscardnoexcept |
Returns the serialisation type name string for T with explicit TypeT.
Returns a human-readable type identifier used by the framework for type-matching between publisher and subscriber (e.g. DDS topic type name, Protobuf fully-qualified name, FlatBuffers table name). Returns an empty string for types that have no meaningful type name (e.g. kBytesType).
| TypeT | Explicit serializer type. |
| T | C++ message type. |
|
inlinenodiscardconstexprnoexcept |
Deduces the Type enumerator for T at compile time.
Evaluates a compile-time if constexpr chain that tests each codec's trait (e.g. is_proto_type<T>()) and returns the first matching Type. Returns kUnknownType if no codec matches.
The detection order is: Bytes, Dynamic, CDR, Proto, ProtoPtr, FlatTable, FlatPtr, FlatBuilder, Custom, String, Chars, Standard, StandardPtr, Stream.
| T | The C++ message type to classify. |
Type enumerator identifying the codec for T.
|
inlinenodiscardconstexprnoexcept |
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a FastDDS CDR-serialisable type.
Requires fastcdr to be present and the type to have both serialize(Cdr&) and deserialize(Cdr&) methods, or its name to contain the VLINK_FASTDDS_IDL_PREFIX prefix.
| T | Type to test. |
true for CDR types when fastcdr is available.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is constructible from std::string (but is not std::string).
Matches char*, const char*, and string literal types.
| T | Type to test. |
true for C-string types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T provides custom operator>> / operator<<.
Checks via Traits::Operatorable whether T supports operator>>(Bytes&) and operator<<(const Bytes&).
| T | Type to test. |
true for custom-codec types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a VLink dynamic data type.
Dynamic types have an is_vlink_dynamic_data() member.
| T | Type to test. |
true for dynamic data types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a FlatBuffers builder type.
Requires flatbuffers and the type to have both a fbb_ member and a Finish() method.
| T | Type to test. |
true for FlatBuffers builder types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a raw pointer to a flatbuffers::Table.
| T | Type to test (expected to be MyTable*). |
true for FlatBuffers Table pointer types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a FlatBuffers NativeTable type.
Requires flatbuffers and the type (or its shared_ptr element) to be derived from flatbuffers::NativeTable.
| T | Type to test. |
true for FlatBuffers NativeTable types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a raw pointer to a Protobuf message.
| T | Type to test (expected to be MyProto*). |
true for Protobuf pointer types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a Protobuf message value type.
Requires protobuf to be present and the type to have both SerializeToArray() and ParseFromArray() methods.
| T | Type to test. |
true for Protobuf value types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a pointer to a trivial standard-layout type.
Matches T* where std::is_trivial_v<T> && std::is_standard_layout_v<T>. The pointer is reinterpreted (not dereferenced and copied) for zero-copy usage.
| T | Pointer type to test. |
true for POD pointer types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is a trivial standard-layout value type (POD).
Matches types where std::is_trivial_v and std::is_standard_layout_v are both true and the type is not a pointer. Such types are byte-copied directly into/from a Bytes buffer of exactly sizeof(T) bytes.
| T | Type to test. |
true for POD value types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T supports both operator<< and operator>> with std::stringstream.
Detected via Traits::Operatorable<std::stringstream, T>(), which requires both ss << t and ss >> t to be well-formed. Non-pointer types that support bidirectional streaming via std::stringstream (e.g. arithmetic types or types with custom stream operator overloads) match. Note that higher-priority codecs (e.g. Proto, CDR) are checked first in get_type_of(), so this function is only reached for types that do not match any earlier codec.
| T | Type to test. |
true for stream-serialisable types.
|
inlinenodiscardconstexprnoexcept |
Returns true if T is std::string.
| T | Type to test. |
true only for std::string.
|
inlinenodiscardconstexprnoexcept |
Returns true when type identifies a supported serializer.
kUnknownType is the only unsupported value. This function is called by the static_assert in every node constructor to catch unsupported message types at compile time.
| type | Serializer type enumerator. |
false only for kUnknownType.
|
inline |
Serializes src into des (type and transport auto-detected).
| T | C++ message type. |
| src | Source value. |
| des | Destination Bytes. |
true on success.
|
inline |
Serializes src into des with explicit type and transport hints.
The transport parameter activates transport-specific fast paths (e.g. CDR pointer passing for kDds). Pass TransportType::kUnknown for the default copy-based path. The offset parameter prepends offset zero bytes before the payload (used internally for some transports).
| TypeT | Serializer type. |
| T | C++ message type. |
| src | Source value to serialise. |
| des | Destination Bytes buffer (may be pre-allocated or loaned). |
| transport | Active transport backend for fast-path selection. |
| offset | Number of header bytes to prepend (default 0). |
true on success; false on serialisation failure.