34template <wpi::util::ProtobufSerializable T>
39template <
typename T,
typename... I>
40 requires wpi::util::StructSerializable<T, I...>
42template <
typename T,
typename... I>
43 requires wpi::util::StructSerializable<T, I...>
64 struct private_init {};
94 bool withLeadingSlash =
true);
98 bool withLeadingSlash =
true);
239 template <wpi::util::ProtobufSerializable T>
251 template <
typename T,
typename... I>
264 template <
typename T,
typename... I>
278 std::shared_ptr<NetworkTable>
GetSubTable(std::string_view key)
const;
321 std::vector<std::string>
GetKeys(
int types = 0)
const;
379 double GetNumber(std::string_view key,
double defaultValue)
const;
388 bool PutString(std::string_view key, std::string_view value);
409 std::string_view defaultValue)
const;
438 bool GetBoolean(std::string_view key,
bool defaultValue)
const;
461 std::span<const int> defaultValue);
480 std::span<const int> defaultValue)
const;
499 std::span<const double> defaultValue);
514 std::string_view key, std::span<const double> defaultValue)
const;
533 std::span<const std::string> defaultValue);
548 std::string_view key, std::span<const std::string> defaultValue)
const;
557 bool PutRaw(std::string_view key, std::span<const uint8_t> value);
567 std::span<const uint8_t> defaultValue);
581 std::vector<uint8_t>
GetRaw(std::string_view key,
582 std::span<const uint8_t> defaultValue)
const;
657 std::shared_ptr<NetworkTable> table)>;
@ name
Definition base.h:690
NetworkTables BooleanArray topic.
Definition BooleanArrayTopic.hpp:296
NetworkTables Boolean topic.
Definition BooleanTopic.hpp:235
NetworkTables DoubleArray topic.
Definition DoubleArrayTopic.hpp:296
NetworkTables Double topic.
Definition DoubleTopic.hpp:235
NetworkTables event.
Definition ntcore_cpp.hpp:215
NetworkTables FloatArray topic.
Definition FloatArrayTopic.hpp:296
NetworkTables Float topic.
Definition FloatTopic.hpp:235
NetworkTables IntegerArray topic.
Definition IntegerArrayTopic.hpp:296
NetworkTables Integer topic.
Definition IntegerTopic.hpp:235
NetworkTables Entry.
Definition NetworkTableEntry.hpp:31
IntegerArrayTopic GetIntegerArrayTopic(std::string_view name) const
Get integer[] topic.
std::vector< int > GetBooleanArray(std::string_view key, std::span< const int > defaultValue) const
Returns the boolean array the key maps to.
NT_Listener AddListener(std::string_view key, int eventMask, TableEventListener listener)
Listen to a single key.
StructTopic< T, I... > GetStructTopic(std::string_view name, I... info) const
Gets a raw struct serialized value topic.
Definition NetworkTable.hpp:253
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.hpp:625
bool SetDefaultString(std::string_view key, std::string_view defaultValue)
Set Default Entry Value.
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.hpp:655
IntegerTopic GetIntegerTopic(std::string_view name) const
Get integer topic.
bool SetDefaultBoolean(std::string_view key, bool defaultValue)
Set Default Entry Value.
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...
void ClearPersistent(std::string_view key)
Stop making a key's value persistent through program restarts.
RawTopic GetRawTopic(std::string_view name) const
Get raw topic.
bool PutNumberArray(std::string_view key, std::span< const double > value)
Put a number array 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.
static std::string_view NormalizeKey(std::string_view key, wpi::util::SmallVectorImpl< char > &buf, bool withLeadingSlash=true)
bool PutBooleanArray(std::string_view key, std::span< const int > value)
Put a boolean array in the 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.
Topic GetTopic(std::string_view name) const
Get (generic) topic.
std::vector< TopicInfo > GetTopicInfo(int types=0) const
Gets topic information for all keys in the table (not including sub-tables).
std::vector< std::string > GetSubTables() const
Gets the names of all subtables in the table.
ProtobufTopic< T > GetProtobufTopic(std::string_view name) const
Gets a protobuf serialized value topic.
Definition NetworkTable.hpp:240
std::string_view GetPath() const
Gets the full path of this table.
bool SetDefaultRaw(std::string_view key, std::span< const uint8_t > defaultValue)
Set Default Entry Value.
static constexpr char PATH_SEPARATOR_CHAR
The path separator for sub-tables and keys.
Definition NetworkTable.hpp:127
static std::string_view BasenameKey(std::string_view key)
Gets the "base name" of a key.
DoubleTopic GetDoubleTopic(std::string_view name) const
Get double topic.
std::string GetString(std::string_view key, std::string_view defaultValue) const
Gets the string associated with the given name.
StructArrayTopic< T, I... > GetStructArrayTopic(std::string_view name, I... info) const
Gets a raw struct serialized array topic.
Definition NetworkTable.hpp:266
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.
bool SetDefaultNumberArray(std::string_view key, std::span< const double > defaultValue)
Set Default Entry Value.
FloatTopic GetFloatTopic(std::string_view name) const
Get float topic.
void RemoveListener(NT_Listener listener)
Remove a listener.
NetworkTableEntry GetEntry(std::string_view key) const
Gets the entry for a subkey.
friend class NetworkTableInstance
Definition NetworkTable.hpp:65
NT_Listener AddSubTableListener(SubTableListener listener)
Listen for sub-table creation.
bool PutStringArray(std::string_view key, std::span< const std::string > value)
Put a string array in the table.
Value GetValue(std::string_view key) const
Gets the value associated with a key as an object.
DoubleArrayTopic GetDoubleArrayTopic(std::string_view name) const
Get double[] topic.
NT_Listener AddListener(int eventMask, TableEventListener listener)
Listen to topics only within this table.
bool SetDefaultBooleanArray(std::string_view key, std::span< const int > defaultValue)
Set Default Entry Value.
std::vector< Topic > GetTopics(int types=0) const
Gets all topics in the table (not including sub-tables).
bool PutString(std::string_view key, std::string_view value)
Put a string in the table.
bool PutBoolean(std::string_view key, bool value)
Put a boolean in the table.
bool PutRaw(std::string_view key, std::span< const uint8_t > value)
Put a raw value (byte array) in the table.
NetworkTable(NT_Inst inst, std::string_view path, const private_init &)
Constructor.
FloatArrayTopic GetFloatArrayTopic(std::string_view name) const
Get float[] topic.
std::shared_ptr< NetworkTable > GetSubTable(std::string_view key) const
Returns the table at the specified key.
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.
bool SetDefaultValue(std::string_view key, const Value &defaultValue)
Set Default Entry Value.
NetworkTableInstance GetInstance() const
Gets the instance for the table.
bool SetDefaultNumber(std::string_view key, double defaultValue)
Set Default Entry Value.
BooleanTopic GetBooleanTopic(std::string_view name) const
Get boolean topic.
bool ContainsKey(std::string_view key) const
Determines whether the given key is in this table.
bool ContainsSubTable(std::string_view key) const
Determines whether there exists a non-empty subtable for this key in this table.
bool PutValue(std::string_view key, const Value &value)
Put a value in the table.
BooleanArrayTopic GetBooleanArrayTopic(std::string_view name) const
Get boolean[] topic.
std::vector< std::string > GetKeys(int types=0) const
Gets all keys in the table (not including sub-tables).
bool GetBoolean(std::string_view key, bool defaultValue) const
Gets the boolean associated with the given name.
void SetPersistent(std::string_view key)
Makes a key's value persistent through program restarts.
double GetNumber(std::string_view key, double defaultValue) const
Gets the number associated with the given name.
StringArrayTopic GetStringArrayTopic(std::string_view name) const
Get String[] topic.
bool PutNumber(std::string_view key, double value)
Put a number in the table.
StringTopic GetStringTopic(std::string_view name) const
Get String topic.
bool SetDefaultStringArray(std::string_view key, std::span< const std::string > defaultValue)
Set Default Entry Value.
bool IsPersistent(std::string_view key) const
Returns whether the value is persistent through program restarts.
NetworkTables Instance.
Definition NetworkTableInstance.hpp:67
NetworkTables protobuf-encoded value topic.
Definition ProtobufTopic.hpp:336
NetworkTables Raw topic.
Definition RawTopic.hpp:296
NetworkTables StringArray topic.
Definition StringArrayTopic.hpp:235
NetworkTables String topic.
Definition StringTopic.hpp:298
NetworkTables struct-encoded value array topic.
Definition StructArrayTopic.hpp:466
NetworkTables struct-encoded value topic.
Definition StructTopic.hpp:372
NetworkTables Topic.
Definition Topic.hpp:27
A network table entry value.
Definition NetworkTableValue.hpp:35
Definition BooleanTopic.hpp:24
StringMap is a sorted associative container that contains key-value pairs with unique string keys.
Definition StringMap.hpp:26
Specifies that a type is capable of raw struct serialization and deserialization.
Definition Struct.hpp:69
NT_Handle NT_Listener
Definition ntcore_c.h:39
NT_Handle NT_Inst
Definition ntcore_c.h:38
NetworkTables (ntcore) namespace.
Definition NTSendable.hpp:9
::std::mutex mutex
Definition mutex.hpp:17