|
WPILibC++
2020.3.2
|
The SendableRegistry class is the public interface for registering sensors and actuators for use on dashboards and LiveWindow. More...
#include <SendableRegistry.h>
Classes | |
| struct | CallbackData |
| Data passed to ForeachLiveWindow() callback function. More... | |
Public Types | |
| using | UID = size_t |
Public Member Functions | |
| SendableRegistry (const SendableRegistry &)=delete | |
| SendableRegistry & | operator= (const SendableRegistry &)=delete |
| void | Add (Sendable *sendable, const wpi::Twine &name) |
| Adds an object to the registry. More... | |
| void | Add (Sendable *sendable, const wpi::Twine &moduleType, int channel) |
| Adds an object to the registry. More... | |
| void | Add (Sendable *sendable, const wpi::Twine &moduleType, int moduleNumber, int channel) |
| Adds an object to the registry. More... | |
| void | Add (Sendable *sendable, const wpi::Twine &subsystem, const wpi::Twine &name) |
| Adds an object to the registry. More... | |
| void | AddLW (Sendable *sendable, const wpi::Twine &name) |
| Adds an object to the registry and LiveWindow. More... | |
| void | AddLW (Sendable *sendable, const wpi::Twine &moduleType, int channel) |
| Adds an object to the registry and LiveWindow. More... | |
| void | AddLW (Sendable *sendable, const wpi::Twine &moduleType, int moduleNumber, int channel) |
| Adds an object to the registry and LiveWindow. More... | |
| void | AddLW (Sendable *sendable, const wpi::Twine &subsystem, const wpi::Twine &name) |
| Adds an object to the registry and LiveWindow. More... | |
| void | AddChild (Sendable *parent, Sendable *child) |
| Adds a child object to an object. More... | |
| void | AddChild (Sendable *parent, void *child) |
| Adds a child object to an object. More... | |
| bool | Remove (Sendable *sendable) |
| Removes an object from the registry. More... | |
| void | Move (Sendable *to, Sendable *from) |
| Moves an object in the registry (for use in move constructors/assignments). More... | |
| bool | Contains (const Sendable *sendable) const |
| Determines if an object is in the registry. More... | |
| std::string | GetName (const Sendable *sendable) const |
| Gets the name of an object. More... | |
| void | SetName (Sendable *sendable, const wpi::Twine &name) |
| Sets the name of an object. More... | |
| void | SetName (Sendable *sendable, const wpi::Twine &moduleType, int channel) |
| Sets the name of an object with a channel number. More... | |
| void | SetName (Sendable *sendable, const wpi::Twine &moduleType, int moduleNumber, int channel) |
| Sets the name of an object with a module and channel number. More... | |
| void | SetName (Sendable *sendable, const wpi::Twine &subsystem, const wpi::Twine &name) |
| Sets both the subsystem name and device name of an object. More... | |
| std::string | GetSubsystem (const Sendable *sendable) const |
| Gets the subsystem name of an object. More... | |
| void | SetSubsystem (Sendable *sendable, const wpi::Twine &subsystem) |
| Sets the subsystem name of an object. More... | |
| int | GetDataHandle () |
| Gets a unique handle for setting/getting data with SetData() and GetData(). More... | |
| std::shared_ptr< void > | SetData (Sendable *sendable, int handle, std::shared_ptr< void > data) |
| Associates arbitrary data with an object in the registry. More... | |
| std::shared_ptr< void > | GetData (Sendable *sendable, int handle) |
| Gets arbitrary data associated with an object in the registry. More... | |
| void | EnableLiveWindow (Sendable *sendable) |
| Enables LiveWindow for an object. More... | |
| void | DisableLiveWindow (Sendable *sendable) |
| Disables LiveWindow for an object. More... | |
| UID | GetUniqueId (Sendable *sendable) |
| Get unique id for an object. More... | |
| Sendable * | GetSendable (UID uid) |
| Get sendable object for a given unique id. More... | |
| void | Publish (UID sendableUid, std::shared_ptr< NetworkTable > table) |
| Publishes an object in the registry to a network table. More... | |
| void | Update (UID sendableUid) |
| Updates network table information from an object. More... | |
| void | ForeachLiveWindow (int dataHandle, wpi::function_ref< void(CallbackData &cbdata)> callback) const |
| Iterates over LiveWindow-enabled objects in the registry. More... | |
Static Public Member Functions | |
| static SendableRegistry & | GetInstance () |
| Gets an instance of the SendableRegistry class. More... | |
The SendableRegistry class is the public interface for registering sensors and actuators for use on dashboards and LiveWindow.
| void frc::SendableRegistry::Add | ( | Sendable * | sendable, |
| const wpi::Twine & | moduleType, | ||
| int | channel | ||
| ) |
Adds an object to the registry.
| sendable | object to add |
| moduleType | A string that defines the module name in the label for the value |
| channel | The channel number the device is plugged into |
| void frc::SendableRegistry::Add | ( | Sendable * | sendable, |
| const wpi::Twine & | moduleType, | ||
| int | moduleNumber, | ||
| int | channel | ||
| ) |
Adds an object to the registry.
| sendable | object to add |
| moduleType | A string that defines the module name in the label for the value |
| moduleNumber | The number of the particular module type |
| channel | The channel number the device is plugged into |
| void frc::SendableRegistry::Add | ( | Sendable * | sendable, |
| const wpi::Twine & | name | ||
| ) |
Adds an object to the registry.
| sendable | object to add |
| name | component name |
| void frc::SendableRegistry::Add | ( | Sendable * | sendable, |
| const wpi::Twine & | subsystem, | ||
| const wpi::Twine & | name | ||
| ) |
Adds an object to the registry.
| sendable | object to add |
| subsystem | subsystem name |
| name | component name |
Adds a child object to an object.
Adds the child object to the registry if it's not already present.
| parent | parent object |
| child | child object |
| void frc::SendableRegistry::AddChild | ( | Sendable * | parent, |
| void * | child | ||
| ) |
Adds a child object to an object.
Adds the child object to the registry if it's not already present.
| parent | parent object |
| child | child object |
| void frc::SendableRegistry::AddLW | ( | Sendable * | sendable, |
| const wpi::Twine & | moduleType, | ||
| int | channel | ||
| ) |
Adds an object to the registry and LiveWindow.
| sendable | object to add |
| moduleType | A string that defines the module name in the label for the value |
| channel | The channel number the device is plugged into |
| void frc::SendableRegistry::AddLW | ( | Sendable * | sendable, |
| const wpi::Twine & | moduleType, | ||
| int | moduleNumber, | ||
| int | channel | ||
| ) |
Adds an object to the registry and LiveWindow.
| sendable | object to add |
| moduleType | A string that defines the module name in the label for the value |
| moduleNumber | The number of the particular module type |
| channel | The channel number the device is plugged into |
| void frc::SendableRegistry::AddLW | ( | Sendable * | sendable, |
| const wpi::Twine & | name | ||
| ) |
Adds an object to the registry and LiveWindow.
| sendable | object to add |
| name | component name |
| void frc::SendableRegistry::AddLW | ( | Sendable * | sendable, |
| const wpi::Twine & | subsystem, | ||
| const wpi::Twine & | name | ||
| ) |
Adds an object to the registry and LiveWindow.
| sendable | object to add |
| subsystem | subsystem name |
| name | component name |
| bool frc::SendableRegistry::Contains | ( | const Sendable * | sendable | ) | const |
Determines if an object is in the registry.
| sendable | object to check |
| void frc::SendableRegistry::DisableLiveWindow | ( | Sendable * | sendable | ) |
Disables LiveWindow for an object.
| sendable | object |
| void frc::SendableRegistry::EnableLiveWindow | ( | Sendable * | sendable | ) |
Enables LiveWindow for an object.
| sendable | object |
| void frc::SendableRegistry::ForeachLiveWindow | ( | int | dataHandle, |
| wpi::function_ref< void(CallbackData &cbdata)> | callback | ||
| ) | const |
Iterates over LiveWindow-enabled objects in the registry.
It is not safe to call other SendableRegistry functions from the callback (this will likely deadlock).
| dataHandle | data handle to get data pointer passed to callback |
| callback | function to call for each object |
| std::shared_ptr<void> frc::SendableRegistry::GetData | ( | Sendable * | sendable, |
| int | handle | ||
| ) |
Gets arbitrary data associated with an object in the registry.
| sendable | object |
| handle | data handle returned by GetDataHandle() |
| int frc::SendableRegistry::GetDataHandle | ( | ) |
|
static |
Gets an instance of the SendableRegistry class.
This is a singleton to guarantee that there is only a single instance regardless of how many times GetInstance is called.
| std::string frc::SendableRegistry::GetName | ( | const Sendable * | sendable | ) | const |
Gets the name of an object.
| sendable | object |
| Sendable* frc::SendableRegistry::GetSendable | ( | UID | uid | ) |
Get sendable object for a given unique id.
| uid | unique id |
| std::string frc::SendableRegistry::GetSubsystem | ( | const Sendable * | sendable | ) | const |
Gets the subsystem name of an object.
| sendable | object |
| UID frc::SendableRegistry::GetUniqueId | ( | Sendable * | sendable | ) |
Get unique id for an object.
Since objects can move, use this instead of storing Sendable* directly if ownership is in question.
| sendable | object |
Moves an object in the registry (for use in move constructors/assignments).
| to | new object |
| from | old object |
| void frc::SendableRegistry::Publish | ( | UID | sendableUid, |
| std::shared_ptr< NetworkTable > | table | ||
| ) |
Publishes an object in the registry to a network table.
| sendableUid | sendable unique id |
| table | network table |
| bool frc::SendableRegistry::Remove | ( | Sendable * | sendable | ) |
Removes an object from the registry.
| sendable | object to remove |
| std::shared_ptr<void> frc::SendableRegistry::SetData | ( | Sendable * | sendable, |
| int | handle, | ||
| std::shared_ptr< void > | data | ||
| ) |
Associates arbitrary data with an object in the registry.
| sendable | object |
| handle | data handle returned by GetDataHandle() |
| data | data to set |
| void frc::SendableRegistry::SetName | ( | Sendable * | sendable, |
| const wpi::Twine & | moduleType, | ||
| int | channel | ||
| ) |
Sets the name of an object with a channel number.
| sendable | object |
| moduleType | A string that defines the module name in the label for the value |
| channel | The channel number the device is plugged into |
| void frc::SendableRegistry::SetName | ( | Sendable * | sendable, |
| const wpi::Twine & | moduleType, | ||
| int | moduleNumber, | ||
| int | channel | ||
| ) |
Sets the name of an object with a module and channel number.
| sendable | object |
| moduleType | A string that defines the module name in the label for the value |
| moduleNumber | The number of the particular module type |
| channel | The channel number the device is plugged into |
| void frc::SendableRegistry::SetName | ( | Sendable * | sendable, |
| const wpi::Twine & | name | ||
| ) |
Sets the name of an object.
| sendable | object |
| name | name |
| void frc::SendableRegistry::SetName | ( | Sendable * | sendable, |
| const wpi::Twine & | subsystem, | ||
| const wpi::Twine & | name | ||
| ) |
Sets both the subsystem name and device name of an object.
| sendable | object |
| subsystem | subsystem name |
| name | device name |
| void frc::SendableRegistry::SetSubsystem | ( | Sendable * | sendable, |
| const wpi::Twine & | subsystem | ||
| ) |
Sets the subsystem name of an object.
| sendable | object |
| subsystem | subsystem name |
| void frc::SendableRegistry::Update | ( | UID | sendableUid | ) |
Updates network table information from an object.
| sendableUid | sendable unique id |