42 virtual void UpdateEntries(std::shared_ptr<nt::NetworkTable> table) = 0;
65 template <
typename T,
typename... Args,
67 std::enable_if_t<std::is_convertible_v<T*, MechanismObject2d*>>>
70 auto& obj = m_objects[
name];
74 "MechanismObject names must be unique! `{}` was inserted twice!",
77 obj = std::make_unique<T>(
name, std::forward<Args>(args)...);
78 T* ex =
static_cast<T*
>(obj.get());
80 ex->Update(m_table->GetSubTable(
name));
88 std::shared_ptr<nt::NetworkTable> m_table;
89 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:68
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: AprilTagFieldLayout.h:22
::std::mutex mutex
Definition: mutex.h:17
#define FRC_MakeError(status, format,...)
Makes a runtime error exception object.
Definition: Errors.h:152