13 #include "SmartDashboard/SendableChooserBase.h"
14 #include "llvm/StringMap.h"
15 #include "llvm/StringRef.h"
16 #include "tables/ITable.h"
36 llvm::StringMap<T> m_choices;
39 static U _unwrap_smart_ptr(
const U& value);
42 static U* _unwrap_smart_ptr(
const std::unique_ptr<U>& value);
45 static std::weak_ptr<U> _unwrap_smart_ptr(
const std::shared_ptr<U>& value);
50 void AddObject(llvm::StringRef name, T
object);
51 void AddDefault(llvm::StringRef name, T
object);
53 auto GetSelected() -> decltype(_unwrap_smart_ptr(m_choices[
""]));
55 void InitTable(std::shared_ptr<ITable> subtable)
override;
60 #include "SendableChooser.inc"
This class is a non-template base class for SendableChooser.
Definition: SendableChooserBase.h:24
void AddObject(llvm::StringRef name, T object)
Adds the given object to the list of options.
Definition: SendableChooser.inc:28
auto GetSelected() -> decltype(_unwrap_smart_ptr(m_choices[""]))
Returns a copy of the selected option (a raw pointer U* if T = std::unique_ptr<U> or a std::weak_ptr<...
Definition: SendableChooser.inc:60
void AddDefault(llvm::StringRef name, T object)
Add the given object to the list of options and marks it as the default.
Definition: SendableChooser.inc:43
The SendableChooser class is a useful tool for presenting a selection of options to the SmartDashboar...
Definition: SendableChooser.h:35
void InitTable(std::shared_ptr< ITable > subtable) override
Initializes a table for this sendable object.
Definition: SendableChooser.inc:71