WPILibC++ 2022.4.1
wpi::SendableHelper< Derived > Class Template Reference

A helper class for use with objects that add themselves to SendableRegistry. More...

#include <wpi/sendable/SendableHelper.h>

Public Member Functions

 SendableHelper (const SendableHelper &rhs)=default
 
SendableHelperoperator= (const SendableHelper &rhs)=default
 
 SendableHelper (SendableHelper &&rhs)
 
SendableHelperoperator= (SendableHelper &&rhs)
 
std::string GetName () const
 Gets the name of this Sendable object. More...
 
void SetName (std::string_view name)
 Sets the name of this Sendable object. More...
 
void SetName (std::string_view subsystem, std::string_view name)
 Sets both the subsystem name and device name of this Sendable object. More...
 
std::string GetSubsystem () const
 Gets the subsystem name of this Sendable object. More...
 
void SetSubsystem (std::string_view subsystem)
 Sets the subsystem name of this Sendable object. More...
 

Protected Member Functions

void AddChild (std::shared_ptr< Sendable > child)
 Add a child component. More...
 
void AddChild (void *child)
 Add a child component. More...
 
void SetName (std::string_view moduleType, int channel)
 Sets the name of the sensor with a channel number. More...
 
void SetName (std::string_view moduleType, int moduleNumber, int channel)
 Sets the name of the sensor with a module and channel number. More...
 
 SendableHelper ()=default
 
 ~SendableHelper ()
 

Detailed Description

template<typename Derived>
class wpi::SendableHelper< Derived >

A helper class for use with objects that add themselves to SendableRegistry.

It takes care of properly calling Move() and Remove() on move and destruction. No action is taken if the object is copied. Use public inheritance with CRTP when using this class.

Template Parameters
CRTPderived class

Constructor & Destructor Documentation

◆ SendableHelper() [1/3]

template<typename Derived >
wpi::SendableHelper< Derived >::SendableHelper ( const SendableHelper< Derived > &  rhs)
default

◆ SendableHelper() [2/3]

template<typename Derived >
wpi::SendableHelper< Derived >::SendableHelper ( SendableHelper< Derived > &&  rhs)
inline

◆ SendableHelper() [3/3]

template<typename Derived >
wpi::SendableHelper< Derived >::SendableHelper ( )
protecteddefault

◆ ~SendableHelper()

template<typename Derived >
wpi::SendableHelper< Derived >::~SendableHelper ( )
inlineprotected

Member Function Documentation

◆ AddChild() [1/2]

template<typename Derived >
void wpi::SendableHelper< Derived >::AddChild ( std::shared_ptr< Sendable child)
inlineprotected

Add a child component.

Deprecated:
use SendableRegistry::AddChild()
Parameters
childchild component

◆ AddChild() [2/2]

template<typename Derived >
void wpi::SendableHelper< Derived >::AddChild ( void *  child)
inlineprotected

Add a child component.

Deprecated:
use SendableRegistry::AddChild()
Parameters
childchild component

◆ GetName()

template<typename Derived >
std::string wpi::SendableHelper< Derived >::GetName ( ) const
inline

Gets the name of this Sendable object.

Deprecated:
use SendableRegistry::GetName()
Returns
Name

◆ GetSubsystem()

template<typename Derived >
std::string wpi::SendableHelper< Derived >::GetSubsystem ( ) const
inline

Gets the subsystem name of this Sendable object.

Deprecated:
use SendableRegistry::GetSubsystem().
Returns
Subsystem name

◆ operator=() [1/2]

template<typename Derived >
SendableHelper & wpi::SendableHelper< Derived >::operator= ( const SendableHelper< Derived > &  rhs)
default

◆ operator=() [2/2]

template<typename Derived >
SendableHelper & wpi::SendableHelper< Derived >::operator= ( SendableHelper< Derived > &&  rhs)
inline

◆ SetName() [1/4]

template<typename Derived >
void wpi::SendableHelper< Derived >::SetName ( std::string_view  moduleType,
int  channel 
)
inlineprotected

Sets the name of the sensor with a channel number.

Deprecated:
use SendableRegistry::SetName()
Parameters
moduleTypeA string that defines the module name in the label for the value
channelThe channel number the device is plugged into

◆ SetName() [2/4]

template<typename Derived >
void wpi::SendableHelper< Derived >::SetName ( std::string_view  moduleType,
int  moduleNumber,
int  channel 
)
inlineprotected

Sets the name of the sensor with a module and channel number.

Deprecated:
use SendableRegistry::SetName()
Parameters
moduleTypeA string that defines the module name in the label for the value
moduleNumberThe number of the particular module type
channelThe channel number the device is plugged into (usually PWM)

◆ SetName() [3/4]

template<typename Derived >
void wpi::SendableHelper< Derived >::SetName ( std::string_view  name)
inline

Sets the name of this Sendable object.

Deprecated:
use SendableRegistry::SetName()
Parameters
namename

◆ SetName() [4/4]

template<typename Derived >
void wpi::SendableHelper< Derived >::SetName ( std::string_view  subsystem,
std::string_view  name 
)
inline

Sets both the subsystem name and device name of this Sendable object.

Deprecated:
use SendableRegistry::SetName()
Parameters
subsystemsubsystem name
namedevice name

◆ SetSubsystem()

template<typename Derived >
void wpi::SendableHelper< Derived >::SetSubsystem ( std::string_view  subsystem)
inline

Sets the subsystem name of this Sendable object.

Deprecated:
use SendableRegistry::SetSubsystem()
Parameters
subsystemsubsystem name

The documentation for this class was generated from the following file: