WPILibC++ 2023.4.3
frc::MechanismObject2d Class Referenceabstract

Common base class for all Mechanism2d node types. More...

#include <frc/smartdashboard/MechanismObject2d.h>

Inheritance diagram for frc::MechanismObject2d:
frc::MechanismLigament2d frc::MechanismRoot2d

Public Member Functions

virtual ~MechanismObject2d ()=default
 
const std::string & GetName () const
 Retrieve the object's name. More...
 
template<typename T , typename... Args, typename = std::enable_if_t<std::is_convertible_v<T*, MechanismObject2d*>>>
T * Append (std::string_view name, Args &&... args)
 Append a Mechanism object that is based on this one. More...
 

Protected Member Functions

 MechanismObject2d (std::string_view name)
 
virtual void UpdateEntries (std::shared_ptr< nt::NetworkTable > table)=0
 Update all entries with new ones from a new table. More...
 

Protected Attributes

wpi::mutex m_mutex
 

Friends

class Mechanism2d
 

Detailed Description

Common base class for all Mechanism2d node types.

To append another node, call Append with the type of node and its construction parameters. None of the node types are designed to be constructed directly, and are owned by their parent node/container - obtain pointers from the Append function or similar factory methods.

See also
Mechanism2d.

Constructor & Destructor Documentation

◆ MechanismObject2d()

frc::MechanismObject2d::MechanismObject2d ( std::string_view  name)
explicitprotected

◆ ~MechanismObject2d()

virtual frc::MechanismObject2d::~MechanismObject2d ( )
virtualdefault

Member Function Documentation

◆ Append()

template<typename T , typename... Args, typename = std::enable_if_t<std::is_convertible_v<T*, MechanismObject2d*>>>
T * frc::MechanismObject2d::Append ( std::string_view  name,
Args &&...  args 
)
inline

Append a Mechanism object that is based on this one.

Parameters
namethe name of the new object.
argsconstructor arguments of the object type.
Returns
the constructed and appended object, useful for variable assignments and call chaining.
Exceptions
ifan object with the given name already exists.

◆ GetName()

const std::string & frc::MechanismObject2d::GetName ( ) const

Retrieve the object's name.

Returns
the object's name relative to its parent.

◆ UpdateEntries()

virtual void frc::MechanismObject2d::UpdateEntries ( std::shared_ptr< nt::NetworkTable table)
protectedpure virtual

Update all entries with new ones from a new table.

Parameters
tablethe new table.

Implemented in frc::MechanismLigament2d.

Friends And Related Function Documentation

◆ Mechanism2d

friend class Mechanism2d
friend

Member Data Documentation

◆ m_mutex

wpi::mutex frc::MechanismObject2d::m_mutex
mutableprotected

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