Subscribes to Network Tables entry updates and calls a specified callback to use the new value.
More...
#include <nt_subscriber.h>
|
| NTSubscriber (const std::string &tableName) |
| Construct a new NTSubscriber object.
|
|
| ~NTSubscriber () |
|
void | AddMonitor (const std::string &keyName, std::function< void(double)> onUpdateCallback, const double defaultValue=0.0, const bool forceUpdate=true) |
| Register a new listener for the specified key and send values to callback on update.
|
|
|
const std::string | m_tableName |
| Table containing keys to monitor.
|
|
std::vector< NT_Entry > | m_ntEntries |
| Publish/subscribe entries.
|
|
std::vector< NT_Listener > | m_ntListeners |
| Entry listeners.
|
|
Subscribes to Network Tables entry updates and calls a specified callback to use the new value.
◆ NTSubscriber()
NTSubscriber::NTSubscriber |
( |
const std::string & |
tableName | ) |
|
|
explicit |
Construct a new NTSubscriber object.
- Parameters
-
tableName | Name of the table containing keys to watch |
◆ ~NTSubscriber()
NTSubscriber::~NTSubscriber |
( |
| ) |
|
◆ AddMonitor()
void NTSubscriber::AddMonitor |
( |
const std::string & |
keyName, |
|
|
std::function< void(double)> |
onUpdateCallback, |
|
|
const double |
defaultValue = 0.0 , |
|
|
const bool |
forceUpdate = true |
|
) |
| |
Register a new listener for the specified key and send values to callback on update.
- Parameters
-
keyName | Key to listen for updates. Will be at tableName/keyName (keyName can have more slashes) |
onUpdateCallback | Callback to run when keyName changes |
defaultValue | Default value to initialize key if it doesn't exist yet |
forceUpdate | When true, update network tables value to default even if another value is already set |
◆ m_ntEntries
std::vector<NT_Entry> argos_lib::NTSubscriber::m_ntEntries |
|
private |
Publish/subscribe entries.
◆ m_ntListeners
std::vector<NT_Listener> argos_lib::NTSubscriber::m_ntListeners |
|
private |
◆ m_tableName
const std::string argos_lib::NTSubscriber::m_tableName |
|
private |
Table containing keys to monitor.
The documentation for this class was generated from the following files: