WPILibC++ 2024.3.2
Schema Functions

Functions

bool nt::HasSchema (NT_Inst inst, std::string_view name)
 Returns whether there is a data schema already registered with the given name. More...
 
void nt::AddSchema (NT_Inst inst, std::string_view name, std::string_view type, std::span< const uint8_t > schema)
 Registers a data schema. More...
 
void nt::AddSchema (NT_Inst inst, std::string_view name, std::string_view type, std::string_view schema)
 Registers a data schema. More...
 

Detailed Description

Function Documentation

◆ AddSchema() [1/2]

void nt::AddSchema ( NT_Inst  inst,
std::string_view  name,
std::string_view  type,
std::span< const uint8_t >  schema 
)

Registers a data schema.

Data schemas provide information for how a certain data type string can be decoded. The type string of a data schema indicates the type of the schema itself (e.g. "protobuf" for protobuf schemas, "struct" for struct schemas, etc). In NetworkTables, schemas are published just like normal topics, with the name being generated from the provided name: "/.schema/<name>". Duplicate calls to this function with the same name are silently ignored.

Parameters
instinstance
nameName (the string passed as the data type for topics using this schema)
typeType of schema (e.g. "protobuf", "struct", etc)
schemaSchema data

◆ AddSchema() [2/2]

void nt::AddSchema ( NT_Inst  inst,
std::string_view  name,
std::string_view  type,
std::string_view  schema 
)
inline

Registers a data schema.

Data schemas provide information for how a certain data type string can be decoded. The type string of a data schema indicates the type of the schema itself (e.g. "protobuf" for protobuf schemas, "struct" for struct schemas, etc). In NetworkTables, schemas are published just like normal topics, with the name being generated from the provided name: "/.schema/<name>". Duplicate calls to this function with the same name are silently ignored.

Parameters
instinstance
nameName (the string passed as the data type for topics using this schema)
typeType of schema (e.g. "protobuf", "struct", etc)
schemaSchema data

◆ HasSchema()

bool nt::HasSchema ( NT_Inst  inst,
std::string_view  name 
)

Returns whether there is a data schema already registered with the given name.

This does NOT perform a check as to whether the schema has already been published by another node on the network.

Parameters
instinstance
nameName (the string passed as the data type for topics using this schema)
Returns
True if schema already registered