WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
SendableChooserBase.hpp
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <atomic>
8#include <string>
9
10#include "wpi/util/mutex.hpp"
13
14namespace wpi {
15
16/**
17 * This class is a non-template base class for SendableChooser.
18 *
19 * It contains static, non-templated variables to avoid their duplication in the
20 * template class.
21 */
23 : public wpi::util::Sendable,
24 public wpi::util::SendableHelper<SendableChooserBase> {
25 public:
27 ~SendableChooserBase() override = default;
28
31
32 protected:
33 static constexpr const char* kDefault = "default";
34 static constexpr const char* kOptions = "options";
35 static constexpr const char* kSelected = "selected";
36 static constexpr const char* kActive = "active";
37 static constexpr const char* kInstance = ".instance";
38
39 std::string m_defaultChoice;
40 std::string m_selected;
41 bool m_haveSelected = false;
44 std::string m_previousVal;
45 static std::atomic_int s_instances;
46};
47
48} // namespace wpi
std::string m_selected
Definition SendableChooserBase.hpp:40
wpi::util::mutex m_mutex
Definition SendableChooserBase.hpp:42
static constexpr const char * kDefault
Definition SendableChooserBase.hpp:33
bool m_haveSelected
Definition SendableChooserBase.hpp:41
SendableChooserBase & operator=(SendableChooserBase &&oth)
SendableChooserBase(SendableChooserBase &&oth)
static constexpr const char * kOptions
Definition SendableChooserBase.hpp:34
std::string m_previousVal
Definition SendableChooserBase.hpp:44
static constexpr const char * kActive
Definition SendableChooserBase.hpp:36
std::string m_defaultChoice
Definition SendableChooserBase.hpp:39
int m_instance
Definition SendableChooserBase.hpp:43
static constexpr const char * kInstance
Definition SendableChooserBase.hpp:37
static constexpr const char * kSelected
Definition SendableChooserBase.hpp:35
static std::atomic_int s_instances
Definition SendableChooserBase.hpp:45
~SendableChooserBase() override=default
A helper class for use with objects that add themselves to SendableRegistry.
Definition SendableHelper.hpp:21
Interface for Sendable objects.
Definition Sendable.hpp:16
::std::mutex mutex
Definition mutex.hpp:17
Definition CvSource.hpp:15