|
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 codec to use for a given C++ message type. More... | |
Functions | |
| constexpr bool | is_supported (Type type) noexcept |
Reports whether type identifies a usable codec. More... | |
| template<typename T > | |
| constexpr Type | get_type_of () noexcept |
Resolves the codec Type for T at compile time. More... | |
| template<Type TypeT, typename T > | |
| std::string | get_serialized_type () noexcept |
Returns the serialised type-name string for T with explicit codec tag. More... | |
| template<typename T > | |
| std::string | get_serialized_type () noexcept |
Returns the serialised type-name string for T with explicit codec tag. More... | |
| template<Type TypeT, typename T > | |
| size_t | get_serialized_size (const T &src) noexcept |
Returns a serialised-size hint for src with explicit codec tag. More... | |
| template<typename T > | |
| size_t | get_serialized_size (const T &src) noexcept |
Returns a serialised-size hint for src with explicit codec tag. More... | |
| template<Type TypeT, typename T > | |
| bool | serialize (const T &src, Bytes &des, [[maybe_unused]] TransportType transport, [[maybe_unused]] uint8_t offset) |
| template<typename T > | |
| bool | serialize (const T &src, Bytes &des) |
Serialises src into des (codec and transport auto-detected). More... | |
| template<Type TypeT, typename T > | |
| bool | deserialize (const Bytes &src, T &des, [[maybe_unused]] TransportType transport) |
| template<typename T > | |
| bool | deserialize (const Bytes &src, T &des) |
Deserialises src into des (codec and transport auto-detected). More... | |
| template<typename SrcT , typename DesT > | |
| bool | convert (const SrcT &src, DesT &des) |
Converts between two types where at least one side is Bytes. More... | |
| template<typename T > | |
| constexpr auto & | deref (const T &t) noexcept |
Dereferences a value, unwrapping std::shared_ptr when present. More... | |
| template<typename T > | |
| constexpr bool | is_bytes_type () noexcept |
Reports whether T is exactly Bytes. More... | |
| template<typename T > | |
| constexpr bool | is_dynamic_type () noexcept |
Reports whether T is a VLink dynamic data type. More... | |
| template<typename T > | |
| constexpr bool | is_cdr_type () noexcept |
Reports whether T is a FastDDS CDR-serialisable type. More... | |
| template<typename T > | |
| constexpr bool | is_proto_type () noexcept |
Reports whether T is a Protobuf-like message value type. More... | |
| template<typename T > | |
| constexpr bool | is_proto_ptr_type () noexcept |
Reports whether T is a raw pointer to a Protobuf-like message. More... | |
| template<typename T > | |
| constexpr bool | is_flat_table_type () noexcept |
Reports whether T is a FlatBuffers NativeTable type. More... | |
| template<typename T > | |
| constexpr bool | is_flat_builder_type () noexcept |
Reports whether T is a FlatBuffers builder type. More... | |
| template<typename T > | |
| constexpr bool | is_flat_ptr_type () noexcept |
Reports whether T is a raw pointer to a flatbuffers::Table. More... | |
| template<typename T > | |
| constexpr bool | is_custom_type () noexcept |
Reports whether T provides a custom operator>>/<< codec. More... | |
| template<typename T > | |
| constexpr bool | is_string_type () noexcept |
Reports whether T is std::string after unwrapping shared_ptr. More... | |
| template<typename T > | |
| constexpr bool | is_chars_type () noexcept |
Reports whether std::string is constructible from T (but T is not string). More... | |
| template<typename T > | |
| constexpr bool | is_stream_type () noexcept |
Reports whether T supports bidirectional std::stringstream streaming. More... | |
| template<typename T > | |
| constexpr bool | is_standard_type () noexcept |
Reports whether T is a trivial standard-layout value (POD). More... | |
| template<typename T > | |
| constexpr bool | is_standard_ptr_type () noexcept |
Reports whether T is a pointer to a trivial standard-layout type. More... | |
| enum vlink::Serializer::Type : uint8_t |
Identifies the codec to use for a given C++ message type.
Resolved at compile time by get_type_of<T>() and stored as a constexpr member on every primitive class, so all codec dispatch is zero-cost at runtime.
| Enumerator | |
|---|---|
| kUnknownType | Unsupported type; |
| kBytesType |
|
| kDynamicType | VLink dynamic typed data. |
| kCustomType | User-defined codec via |
| kCdrType | FastDDS CDR via |
| kProtoType | Protobuf-like value. |
| kProtoPtrType | Protobuf-like raw pointer; caller-owned. |
| kFlatTableType | FlatBuffers NativeTable (object API). |
| kFlatPtrType | Pointer to |
| kFlatBuilderType | FlatBuffers builder ( |
| kStringType |
|
| kCharsType | C string / |
| 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 side 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: dispatches to serialize().SrcT == Bytes: dispatches to deserialize().| SrcT | Source type. |
| DesT | Destination type. |
| src | Source value. |
| des | Destination value. |
true on success.
|
inlineconstexprnoexcept |
Dereferences a value, unwrapping std::shared_ptr when present.
If T is std::shared_ptr<U>, returns *t; otherwise returns t. Internal helper so codec code can treat both value and shared-pointer inputs uniformly.
| T | Input type (value or shared_ptr). |
| t | Input value. |
|
inline |
Deserialises src into des (codec and transport auto-detected).
| T | C++ message type. |
| src | Source Bytes buffer. |
| des | Destination value. |
true on success.
|
inline |
|
inlinenoexcept |
Returns a serialised-size hint for src with explicit codec tag.
Returns a serialised-size hint for src (codec auto-detected).
Used to size loaned buffers ahead of serialisation. The returned value is an exact byte count only for codecs that can produce one cheaply; it is 0 for codecs that cannot report an upfront size (e.g. kBytesType, kStringType, kFlatTableType, kStandardType).
| TypeT | Codec kind. |
| T | C++ message type. |
| src | Source value to measure. |
0 if unknown.
|
inlinenoexcept |
Returns a serialised-size hint for src with explicit codec tag.
Returns a serialised-size hint for src (codec auto-detected).
Used to size loaned buffers ahead of serialisation. The returned value is an exact byte count only for codecs that can produce one cheaply; it is 0 for codecs that cannot report an upfront size (e.g. kBytesType, kStringType, kFlatTableType, kStandardType).
| TypeT | Codec kind. |
| T | C++ message type. |
| src | Source value to measure. |
0 if unknown.
|
inlinenoexcept |
Returns the serialised type-name string for T with explicit codec tag.
Returns the serialised type-name string for T (codec auto-detected).
Used by the framework for cross-peer type matching (DDS topic type name, Protobuf fully-qualified name, FlatBuffers table name, etc.). Returns an empty string for codecs with no meaningful type name (e.g. kBytesType).
| TypeT | Explicit codec kind. |
| T | C++ message type. |
|
inlinenoexcept |
Returns the serialised type-name string for T with explicit codec tag.
Returns the serialised type-name string for T (codec auto-detected).
Used by the framework for cross-peer type matching (DDS topic type name, Protobuf fully-qualified name, FlatBuffers table name, etc.). Returns an empty string for codecs with no meaningful type name (e.g. kBytesType).
| TypeT | Explicit codec kind. |
| T | C++ message type. |
|
inlineconstexprnoexcept |
Resolves the codec Type for T at compile time.
Evaluates the if-constexpr chain documented above and returns the first matching enumerator. Returns kUnknownType if no codec matches.
| T | C++ message type to classify. |
Type enumerator.
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Reports whether T is a FastDDS CDR-serialisable type.
Requires fastcdr to be available, plus either both serialize(Cdr&) and deserialize(Cdr&) methods, or a type name carrying the VLINK_FASTDDS_IDL_PREFIX prefix.
| T | Type to test. |
true for CDR types when fastcdr is available.
|
inlineconstexprnoexcept |
Reports whether std::string is constructible from T (but T is not string).
Matches char*, const char*, and string literal types.
| T | Type to test. |
true for C-string-compatible types.
|
inlineconstexprnoexcept |
Reports whether T provides a custom operator>>/<< codec.
Checked via Traits::Operatorable for operator>>(Bytes&) and operator<<(const Bytes&).
| T | Type to test. |
true for custom-codec types.
|
inlineconstexprnoexcept |
Reports whether T is a VLink dynamic data type.
Dynamic types expose an is_vlink_dynamic_data() member.
| T | Type to test. |
true for dynamic data types.
|
inlineconstexprnoexcept |
Reports whether T is a FlatBuffers builder type.
Requires flatbuffers and the type to expose both an fbb_ member and a Finish() method.
| T | Type to test. |
true for FlatBuffers builder types.
|
inlineconstexprnoexcept |
Reports whether T is a raw pointer to a flatbuffers::Table.
| T | Pointer type to test. |
true for FlatBuffers Table pointer types.
|
inlineconstexprnoexcept |
Reports whether T is a FlatBuffers NativeTable type.
Requires flatbuffers and the type (or its shared_ptr element type) to derive from flatbuffers::NativeTable.
| T | Type to test. |
true for FlatBuffers NativeTable types.
|
inlineconstexprnoexcept |
Reports whether T is a raw pointer to a Protobuf-like message.
The pointee is not owned by the serialiser and must be non-null whenever the codec path dereferences it.
| T | Pointer type to test. |
true for Protobuf-compatible pointer types.
|
inlineconstexprnoexcept |
Reports whether T is a Protobuf-like message value type.
Requires Protobuf to be available and the type to expose SerializeToArray() and ParseFromArray() methods.
| T | Type to test. |
true for Protobuf-compatible value types.
|
inlineconstexprnoexcept |
Reports whether T is a pointer to a trivial standard-layout type.
Matches U* where std::is_trivial_v<U> && std::is_standard_layout_v<U>. The pointer is reinterpreted (not copied through) for zero-copy use.
| T | Pointer type to test. |
true for POD-pointer types.
|
inlineconstexprnoexcept |
Reports whether T is a trivial standard-layout value (POD).
Matches non-pointer types where both std::is_trivial_v and std::is_standard_layout_v hold. Such types are byte-copied into and out of a Bytes buffer of sizeof(T) bytes.
| T | Type to test. |
true for POD value types.
|
inlineconstexprnoexcept |
Reports whether T supports bidirectional std::stringstream streaming.
Detected via Traits::Operatorable<std::stringstream, T>(); the check requires both ss << t and ss >> t to be well-formed. Higher-priority codecs are checked first in get_type_of(), so this function is only reached for types that fail every earlier trait.
| T | Type to test. |
true for stream-serialisable types.
|
inlineconstexprnoexcept |
Reports whether T is std::string after unwrapping shared_ptr.
| T | Type to test. |
true for std::string and std::shared_ptr<std::string>.
|
inlineconstexprnoexcept |
Reports whether type identifies a usable codec.
kUnknownType is the only unsupported value. This function is invoked from the static_assert in every primitive constructor so unsupported message types fail at compile time with a clear diagnostic.
| type | Codec enumerator. |
false only for kUnknownType.
|
inline |
Serialises src into des (codec and transport auto-detected).
| T | C++ message type. |
| src | Source value. |
| des | Destination Bytes buffer. |
true on success.
|
inline |