WPILibC++
unspecified
|
A network table that knows its subtable path. More...
#include <NetworkTable.h>
Public Member Functions | |
NetworkTable (llvm::StringRef path, const private_init &) | |
void | AddTableListener (ITableListener *listener) override |
Add a listener for changes to the table. More... | |
void | AddTableListener (ITableListener *listener, bool immediateNotify) override |
Add a listener for changes to the table. More... | |
void | AddTableListenerEx (ITableListener *listener, unsigned int flags) override |
Add a listener for changes to the table. More... | |
void | AddTableListener (llvm::StringRef key, ITableListener *listener, bool immediateNotify) override |
Add a listener for changes to a specific key the table. More... | |
void | AddTableListenerEx (llvm::StringRef key, ITableListener *listener, unsigned int flags) override |
Add a listener for changes to a specific key the table. More... | |
void | AddSubTableListener (ITableListener *listener) override |
This will immediately notify the listener of all current sub tables. More... | |
void | AddSubTableListener (ITableListener *listener, bool localNotify) override |
This will immediately notify the listener of all current sub tables. More... | |
void | RemoveTableListener (ITableListener *listener) override |
Remove a listener from receiving table events. More... | |
std::shared_ptr< ITable > | GetSubTable (llvm::StringRef key) const override |
Returns the table at the specified key. More... | |
bool | ContainsKey (llvm::StringRef key) const override |
Determines whether the given key is in this table. More... | |
bool | ContainsSubTable (llvm::StringRef key) const override |
Determines whether there exists a non-empty subtable for this key in this table. More... | |
std::vector< std::string > | GetKeys (int types=0) const override |
std::vector< std::string > | GetSubTables () const override |
void | SetPersistent (llvm::StringRef key) override |
Makes a key's value persistent through program restarts. More... | |
void | ClearPersistent (llvm::StringRef key) override |
Stop making a key's value persistent through program restarts. More... | |
bool | IsPersistent (llvm::StringRef key) const override |
Returns whether the value is persistent through program restarts. More... | |
void | SetFlags (llvm::StringRef key, unsigned int flags) override |
Sets flags on the specified key in this table. More... | |
void | ClearFlags (llvm::StringRef key, unsigned int flags) override |
Clears flags on the specified key in this table. More... | |
unsigned int | GetFlags (llvm::StringRef key) const override |
Returns the flags for the specified key. More... | |
void | Delete (llvm::StringRef key) override |
Deletes the specified key in this table. More... | |
bool | PutNumber (llvm::StringRef key, double value) override |
Put a number in the table. More... | |
virtual bool | SetDefaultNumber (llvm::StringRef key, double defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual bool | PutString (llvm::StringRef key, llvm::StringRef value) override |
Put a string in the table. More... | |
virtual bool | SetDefaultString (llvm::StringRef key, llvm::StringRef defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual bool | PutBoolean (llvm::StringRef key, bool value) override |
Put a boolean in the table. More... | |
virtual bool | SetDefaultBoolean (llvm::StringRef key, bool defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual bool | PutBooleanArray (llvm::StringRef key, llvm::ArrayRef< int > value) override |
Put a boolean array in the table. More... | |
virtual bool | SetDefaultBooleanArray (llvm::StringRef key, llvm::ArrayRef< int > defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual std::vector< int > | GetBooleanArray (llvm::StringRef key, llvm::ArrayRef< int > defaultValue) const override |
Returns the boolean array the key maps to. More... | |
virtual bool | PutNumberArray (llvm::StringRef key, llvm::ArrayRef< double > value) override |
Put a number array in the table. More... | |
virtual bool | SetDefaultNumberArray (llvm::StringRef key, llvm::ArrayRef< double > defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual std::vector< double > | GetNumberArray (llvm::StringRef key, llvm::ArrayRef< double > defaultValue) const override |
Returns the number array the key maps to. More... | |
virtual bool | PutStringArray (llvm::StringRef key, llvm::ArrayRef< std::string > value) override |
Put a string array in the table. More... | |
virtual bool | SetDefaultStringArray (llvm::StringRef key, llvm::ArrayRef< std::string > defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual std::vector< std::string > | GetStringArray (llvm::StringRef key, llvm::ArrayRef< std::string > defaultValue) const override |
Returns the string array the key maps to. More... | |
virtual bool | PutRaw (llvm::StringRef key, llvm::StringRef value) override |
Put a raw value (byte array) in the table. More... | |
virtual bool | SetDefaultRaw (llvm::StringRef key, llvm::StringRef defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
virtual std::string | GetRaw (llvm::StringRef key, llvm::StringRef defaultValue) const override |
Returns the raw value (byte array) the key maps to. More... | |
bool | PutValue (llvm::StringRef key, std::shared_ptr< nt::Value > value) override |
Put a value in the table. More... | |
virtual bool | SetDefaultValue (llvm::StringRef key, std::shared_ptr< nt::Value > defaultValue) override |
Gets the current value in the table, setting it if it does not exist. More... | |
std::shared_ptr< nt::Value > | GetValue (llvm::StringRef key) const override |
Gets the value associated with a key as an object. More... | |
llvm::StringRef | GetPath () const override |
Gets the full path of this table. | |
Static Public Member Functions | |
static void | Initialize () |
static void | Shutdown () |
static void | SetClientMode () |
set that network tables should be a client This must be called before initialize or GetTable | |
static void | SetServerMode () |
set that network tables should be a server This must be called before initialize or GetTable | |
static void | SetTeam (int team) |
set the team the robot is configured for (this will set the mdns address that network tables will connect to in client mode) This must be called before initialize or GetTable More... | |
static void | SetIPAddress (llvm::StringRef address) |
static void | SetIPAddress (llvm::ArrayRef< std::string > addresses) |
static void | SetPort (unsigned int port) |
static void | SetDSClientEnabled (bool enabled) |
static void | SetPersistentFilename (llvm::StringRef filename) |
Sets the persistent filename. More... | |
static void | SetNetworkIdentity (llvm::StringRef name) |
Sets the network identity. More... | |
static void | GlobalDeleteAll () |
Deletes ALL keys in ALL subtables. More... | |
static void | Flush () |
Flushes all updated values immediately to the network. More... | |
static void | SetUpdateRate (double interval) |
Set the periodic update rate. More... | |
static const char * | SavePersistent (llvm::StringRef filename) |
Saves persistent keys to a file. More... | |
static const char * | LoadPersistent (llvm::StringRef filename, std::function< void(size_t line, const char *msg)> warn) |
Loads persistent keys from a file. More... | |
static std::shared_ptr < NetworkTable > | GetTable (llvm::StringRef key) |
Gets the table with the specified key. More... | |
Static Public Attributes | |
static const char | PATH_SEPARATOR_CHAR = '/' |
The path separator for sub-tables and keys. More... | |
A network table that knows its subtable path.
|
overridevirtual |
This will immediately notify the listener of all current sub tables.
listener | the listener to add |
Implements ITable.
|
overridevirtual |
This will immediately notify the listener of all current sub tables.
listener | the listener to add |
localNotify | if true then this listener will be notified of all local changes in addition to all remote changes |
Implements ITable.
|
overridevirtual |
|
overridevirtual |
Add a listener for changes to the table.
listener | the listener to add |
immediateNotify | if true then this listener will be notified of all current entries (marked as new) |
Implements ITable.
|
overridevirtual |
Add a listener for changes to a specific key the table.
key | the key to listen for |
listener | the listener to add |
immediateNotify | if true then this listener will be notified of all current entries (marked as new) |
Implements ITable.
|
overridevirtual |
Add a listener for changes to the table.
listener | the listener to add |
immediateNotify | if true then this listener will be notified of all current entries (marked as new) |
flags | bitmask of NT_NotifyKind specifying desired notifications |
Implements ITable.
|
overridevirtual |
Add a listener for changes to a specific key the table.
key | the key to listen for |
listener | the listener to add |
immediateNotify | if true then this listener will be notified of all current entries (marked as new) |
flags | bitmask of NT_NotifyKind specifying desired notifications |
Implements ITable.
|
overridevirtual |
Clears flags on the specified key in this table.
The key can not be null.
key | the key name |
flags | the flags to clear (bitmask) |
Implements ITable.
|
overridevirtual |
Stop making a key's value persistent through program restarts.
The key cannot be null.
key | the key name |
Implements ITable.
|
overridevirtual |
Determines whether the given key is in this table.
key | the key to search for |
Implements ITable.
|
overridevirtual |
Determines whether there exists a non-empty subtable for this key in this table.
key | the key to search for |
Implements ITable.
|
overridevirtual |
|
static |
Flushes all updated values immediately to the network.
Note: This is rate-limited to protect the network from flooding. This is primarily useful for synchronizing network updates with user code.
|
overridevirtual |
Returns the boolean array the key maps to.
If the key does not exist or is of different type, it will return the default value.
key | the key to look up |
defaultValue | the value to be returned if no value is found |
Implements ITable.
|
overridevirtual |
Returns the flags for the specified key.
key | the key name |
Implements ITable.
|
overridevirtual |
types | bitmask of types; 0 is treated as a "don't care". |
Implements ITable.
|
overridevirtual |
Returns the number array the key maps to.
If the key does not exist or is of different type, it will return the default value.
key | the key to look up |
defaultValue | the value to be returned if no value is found |
Implements ITable.
|
overridevirtual |
Returns the raw value (byte array) the key maps to.
If the key does not exist or is of different type, it will return the default value.
key | the key to look up |
defaultValue | the value to be returned if no value is found |
Implements ITable.
|
overridevirtual |
Returns the string array the key maps to.
If the key does not exist or is of different type, it will return the default value.
key | the key to look up |
defaultValue | the value to be returned if no value is found |
Implements ITable.
|
overridevirtual |
Returns the table at the specified key.
If there is no table at the specified key, it will create a new table
key | the key name |
Implements ITable.
|
overridevirtual |
Implements ITable.
|
static |
Gets the table with the specified key.
If the table does not exist, a new table will be created.
This will automatically initialize network tables if it has not been already.
key | the key name |
|
overridevirtual |
Gets the value associated with a key as an object.
key | the key of the value to look up |
Implements ITable.
|
static |
Deletes ALL keys in ALL subtables.
Use with caution!
|
static |
IOException |
|
overridevirtual |
Returns whether the value is persistent through program restarts.
The key cannot be null.
key | the key name |
Implements ITable.
|
static |
Loads persistent keys from a file.
The server does this automatically.
filename | file name |
warn | callback function called for warnings |
|
overridevirtual |
Put a boolean in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a boolean array in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a number in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a number array in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a raw value (byte array) in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a string in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a string array in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Put a value in the table.
key | the key to be assigned to |
value | the value that will be assigned |
Implements ITable.
|
overridevirtual |
Remove a listener from receiving table events.
listener | the listener to be removed |
Implements ITable.
|
static |
Saves persistent keys to a file.
The server does this automatically.
filename | file name |
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
overridevirtual |
Gets the current value in the table, setting it if it does not exist.
key | the key |
defaultValue | the default value to set if key doesn't exist. |
Implements ITable.
|
static |
enabled | whether to enable the connection to the local DS to get the robot IP address (defaults to enabled) |
|
overridevirtual |
Sets flags on the specified key in this table.
The key can not be null.
key | the key name |
flags | the flags to set (bitmask) |
Implements ITable.
|
static |
address | the adress that network tables will connect to in client mode |
|
static |
addresses | the addresses that network tables will connect to in client mode (in round robin order) |
|
static |
Sets the network identity.
This is provided in the connection info on the remote end.
name | identity |
|
overridevirtual |
Makes a key's value persistent through program restarts.
key | the key to make persistent |
Implements ITable.
|
static |
Sets the persistent filename.
filename | the filename that the network tables server uses for automatic loading and saving of persistent values |
|
static |
port | the port number that network tables will connect to in client mode or listen to in server mode |
|
static |
set the team the robot is configured for (this will set the mdns address that network tables will connect to in client mode) This must be called before initialize or GetTable
team | the team number |
|
static |
Set the periodic update rate.
interval | update interval in seconds (range 0.01 to 1.0) |
|
static |
The path separator for sub-tables and keys.