WPILibC++  2019.1.1-beta-1-17-ge27d6d7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ShuffleboardValue.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2018 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 <memory>
11 #include <string>
12 
13 #include <networktables/NetworkTable.h>
14 #include <wpi/SmallVector.h>
15 #include <wpi/StringRef.h>
16 
17 namespace frc {
18 
20  public:
21  explicit ShuffleboardValue(const wpi::Twine& title) {
23  m_title = title.toStringRef(storage);
24  }
25 
26  virtual ~ShuffleboardValue() = default;
27 
31  wpi::StringRef GetTitle() const { return m_title; }
32 
46  virtual void BuildInto(std::shared_ptr<nt::NetworkTable> parentTable,
47  std::shared_ptr<nt::NetworkTable> metaTable) = 0;
48 
56  virtual void EnableIfActuator() {}
57 
65  virtual void DisableIfActuator() {}
66 
67  private:
68  std::string m_title;
69 };
70 
71 } // namespace frc
wpi::StringRef GetTitle() const
Gets the title of this Shuffleboard value.
Definition: ShuffleboardValue.h:31
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:868
Definition: ShuffleboardValue.h:19
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
virtual void EnableIfActuator()
Enables user control of this widget in the Shuffleboard application.
Definition: ShuffleboardValue.h:56
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
StringRef toStringRef(SmallVectorImpl< char > &Out) const
This returns the twine as a single StringRef if it can be represented as such.
Definition: Twine.h:444
virtual void DisableIfActuator()
Disables user control of this widget in the Shuffleboard application.
Definition: ShuffleboardValue.h:65
virtual void BuildInto(std::shared_ptr< nt::NetworkTable > parentTable, std::shared_ptr< nt::NetworkTable > metaTable)=0
Builds the entries for this value.