32 requires std::copy_constructible<T> && std::default_initializable<T>
35 std::function<void(T)> m_listener;
37 static U _unwrap_smart_ptr(
const U& value);
40 static U* _unwrap_smart_ptr(
const std::unique_ptr<U>& value);
43 static std::weak_ptr<U> _unwrap_smart_ptr(
const std::shared_ptr<U>& value);
84 auto GetSelected() ->
decltype(_unwrap_smart_ptr(m_choices[
""]));
92 void OnChange(std::function<
void(T)>);
This file defines the StringMap class.
This class is a non-template base class for SendableChooser.
Definition: SendableChooserBase.h:23
The SendableChooser class is a useful tool for presenting a selection of options to the SmartDashboar...
Definition: SendableChooser.h:33
SendableChooser & operator=(SendableChooser &&rhs)=default
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:36
SendableChooser(SendableChooser &&rhs)=default
void AddOption(std::string_view name, T object)
Adds the given object to the list of options.
Definition: SendableChooser.inc:23
void InitSendable(wpi::SendableBuilder &builder) override
Initializes this Sendable object.
Definition: SendableChooser.inc:61
~SendableChooser() override=default
void OnChange(std::function< void(T)>)
Bind a listener that's called when the selected value changes.
Definition: SendableChooser.inc:54
void SetDefaultOption(std::string_view name, T object)
Add the given object to the list of options and marks it as the default.
Definition: SendableChooser.inc:29
SendableChooser()=default
Definition: SendableBuilder.h:18
basic_string_view< char > string_view
Definition: core.h:501
Definition: AprilTagPoseEstimator.h:15