WPILibC++ 2024.3.2
Schema Functions

Functions

NT_Bool NT_HasSchema (NT_Inst inst, const char *name)
 Returns whether there is a data schema already registered with the given name. More...
 
void NT_AddSchema (NT_Inst inst, const char *name, const char *type, const uint8_t *schema, size_t schemaSize)
 Registers a data schema. More...
 

Detailed Description

Function Documentation

◆ NT_AddSchema()

void NT_AddSchema ( NT_Inst  inst,
const char *  name,
const char *  type,
const uint8_t *  schema,
size_t  schemaSize 
)

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
schemaSizeSize of schema data

◆ NT_HasSchema()

NT_Bool NT_HasSchema ( NT_Inst  inst,
const char *  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