WPILibC++  trunk
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
NetworkTable Class Reference
Inheritance diagram for NetworkTable:
Inheritance graph
[legend]
Collaboration diagram for NetworkTable:
Collaboration graph
[legend]

Public Member Functions

 NetworkTable (std::string path, NetworkTableProvider &provider)
 
bool IsConnected ()
 
bool IsServer ()
 
void AddConnectionListener (IRemoteConnectionListener *listener, bool immediateNotify)
 
void RemoveConnectionListener (IRemoteConnectionListener *listener)
 
void AddTableListener (ITableListener *listener)
 
void AddTableListener (ITableListener *listener, bool immediateNotify)
 
void AddTableListener (std::string key, ITableListener *listener, bool immediateNotify)
 
void AddSubTableListener (ITableListener *listener)
 
void RemoveTableListener (ITableListener *listener)
 
NetworkTableGetSubTable (std::string key)
 
bool ContainsKey (std::string key)
 
bool ContainsSubTable (std::string key)
 
void PutNumber (std::string key, double value)
 
double GetNumber (std::string key)
 
double GetNumber (std::string key, double defaultValue)
 
void PutString (std::string key, std::string value)
 
std::string GetString (std::string key)
 
std::string GetString (std::string key, std::string defaultValue)
 
void PutBoolean (std::string key, bool value)
 
bool GetBoolean (std::string key)
 
bool GetBoolean (std::string key, bool defaultValue)
 
void PutValue (std::string key, NetworkTableEntryType *type, EntryValue value)
 
void RetrieveValue (std::string key, ComplexData &externalValue)
 
void PutValue (std::string key, ComplexData &value)
 
EntryValue GetValue (std::string key)
 
EntryValue GetValue (std::string key, EntryValue defaultValue)
 

Static Public Member Functions

static void Initialize ()
 
static void Shutdown ()
 
static void SetTableProvider (NetworkTableProvider *provider)
 
static void SetClientMode ()
 
static void SetServerMode ()
 
static void SetTeam (int team)
 
static void SetIPAddress (const char *address)
 
static NetworkTableGetTable (std::string key)
 

Static Public Attributes

static const char PATH_SEPARATOR_CHAR = '/'
 
static const std::string PATH_SEPARATOR
 
static const int DEFAULT_PORT = 1735
 

Detailed Description

Definition at line 53 of file NetworkTable.h.

Member Function Documentation

void NetworkTable::AddConnectionListener ( IRemoteConnectionListener listener,
bool  immediateNotify 
)
virtual

Register an object to listen for connection and disconnection events

Parameters
listenerthe listener to be register
immediateNotifyif the listener object should be notified of the current connection state

Implements IRemote.

Definition at line 136 of file NetworkTable.cpp.

void NetworkTable::AddSubTableListener ( ITableListener listener)
virtual

This will immediately notify the listener of all current sub tables

Parameters
listener

Implements ITable.

Definition at line 174 of file NetworkTable.cpp.

void NetworkTable::AddTableListener ( ITableListener listener)
virtual

Add a listener for changes to the table

Parameters
listenerthe listener to add

Implements ITable.

Definition at line 158 of file NetworkTable.cpp.

void NetworkTable::AddTableListener ( ITableListener listener,
bool  immediateNotify 
)
virtual

Add a listener for changes to the table

Parameters
listenerthe listener to add
immediateNotifyif true then this listener will be notified of all current entries (marked as new)

Implements ITable.

Definition at line 162 of file NetworkTable.cpp.

void NetworkTable::AddTableListener ( std::string  key,
ITableListener listener,
bool  immediateNotify 
)
virtual

Add a listener for changes to a specific key the table

Parameters
keythe key to listen for
listenerthe listener to add
immediateNotifyif true then this listener will be notified of all current entries (marked as new)

Implements ITable.

Definition at line 169 of file NetworkTable.cpp.

bool NetworkTable::ContainsKey ( std::string  key)
virtual

Checks the table and tells if it contains the specified key

Parameters
keythe key to be checked

Implements ITable.

Definition at line 206 of file NetworkTable.cpp.

bool NetworkTable::ContainsSubTable ( std::string  key)
virtual

Determines whether there exists a non-empty subtable for this key in this table.

Parameters
keythe key to search for
Returns
true if there is a subtable with the key which contains at least one key/subtable of its own

Implements ITable.

Definition at line 210 of file NetworkTable.cpp.

bool NetworkTable::GetBoolean ( std::string  key)
virtual

Returns the key that the name maps to.

Parameters
keythe key name
Returns
the key
Exceptions
TableKeyNotDefinedExceptionif the specified key is null

Implements ITable.

Definition at line 274 of file NetworkTable.cpp.

bool NetworkTable::GetBoolean ( std::string  key,
bool  defaultValue 
)
virtual

Returns the key that the name maps to. If the key is null, it will return the default value

Parameters
keythe key name
defaultValuethe default value if the key is null
Returns
the key

Implements ITable.

Definition at line 279 of file NetworkTable.cpp.

double NetworkTable::GetNumber ( std::string  key)
virtual

Returns the key that the name maps to.

Parameters
keythe key name
Returns
the key
Exceptions
TableKeyNotDefinedExceptionif the specified key is null

Implements ITable.

Definition at line 232 of file NetworkTable.cpp.

double NetworkTable::GetNumber ( std::string  key,
double  defaultValue 
)
virtual

Returns the key that the name maps to. If the key is null, it will return the default value

Parameters
keythe key name
defaultValuethe default value if the key is null
Returns
the key

Implements ITable.

Definition at line 237 of file NetworkTable.cpp.

std::string NetworkTable::GetString ( std::string  key)
virtual

Returns the key that the name maps to.

Parameters
keythe key name
Returns
the key
Exceptions
TableKeyNotDefinedExceptionif the specified key is null

Implements ITable.

Definition at line 253 of file NetworkTable.cpp.

std::string NetworkTable::GetString ( std::string  key,
std::string  defaultValue 
)
virtual

Returns the key that the name maps to. If the key is null, it will return the default value

Parameters
keythe key name
defaultValuethe default value if the key is null
Returns
the key

Implements ITable.

Definition at line 258 of file NetworkTable.cpp.

NetworkTable * NetworkTable::GetSubTable ( std::string  key)
virtual

Returns the table at the specified key. If there is no table at the specified key, it will create a new table

Parameters
keythe key name
Returns
the networktable to be returned

Implements ITable.

Definition at line 198 of file NetworkTable.cpp.

NetworkTable * NetworkTable::GetTable ( std::string  key)
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

Parameters
keythe key name
Returns
the network table requested

Definition at line 107 of file NetworkTable.cpp.

EntryValue NetworkTable::GetValue ( std::string  key)
virtual

Returns the key that the name maps to. NOTE: If the value is a double, it will return a Double object, not a primitive. To get the primitive, use GetDouble

Parameters
keythe key name
Returns
the key
Exceptions
TableKeyNotDefinedExceptionif the specified key is null

Implements ITable.

Definition at line 307 of file NetworkTable.cpp.

EntryValue NetworkTable::GetValue ( std::string  key,
EntryValue  defaultValue 
)

Returns the key that the name maps to. If the key is null, it will return the default value NOTE: If the value is a double, it will return a Double object, not a primitive. To get the primitive, use GetDouble

Parameters
keythe key name
defaultValuethe default value if the key is null
Returns
the key

Definition at line 311 of file NetworkTable.cpp.

void NetworkTable::Initialize ( )
static
Exceptions
IOException

Definition at line 49 of file NetworkTable.cpp.

bool NetworkTable::IsConnected ( )
virtual

Get the current state of the objects connection

Returns
the current connection state

Implements IRemote.

Definition at line 127 of file NetworkTable.cpp.

bool NetworkTable::IsServer ( )
virtual

If the object is acting as a server

Returns
if the object is a server

Implements IRemote.

Definition at line 131 of file NetworkTable.cpp.

void NetworkTable::PutBoolean ( std::string  key,
bool  value 
)
virtual

Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keythe key
valuethe value

Implements ITable.

Definition at line 267 of file NetworkTable.cpp.

void NetworkTable::PutNumber ( std::string  key,
double  value 
)
virtual

Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keythe key
valuethe value

Implements ITable.

Definition at line 225 of file NetworkTable.cpp.

void NetworkTable::PutString ( std::string  key,
std::string  value 
)
virtual

Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keythe key
valuethe value

Implements ITable.

Definition at line 246 of file NetworkTable.cpp.

void NetworkTable::PutValue ( std::string  key,
ComplexData value 
)
virtual

Maps the specified key to the specified value in this table. The key can not be null. The value can be retrieved by calling the get method with a key that is equal to the original key.

Parameters
keythe key name
valuethe value to be put

Implements ITable.

Definition at line 300 of file NetworkTable.cpp.

void NetworkTable::RemoveConnectionListener ( IRemoteConnectionListener listener)
virtual

Unregister a listener from connection events

Parameters
listenerthe listener to be unregistered

Implements IRemote.

Definition at line 148 of file NetworkTable.cpp.

void NetworkTable::RemoveTableListener ( ITableListener listener)
virtual

Remove a listener from receiving table events

Parameters
listenerthe listener to be removed

Implements ITable.

Definition at line 180 of file NetworkTable.cpp.

void NetworkTable::SetClientMode ( )
static

set that network tables should be a client This must be called before initalize or GetTable

Definition at line 86 of file NetworkTable.cpp.

void NetworkTable::SetIPAddress ( const char *  address)
static
Parameters
addressthe adress that network tables will connect to in client mode

Definition at line 102 of file NetworkTable.cpp.

void NetworkTable::SetServerMode ( )
static

set that network tables should be a server This must be called before initalize or GetTable

Definition at line 91 of file NetworkTable.cpp.

void NetworkTable::SetTableProvider ( NetworkTableProvider provider)
static

set the table provider for static network tables methods This must be called before getTable

Definition at line 81 of file NetworkTable.cpp.

void NetworkTable::SetTeam ( int  team)
static

set the team the robot is configured for (this will set the ip address that network tables will connect to in client mode) This must be called before initalize or GetTable

Parameters
teamthe team number

Definition at line 96 of file NetworkTable.cpp.

Member Data Documentation

const int NetworkTable::DEFAULT_PORT = 1735
static

The default port that network tables operates on

Definition at line 94 of file NetworkTable.h.

const std::string NetworkTable::PATH_SEPARATOR
static

The path separator for sub-tables and keys

Definition at line 90 of file NetworkTable.h.


The documentation for this class was generated from the following files: