WPILibC++ 2023.4.3-108-ge5452e3
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
13#include <wpi/SmallVector.h>
14#include <wpi/mutex.h>
16
17namespace frc {
18
19/**
20 * This class is a non-template base class for SendableChooser.
21 *
22 * It contains static, non-templated variables to avoid their duplication in the
23 * template class.
24 */
26 public wpi::SendableHelper<SendableChooserBase> {
27 public:
29 ~SendableChooserBase() override = default;
30
33
34 protected:
35 static constexpr const char* kDefault = "default";
36 static constexpr const char* kOptions = "options";
37 static constexpr const char* kSelected = "selected";
38 static constexpr const char* kActive = "active";
39 static constexpr const char* kInstance = ".instance";
40
41 std::string m_defaultChoice;
42 std::string m_selected;
43 bool m_haveSelected = false;
48 static std::atomic_int s_instances;
49};
50
51} // namespace frc
This file defines the SmallVector class.
This class is a non-template base class for SendableChooser.
Definition: SendableChooserBase.h:26
static constexpr const char * kActive
Definition: SendableChooserBase.h:38
std::string m_defaultChoice
Definition: SendableChooserBase.h:41
~SendableChooserBase() override=default
static constexpr const char * kInstance
Definition: SendableChooserBase.h:39
wpi::mutex m_mutex
Definition: SendableChooserBase.h:46
static constexpr const char * kOptions
Definition: SendableChooserBase.h:36
static constexpr const char * kSelected
Definition: SendableChooserBase.h:37
wpi::SmallVector< nt::StringPublisher, 2 > m_activePubs
Definition: SendableChooserBase.h:45
std::string m_selected
Definition: SendableChooserBase.h:42
bool m_haveSelected
Definition: SendableChooserBase.h:43
static std::atomic_int s_instances
Definition: SendableChooserBase.h:48
int m_instance
Definition: SendableChooserBase.h:47
static constexpr const char * kDefault
Definition: SendableChooserBase.h:35
SendableChooserBase & operator=(SendableChooserBase &&oth)
SendableChooserBase(SendableChooserBase &&oth)
wpi::SmallVector< nt::IntegerPublisher, 2 > m_instancePubs
Definition: SendableChooserBase.h:44
Interface for NetworkTable Sendable objects.
Definition: NTSendable.h:16
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:19
Definition: AprilTagPoseEstimator.h:15
::std::mutex mutex
Definition: mutex.h:17