WPILibC++  2020.3.2-60-g3011ebe
SendableChooserBase.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2017-2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <atomic>
11 #include <string>
12 
13 #include <networktables/NetworkTableEntry.h>
14 #include <wpi/SmallVector.h>
15 #include <wpi/mutex.h>
16 
17 #include "frc/smartdashboard/Sendable.h"
18 #include "frc/smartdashboard/SendableHelper.h"
19 
20 namespace frc {
21 
29  public SendableHelper<SendableChooserBase> {
30  public:
32  ~SendableChooserBase() override = default;
33 
35  SendableChooserBase& operator=(SendableChooserBase&& oth);
36 
37  protected:
38  static constexpr const char* kDefault = "default";
39  static constexpr const char* kOptions = "options";
40  static constexpr const char* kSelected = "selected";
41  static constexpr const char* kActive = "active";
42  static constexpr const char* kInstance = ".instance";
43 
44  std::string m_defaultChoice;
45  std::string m_selected;
46  bool m_haveSelected = false;
48  wpi::mutex m_mutex;
49  int m_instance;
50  static std::atomic_int s_instances;
51 };
52 
53 } // namespace frc
frc::SendableChooserBase
This class is a non-template base class for SendableChooser.
Definition: SendableChooserBase.h:28
frc::Sendable
Interface for Sendable objects.
Definition: Sendable.h:17
frc
A class that enforces constraints on the differential drive kinematics.
Definition: PDPSim.h:16
wpi::SmallVector< nt::NetworkTableEntry, 2 >
frc::SendableHelper
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28