![]() |
WPILibC++ 2025.3.2
|
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. | |
| ValueType | Get () const |
| Get the last published value. | |
| bool | GetBoolean (bool defaultValue) const |
| Gets the entry's value as a boolean. | |
| int64_t | GetInteger (int64_t defaultValue) const |
| Gets the entry's value as a integer. | |
| float | GetFloat (float defaultValue) const |
| Gets the entry's value as a float. | |
| double | GetDouble (double defaultValue) const |
| Gets the entry's value as a double. | |
| std::string | GetString (std::string_view defaultValue) const |
| Gets the entry's value as a string. | |
| std::vector< uint8_t > | GetRaw (std::span< const uint8_t > defaultValue) const |
| Gets the entry's value as a raw. | |
| std::vector< int > | GetBooleanArray (std::span< const int > defaultValue) const |
| Gets the entry's value as a boolean array. | |
| std::vector< int64_t > | GetIntegerArray (std::span< const int64_t > defaultValue) const |
| Gets the entry's value as a integer array. | |
| std::vector< float > | GetFloatArray (std::span< const float > defaultValue) const |
| Gets the entry's value as a float array. | |
| std::vector< double > | GetDoubleArray (std::span< const double > defaultValue) const |
| Gets the entry's value as a double array. | |
| std::vector< std::string > | GetStringArray (std::span< const std::string > defaultValue) const |
| Gets the entry's value as a string array. | |
| std::vector< TimestampedValueType > | ReadQueue () |
| Get an array of all value changes since the last call to ReadQueue. | |
| TopicType | GetTopic () const |
| Get the corresponding topic. | |
Public Member Functions inherited from nt::Subscriber | |
| virtual | ~Subscriber () |
| Subscriber (const Subscriber &)=delete | |
| Subscriber & | operator= (const Subscriber &)=delete |
| Subscriber (Subscriber &&rhs) | |
| Subscriber & | operator= (Subscriber &&rhs) |
| operator bool () const | |
| Determines if the native handle is valid. | |
| NT_Subscriber | GetHandle () const |
| Gets the native handle for the subscriber. | |
| bool | Exists () const |
| Determines if the topic is currently being published. | |
| int64_t | GetLastChange () const |
| Gets the last time the value was changed. | |
| Topic | GetTopic () const |
| Gets the subscribed-to topic. | |
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 the corresponding topic.
|
inline |
Get an array of all value changes since the last call to ReadQueue.
Also provides a timestamp for each value.