WPILibC++ 2025.2.1
Loading...
Searching...
No Matches
SendableChooserBase.h
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/mutex.h>
13
14namespace frc {
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::SendableHelper<SendableChooserBase> {
24 public:
26 ~SendableChooserBase() override = default;
27
30
31 protected:
32 static constexpr const char* kDefault = "default";
33 static constexpr const char* kOptions = "options";
34 static constexpr const char* kSelected = "selected";
35 static constexpr const char* kActive = "active";
36 static constexpr const char* kInstance = ".instance";
37
38 std::string m_defaultChoice;
39 std::string m_selected;
40 bool m_haveSelected = false;
43 std::string m_previousVal;
44 static std::atomic_int s_instances;
45};
46
47} // namespace frc
This class is a non-template base class for SendableChooser.
Definition SendableChooserBase.h:23
static constexpr const char * kActive
Definition SendableChooserBase.h:35
std::string m_defaultChoice
Definition SendableChooserBase.h:38
~SendableChooserBase() override=default
static constexpr const char * kInstance
Definition SendableChooserBase.h:36
wpi::mutex m_mutex
Definition SendableChooserBase.h:41
static constexpr const char * kOptions
Definition SendableChooserBase.h:33
static constexpr const char * kSelected
Definition SendableChooserBase.h:34
std::string m_selected
Definition SendableChooserBase.h:39
bool m_haveSelected
Definition SendableChooserBase.h:40
static std::atomic_int s_instances
Definition SendableChooserBase.h:44
int m_instance
Definition SendableChooserBase.h:42
static constexpr const char * kDefault
Definition SendableChooserBase.h:32
SendableChooserBase & operator=(SendableChooserBase &&oth)
SendableChooserBase(SendableChooserBase &&oth)
std::string m_previousVal
Definition SendableChooserBase.h:43
A helper class for use with objects that add themselves to SendableRegistry.
Definition SendableHelper.h:21
Interface for Sendable objects.
Definition Sendable.h:16
Definition CAN.h:11
::std::mutex mutex
Definition mutex.h:17