41 virtual void UpdateEntries(std::shared_ptr<wpi::nt::NetworkTable> table) = 0;
64 template <
typename T,
typename... Args>
65 requires std::convertible_to<T*, MechanismObject2d*>
68 auto& obj = m_objects[
name];
72 "MechanismObject names must be unique! `{}` was inserted twice!",
75 obj = std::make_unique<T>(
name, std::forward<Args>(args)...);
76 T* ex =
static_cast<T*
>(obj.get());
78 ex->Update(m_table->GetSubTable(
name));
86 std::shared_ptr<wpi::nt::NetworkTable> m_table;
87 void Update(std::shared_ptr<wpi::nt::NetworkTable> table);
#define WPILIB_MakeError(status, format,...)
Makes a runtime error exception object.
Definition Errors.hpp:164
@ name
Definition base.h:690
wpi::util::mutex m_mutex
Definition MechanismObject2d.hpp:43
virtual void UpdateEntries(std::shared_ptr< wpi::nt::NetworkTable > table)=0
Update all entries with new ones from a new table.
virtual ~MechanismObject2d()=default
MechanismObject2d(std::string_view name)
const std::string & GetName() const
Retrieve the object's name.
T * Append(std::string_view name, Args &&... args)
Append a Mechanism object that is based on this one.
Definition MechanismObject2d.hpp:66
friend class Mechanism2d
Definition MechanismObject2d.hpp:31
StringMap is a sorted associative container that contains key-value pairs with unique string keys.
Definition StringMap.hpp:26
::std::mutex mutex
Definition mutex.hpp:17
Definition CvSource.hpp:15