WPILibC++ 2024.3.2
|
The SendableRegistry class is the public interface for registering sensors and actuators for use on dashboards and LiveWindow. More...
#include <wpi/sendable/SendableRegistry.h>
Classes | |
struct | CallbackData |
Data passed to ForeachLiveWindow() callback function. More... | |
Public Types | |
using | UID = size_t |
Public Member Functions | |
SendableRegistry ()=delete | |
Static Public Member Functions | |
static void | SetLiveWindowBuilderFactory (std::function< std::unique_ptr< SendableBuilder >()> factory) |
Sets the factory for LiveWindow builders. More... | |
static void | Add (Sendable *sendable, std::string_view name) |
Adds an object to the registry. More... | |
static void | Add (Sendable *sendable, std::string_view moduleType, int channel) |
Adds an object to the registry. More... | |
static void | Add (Sendable *sendable, std::string_view moduleType, int moduleNumber, int channel) |
Adds an object to the registry. More... | |
static void | Add (Sendable *sendable, std::string_view subsystem, std::string_view name) |
Adds an object to the registry. More... | |
static void | AddLW (Sendable *sendable, std::string_view name) |
Adds an object to the registry and LiveWindow. More... | |
static void | AddLW (Sendable *sendable, std::string_view moduleType, int channel) |
Adds an object to the registry and LiveWindow. More... | |
static void | AddLW (Sendable *sendable, std::string_view moduleType, int moduleNumber, int channel) |
Adds an object to the registry and LiveWindow. More... | |
static void | AddLW (Sendable *sendable, std::string_view subsystem, std::string_view name) |
Adds an object to the registry and LiveWindow. More... | |
static void | AddChild (Sendable *parent, Sendable *child) |
Adds a child object to an object. More... | |
static void | AddChild (Sendable *parent, void *child) |
Adds a child object to an object. More... | |
static bool | Remove (Sendable *sendable) |
Removes an object from the registry. More... | |
static void | Move (Sendable *to, Sendable *from) |
Moves an object in the registry (for use in move constructors/assignments). More... | |
static bool | Contains (const Sendable *sendable) |
Determines if an object is in the registry. More... | |
static std::string | GetName (const Sendable *sendable) |
Gets the name of an object. More... | |
static void | SetName (Sendable *sendable, std::string_view name) |
Sets the name of an object. More... | |
static void | SetName (Sendable *sendable, std::string_view moduleType, int channel) |
Sets the name of an object with a channel number. More... | |
static void | SetName (Sendable *sendable, std::string_view moduleType, int moduleNumber, int channel) |
Sets the name of an object with a module and channel number. More... | |
static void | SetName (Sendable *sendable, std::string_view subsystem, std::string_view name) |
Sets both the subsystem name and device name of an object. More... | |
static std::string | GetSubsystem (const Sendable *sendable) |
Gets the subsystem name of an object. More... | |
static void | SetSubsystem (Sendable *sendable, std::string_view subsystem) |
Sets the subsystem name of an object. More... | |
static int | GetDataHandle () |
Gets a unique handle for setting/getting data with SetData() and GetData(). More... | |
static std::shared_ptr< void > | SetData (Sendable *sendable, int handle, std::shared_ptr< void > data) |
Associates arbitrary data with an object in the registry. More... | |
static std::shared_ptr< void > | GetData (Sendable *sendable, int handle) |
Gets arbitrary data associated with an object in the registry. More... | |
static void | EnableLiveWindow (Sendable *sendable) |
Enables LiveWindow for an object. More... | |
static void | DisableLiveWindow (Sendable *sendable) |
Disables LiveWindow for an object. More... | |
static UID | GetUniqueId (Sendable *sendable) |
Get unique id for an object. More... | |
static Sendable * | GetSendable (UID uid) |
Get sendable object for a given unique id. More... | |
static void | Publish (UID sendableUid, std::unique_ptr< SendableBuilder > builder) |
Publishes an object in the registry. More... | |
static void | Update (UID sendableUid) |
Updates published information from an object. More... | |
static void | ForeachLiveWindow (int dataHandle, wpi::function_ref< void(CallbackData &cbdata)> callback) |
Iterates over LiveWindow-enabled objects in the registry. More... | |
The SendableRegistry class is the public interface for registering sensors and actuators for use on dashboards and LiveWindow.
using wpi::SendableRegistry::UID = size_t |
|
delete |
|
static |
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 |
|
static |
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 |
|
static |
Adds an object to the registry.
sendable | object to add |
name | component name |
|
static |
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 |
|
static |
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 |
|
static |
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 |
|
static |
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 |
|
static |
Adds an object to the registry and LiveWindow.
sendable | object to add |
name | component name |
|
static |
Adds an object to the registry and LiveWindow.
sendable | object to add |
subsystem | subsystem name |
name | component name |
|
static |
Determines if an object is in the registry.
sendable | object to check |
|
static |
Disables LiveWindow for an object.
sendable | object |
|
static |
Enables LiveWindow for an object.
sendable | object |
|
static |
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 |
|
static |
Gets arbitrary data associated with an object in the registry.
sendable | object |
handle | data handle returned by GetDataHandle() |
|
static |
|
static |
Gets the name of an object.
sendable | object |
Get sendable object for a given unique id.
uid | unique id |
|
static |
Gets the subsystem name of an object.
sendable | object |
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 |
|
static |
Publishes an object in the registry.
sendableUid | sendable unique id |
builder | publisher backend |
|
static |
Removes an object from the registry.
sendable | object to remove |
|
static |
Associates arbitrary data with an object in the registry.
sendable | object |
handle | data handle returned by GetDataHandle() |
data | data to set |
|
static |
Sets the factory for LiveWindow builders.
factory | factory function |
|
static |
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 |
|
static |
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 |
|
static |
Sets the name of an object.
sendable | object |
name | name |
|
static |
Sets both the subsystem name and device name of an object.
sendable | object |
subsystem | subsystem name |
name | device name |
|
static |
Sets the subsystem name of an object.
sendable | object |
subsystem | subsystem name |
|
static |
Updates published information from an object.
sendableUid | sendable unique id |