WPILibC++  2019.3.2-1-g99e4f7d
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ShuffleboardComponentBase.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 <networktables/NetworkTableValue.h>
15 #include <wpi/StringMap.h>
16 #include <wpi/Twine.h>
17 
18 #include "frc/shuffleboard/ShuffleboardValue.h"
19 
20 namespace frc {
21 
22 class ShuffleboardContainer;
23 
28  public:
30  const wpi::Twine& title,
31  const wpi::Twine& type = "");
32 
33  virtual ~ShuffleboardComponentBase() = default;
34 
35  void SetType(const wpi::Twine& type);
36 
37  void BuildMetadata(std::shared_ptr<nt::NetworkTable> metaTable);
38 
39  ShuffleboardContainer& GetParent();
40 
41  const std::string& GetType() const;
42 
43  protected:
45  bool m_metadataDirty = true;
46  int m_column = -1;
47  int m_row = -1;
48  int m_width = -1;
49  int m_height = -1;
50 
51  private:
52  ShuffleboardContainer& m_parent;
53  std::string m_type;
54 
58  const wpi::StringMap<std::shared_ptr<nt::Value>>& GetProperties() const;
59 };
60 
61 } // namespace frc
A shim class to allow storing ShuffleboardComponents in arrays.
Definition: ShuffleboardComponentBase.h:27
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
Definition: ShuffleboardValue.h:19
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Definition: StringMap.h:205
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:79
Common interface for objects that can contain shuffleboard components.
Definition: ShuffleboardContainer.h:42