WPILibC++ 2023.4.3
|
NetworkTables generic subscriber. More...
#include <networktables/GenericEntry.h>
Public Types | |
using | TopicType = Topic |
using | ValueType = Value |
using | ParamType = const Value & |
using | TimestampedValueType = Value |
Public Member Functions | |
GenericSubscriber ()=default | |
GenericSubscriber (NT_Subscriber handle) | |
Construct from a subscriber handle; recommended to use Topic::GenericSubscribe() instead. More... | |
ValueType | Get () const |
Get the last published value. More... | |
bool | GetBoolean (bool defaultValue) const |
Gets the entry's value as a boolean. More... | |
int64_t | GetInteger (int64_t defaultValue) const |
Gets the entry's value as a integer. More... | |
float | GetFloat (float defaultValue) const |
Gets the entry's value as a float. More... | |
double | GetDouble (double defaultValue) const |
Gets the entry's value as a double. More... | |
std::string | GetString (std::string_view defaultValue) const |
Gets the entry's value as a string. More... | |
std::vector< uint8_t > | GetRaw (std::span< const uint8_t > defaultValue) const |
Gets the entry's value as a raw. More... | |
std::vector< int > | GetBooleanArray (std::span< const int > defaultValue) const |
Gets the entry's value as a boolean array. More... | |
std::vector< int64_t > | GetIntegerArray (std::span< const int64_t > defaultValue) const |
Gets the entry's value as a integer array. More... | |
std::vector< float > | GetFloatArray (std::span< const float > defaultValue) const |
Gets the entry's value as a float array. More... | |
std::vector< double > | GetDoubleArray (std::span< const double > defaultValue) const |
Gets the entry's value as a double array. More... | |
std::vector< std::string > | GetStringArray (std::span< const std::string > defaultValue) const |
Gets the entry's value as a string array. More... | |
std::vector< TimestampedValueType > | ReadQueue () |
Get an array of all value changes since the last call to ReadQueue. More... | |
TopicType | GetTopic () const |
Get the corresponding topic. More... | |
Public Member Functions inherited from nt::Subscriber | |
virtual | ~Subscriber () |
Subscriber (const Subscriber &)=delete | |
Subscriber & | operator= (const Subscriber &)=delete |
Subscriber (Subscriber &&) | |
Subscriber & | operator= (Subscriber &&) |
operator bool () const | |
Determines if the native handle is valid. More... | |
NT_Subscriber | GetHandle () const |
Gets the native handle for the subscriber. More... | |
bool | Exists () const |
Determines if the topic is currently being published. More... | |
int64_t | GetLastChange () const |
Gets the last time the value was changed. More... | |
Topic | GetTopic () const |
Gets the subscribed-to topic. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from nt::Subscriber | |
Subscriber ()=default | |
Subscriber (NT_Subscriber handle) | |
Protected Attributes inherited from nt::Subscriber | |
NT_Subscriber | m_subHandle {0} |
NetworkTables generic subscriber.
using nt::GenericSubscriber::ParamType = const Value& |
|
default |
|
inlineexplicit |
Construct from a subscriber handle; recommended to use Topic::GenericSubscribe() instead.
handle | Native handle |
|
inline |
Get the last published value.
If no value has been published, returns a value with unassigned type.
|
inline |
Gets the entry's value as a boolean.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a boolean array.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a double.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a double array.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a float.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a float array.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a integer.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a integer array.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a raw.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a string.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Gets the entry's value as a string array.
If the entry does not exist or is of different type, it will return the default value.
defaultValue | the value to be returned if no value is found |
|
inline |
Get an array of all value changes since the last call to ReadQueue.
Also provides a timestamp for each value.