xronos-sdk 0.14.0
Xronos C++ SDK
Loading...
Searching...
No Matches
xronos::sdk::ValueType< T > Struct Template Reference

The name identifying T across separately built nodes. More...

Detailed Description

template<class T>
struct xronos::sdk::ValueType< T >

The name identifying T across separately built nodes.

A C++ type does not survive compilation in a form two independently built nodes can compare. An exported port carries this name as a type identifier instead. Two exported ports are assumed to carry the same value type if and only if their names are equal.

The SDK names the built-in value types itself:

Type Name Type Name
void void std::uint8_t u8
bool bool std::uint16_t u16
char char std::uint32_t u32
std::int8_t i8 std::uint64_t u64
std::int16_t i16 float f32
std::int32_t i32 double f64
std::int64_t i64 std::string string

The integer types use fixed-width spellings so that a name does not vary with the platform's int and long.

Specialize it for your own types in the header that declares them, so every node including that header agrees on the name by construction:

namespace acme { struct Pose { double x; double y; }; }
template <> struct xronos::sdk::ValueType<acme::Pose> {
static constexpr std::string_view name = "acme.Pose";
};
The name identifying T across separately built nodes.
Definition value_type.hh:56

Pick a name unlikely to collide with an unrelated project's type — a dotted path through your organization and package, as above, works well. It must be a non-empty compile-time constant.

Template Parameters
TThe value type being named.

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