mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
SendableChooser generic value (#433)
* Java SendableChooser now decorates with type (non-breaking change) * C++ SendableChooser now is templated on the type instead of using void* and stores values (breaking change) * C++ SendableChooser now uses llvm::StringMap instead of std::map
This commit is contained in:
committed by
Peter Johnson
parent
25ae7b2c2b
commit
5aa5e3e09e
40
wpilibc/shared/include/SmartDashboard/SendableChooserBase.h
Normal file
40
wpilibc/shared/include/SmartDashboard/SendableChooserBase.h
Normal file
@@ -0,0 +1,40 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "SmartDashboard/Sendable.h"
|
||||
#include "tables/ITable.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* This class is a non-template base class for {@link SendableChooser}.
|
||||
*
|
||||
* It contains static, non-templated variables to avoid their duplication in the
|
||||
* template class.
|
||||
*/
|
||||
class SendableChooserBase : public Sendable {
|
||||
public:
|
||||
virtual ~SendableChooserBase() = default;
|
||||
|
||||
std::shared_ptr<ITable> GetTable() const override;
|
||||
std::string GetSmartDashboardType() const override;
|
||||
|
||||
protected:
|
||||
static const char* kDefault;
|
||||
static const char* kOptions;
|
||||
static const char* kSelected;
|
||||
|
||||
std::string m_defaultChoice;
|
||||
std::shared_ptr<ITable> m_table;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user