42 virtual void UpdateEntries(std::shared_ptr<nt::NetworkTable> table) = 0;
65 template <
typename T,
typename... Args>
66 requires std::convertible_to<T*, MechanismObject2d*>
69 auto& obj = m_objects[
name];
73 "MechanismObject names must be unique! `{}` was inserted twice!",
76 obj = std::make_unique<T>(
name, std::forward<Args>(args)...);
77 T* ex =
static_cast<T*
>(obj.get());
79 ex->Update(m_table->GetSubTable(
name));
87 std::shared_ptr<nt::NetworkTable> m_table;
88 void Update(std::shared_ptr<nt::NetworkTable> table);
This file defines the StringMap class.
Visual 2D representation of arms, elevators, and general mechanisms through a node-based API.
Definition: Mechanism2d.h:43
Common base class for all Mechanism2d node types.
Definition: MechanismObject2d.h:31
virtual void UpdateEntries(std::shared_ptr< nt::NetworkTable > table)=0
Update all entries with new ones from a new table.
T * Append(std::string_view name, Args &&... args)
Append a Mechanism object that is based on this one.
Definition: MechanismObject2d.h:67
wpi::mutex m_mutex
Definition: MechanismObject2d.h:44
const std::string & GetName() const
Retrieve the object's name.
virtual ~MechanismObject2d()=default
MechanismObject2d(std::string_view name)
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:114
basic_string_view< char > string_view
Definition: core.h:520
Definition: AprilTagPoseEstimator.h:15
::std::mutex mutex
Definition: mutex.h:17
#define FRC_MakeError(status, format,...)
Makes a runtime error exception object.
Definition: Errors.h:153