26class BooleanArrayTopic;
28class DoubleArrayTopic;
32class IntegerArrayTopic;
34class NetworkTableInstance;
35template <wpi::ProtobufSerializable T>
38class StringArrayTopic;
40template <
typename T,
typename... I>
42class StructArrayTopic;
43template <
typename T,
typename... I>
65 struct private_init {};
95 bool withLeadingSlash =
true);
99 bool withLeadingSlash =
true);
240 template <wpi::ProtobufSerializable T>
252 template <
typename T,
typename... I>
265 template <
typename T,
typename... I>
322 std::vector<std::string>
GetKeys(
int types = 0)
const;
462 std::span<const int> defaultValue);
481 std::span<const int> defaultValue)
const;
500 std::span<const double> defaultValue);
534 std::span<const std::string> defaultValue);
568 std::span<const uint8_t> defaultValue);
583 std::span<const uint8_t> defaultValue)
const;
658 std::shared_ptr<NetworkTable> table)>;
This file defines the StringMap class.
NetworkTables BooleanArray topic.
Definition: BooleanArrayTopic.h:266
NetworkTables Boolean topic.
Definition: BooleanTopic.h:213
NetworkTables DoubleArray topic.
Definition: DoubleArrayTopic.h:266
NetworkTables Double topic.
Definition: DoubleTopic.h:213
NetworkTables event.
Definition: ntcore_cpp.h:217
NetworkTables FloatArray topic.
Definition: FloatArrayTopic.h:266
NetworkTables Float topic.
Definition: FloatTopic.h:213
NetworkTables IntegerArray topic.
Definition: IntegerArrayTopic.h:266
NetworkTables Integer topic.
Definition: IntegerTopic.h:213
NetworkTables Entry.
Definition: NetworkTableEntry.h:34
A network table that knows its subtable path.
Definition: NetworkTable.h:58
std::vector< Topic > GetTopics(int types=0) const
Gets all topics in the table (not including sub-tables).
bool PutNumber(std::string_view key, double value)
Put a number in the table.
std::vector< double > GetNumberArray(std::string_view key, std::span< const double > defaultValue) const
Returns the number array the key maps to.
Value GetValue(std::string_view key) const
Gets the value associated with a key as an object.
bool SetDefaultBooleanArray(std::string_view key, std::span< const int > defaultValue)
Gets the current value in the table, setting it if it does not exist.
bool SetDefaultValue(std::string_view key, const Value &defaultValue)
Gets the current value in the table, setting it if it does not exist.
FloatTopic GetFloatTopic(std::string_view name) const
Get float topic.
std::vector< uint8_t > GetRaw(std::string_view key, std::span< const uint8_t > defaultValue) const
Returns the raw value (byte array) the key maps to.
static std::vector< std::string > GetHierarchy(std::string_view key)
Gets a list of the names of all the super tables of a given key.
std::vector< int > GetBooleanArray(std::string_view key, std::span< const int > defaultValue) const
Returns the boolean array the key maps to.
bool PutNumberArray(std::string_view key, std::span< const double > value)
Put a number array in the table.
StringTopic GetStringTopic(std::string_view name) const
Get String topic.
std::string_view GetPath() const
Gets the full path of this table.
std::vector< std::string > GetStringArray(std::string_view key, std::span< const std::string > defaultValue) const
Returns the string array the key maps to.
bool SetDefaultBoolean(std::string_view key, bool defaultValue)
Gets the current value in the table, setting it if it does not exist.
static std::string NormalizeKey(std::string_view key, bool withLeadingSlash=true)
Normalizes an network table key to contain no consecutive slashes and optionally start with a leading...
std::vector< TopicInfo > GetTopicInfo(int types=0) const
Gets topic information for all keys in the table (not including sub-tables).
bool SetDefaultRaw(std::string_view key, std::span< const uint8_t > defaultValue)
Gets the current value in the table, setting it if it does not exist.
std::shared_ptr< NetworkTable > GetSubTable(std::string_view key) const
Returns the table at the specified key.
bool ContainsKey(std::string_view key) const
Determines whether the given key is in this table.
BooleanTopic GetBooleanTopic(std::string_view name) const
Get boolean topic.
std::function< void(NetworkTable *parent, std::string_view name, std::shared_ptr< NetworkTable > table)> SubTableListener
Called when a new table is created within a NetworkTable.
Definition: NetworkTable.h:658
bool PutBoolean(std::string_view key, bool value)
Put a boolean in the table.
bool ContainsSubTable(std::string_view key) const
Determines whether there exists a non-empty subtable for this key in this table.
std::function< void(NetworkTable *table, std::string_view key, const Event &event)> TableEventListener
Called when an event occurs on a topic in a NetworkTable.
Definition: NetworkTable.h:627
bool PutString(std::string_view key, std::string_view value)
Put a string in the table.
StructArrayTopic< T, I... > GetStructArrayTopic(std::string_view name, I... info) const
Gets a raw struct serialized array topic.
Definition: NetworkTable.h:267
bool IsPersistent(std::string_view key) const
Returns whether the value is persistent through program restarts.
bool SetDefaultNumber(std::string_view key, double defaultValue)
Gets the current value in the table, setting it if it does not exist.
bool SetDefaultStringArray(std::string_view key, std::span< const std::string > defaultValue)
Gets the current value in the table, setting it if it does not exist.
bool PutRaw(std::string_view key, std::span< const uint8_t > value)
Put a raw value (byte array) in the table.
double GetNumber(std::string_view key, double defaultValue) const
Gets the number associated with the given name.
RawTopic GetRawTopic(std::string_view name) const
Get raw topic.
void RemoveListener(NT_Listener listener)
Remove a listener.
StringArrayTopic GetStringArrayTopic(std::string_view name) const
Get String[] topic.
bool PutStringArray(std::string_view key, std::span< const std::string > value)
Put a string array in the table.
bool PutValue(std::string_view key, const Value &value)
Put a value in the table.
IntegerArrayTopic GetIntegerArrayTopic(std::string_view name) const
Get integer[] topic.
bool PutBooleanArray(std::string_view key, std::span< const int > value)
Put a boolean array in the table.
NetworkTableEntry GetEntry(std::string_view key) const
Gets the entry for a subkey.
BooleanArrayTopic GetBooleanArrayTopic(std::string_view name) const
Get boolean[] topic.
static constexpr char PATH_SEPARATOR_CHAR
The path separator for sub-tables and keys.
Definition: NetworkTable.h:128
NetworkTableInstance GetInstance() const
Gets the instance for the table.
Topic GetTopic(std::string_view name) const
Get (generic) topic.
IntegerTopic GetIntegerTopic(std::string_view name) const
Get integer topic.
bool GetBoolean(std::string_view key, bool defaultValue) const
Gets the boolean associated with the given name.
std::string GetString(std::string_view key, std::string_view defaultValue) const
Gets the string associated with the given name.
DoubleArrayTopic GetDoubleArrayTopic(std::string_view name) const
Get double[] topic.
static std::string_view BasenameKey(std::string_view key)
Gets the "base name" of a key.
std::vector< std::string > GetKeys(int types=0) const
Gets all keys in the table (not including sub-tables).
DoubleTopic GetDoubleTopic(std::string_view name) const
Get double topic.
std::vector< std::string > GetSubTables() const
Gets the names of all subtables in the table.
NT_Listener AddListener(std::string_view key, int eventMask, TableEventListener listener)
Listen to a single key.
NetworkTable(NT_Inst inst, std::string_view path, const private_init &)
Constructor.
void SetPersistent(std::string_view key)
Makes a key's value persistent through program restarts.
NT_Listener AddListener(int eventMask, TableEventListener listener)
Listen to topics only within this table.
NT_Listener AddSubTableListener(SubTableListener listener)
Listen for sub-table creation.
bool SetDefaultString(std::string_view key, std::string_view defaultValue)
Gets the current value in the table, setting it if it does not exist.
ProtobufTopic< T > GetProtobufTopic(std::string_view name) const
Gets a protobuf serialized value topic.
Definition: NetworkTable.h:241
StructTopic< T, I... > GetStructTopic(std::string_view name, I... info) const
Gets a raw struct serialized value topic.
Definition: NetworkTable.h:254
void ClearPersistent(std::string_view key)
Stop making a key's value persistent through program restarts.
bool SetDefaultNumberArray(std::string_view key, std::span< const double > defaultValue)
Gets the current value in the table, setting it if it does not exist.
FloatArrayTopic GetFloatArrayTopic(std::string_view name) const
Get float[] topic.
static std::string_view NormalizeKey(std::string_view key, wpi::SmallVectorImpl< char > &buf, bool withLeadingSlash=true)
NetworkTables Instance.
Definition: NetworkTableInstance.h:70
NetworkTables protobuf-encoded value topic.
Definition: ProtobufTopic.h:337
NetworkTables Raw topic.
Definition: RawTopic.h:266
NetworkTables StringArray topic.
Definition: StringArrayTopic.h:213
NetworkTables String topic.
Definition: StringTopic.h:268
NetworkTables struct-encoded value array topic.
Definition: StructArrayTopic.h:465
NetworkTables struct-encoded value topic.
Definition: StructTopic.h:371
NetworkTables Topic.
Definition: Topic.h:28
A network table entry value.
Definition: NetworkTableValue.h:32
Specifies that a type is capable of raw struct serialization and deserialization.
Definition: Struct.h:68
basic_string_view< char > string_view
Definition: core.h:501
NT_Handle NT_Listener
Definition: ntcore_c.h:37
NT_Handle NT_Inst
Definition: ntcore_c.h:36
NetworkTables (ntcore) namespace.
Definition: ntcore_cpp.h:36
constexpr const char * name(const T &)
::std::mutex mutex
Definition: mutex.h:17