23class BooleanArrayTopic;
25class DoubleArrayTopic;
29class IntegerArrayTopic;
31class NetworkTableInstance;
33class StringArrayTopic;
54 struct private_init {};
84 bool withLeadingSlash =
true);
88 bool withLeadingSlash =
true);
273 std::vector<std::string>
GetKeys(
int types = 0)
const;
413 std::span<const int> defaultValue);
432 std::span<const int> defaultValue)
const;
451 std::span<const double> defaultValue);
485 std::span<const std::string> defaultValue);
519 std::span<const uint8_t> defaultValue);
534 std::span<const uint8_t> defaultValue)
const;
609 std::shared_ptr<NetworkTable> table)>;
This file defines the StringMap class.
NetworkTables BooleanArray topic.
Definition: BooleanArrayTopic.h:263
NetworkTables Boolean topic.
Definition: BooleanTopic.h:210
NetworkTables DoubleArray topic.
Definition: DoubleArrayTopic.h:263
NetworkTables Double topic.
Definition: DoubleTopic.h:210
NetworkTables event.
Definition: ntcore_cpp.h:216
NetworkTables FloatArray topic.
Definition: FloatArrayTopic.h:263
NetworkTables Float topic.
Definition: FloatTopic.h:210
NetworkTables IntegerArray topic.
Definition: IntegerArrayTopic.h:263
NetworkTables Integer topic.
Definition: IntegerTopic.h:210
NetworkTables Entry.
Definition: NetworkTableEntry.h:36
A network table that knows its subtable path.
Definition: NetworkTable.h:47
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:609
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:578
bool PutString(std::string_view key, std::string_view value)
Put a string in the table.
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:117
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.
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:59
NetworkTables Raw topic.
Definition: RawTopic.h:263
NetworkTables StringArray topic.
Definition: StringArrayTopic.h:210
NetworkTables String topic.
Definition: StringTopic.h:265
NetworkTables Topic.
Definition: Topic.h:30
A network table entry value.
Definition: NetworkTableValue.h:27
basic_string_view< char > string_view
Definition: core.h:520
NT_Handle NT_Listener
Definition: ntcore_c.h:35
NT_Handle NT_Inst
Definition: ntcore_c.h:34
NetworkTables (ntcore) namespace.
Definition: ntcore_cpp.h:35
::std::mutex mutex
Definition: mutex.h:17