WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
SmartDashboard.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2011-2016. 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 #ifndef __SMART_DASHBOARD_H__
9 #define __SMART_DASHBOARD_H__
10 
11 #include "SensorBase.h"
12 #include <map>
13 #include <string>
14 #include "SmartDashboard/Sendable.h"
15 #include "SmartDashboard/NamedSendable.h"
16 #include "tables/ITable.h"
17 
18 class SmartDashboard : public SensorBase {
19  public:
20  static void init();
21 
22  static void PutData(llvm::StringRef key, Sendable *data);
23  static void PutData(NamedSendable *value);
24  static Sendable *GetData(llvm::StringRef keyName);
25 
26  static void PutBoolean(llvm::StringRef keyName, bool value);
27  static bool GetBoolean(llvm::StringRef keyName, bool defaultValue);
28 
29  static void PutNumber(llvm::StringRef keyName, double value);
30  static double GetNumber(llvm::StringRef keyName, double defaultValue);
31 
32  static void PutString(llvm::StringRef keyName, llvm::StringRef value);
33  static std::string GetString(llvm::StringRef keyName,
34  llvm::StringRef defaultValue);
35 
36  static void PutValue(llvm::StringRef keyName,
37  std::shared_ptr<nt::Value> value);
38  static std::shared_ptr<nt::Value> GetValue(llvm::StringRef keyName);
39 
40  private:
41  virtual ~SmartDashboard() = default;
42 
44  static std::shared_ptr<ITable> m_table;
45 
51  static std::map<std::shared_ptr<ITable> , Sendable *> m_tablesToData;
52 };
53 
54 #endif
static std::string GetString(llvm::StringRef keyName, llvm::StringRef defaultValue)
Returns the value at the specified key.
Definition: SmartDashboard.cpp:162
static double GetNumber(llvm::StringRef keyName, double defaultValue)
Returns the value at the specified key.
Definition: SmartDashboard.cpp:140
static void PutBoolean(llvm::StringRef keyName, bool value)
Maps the specified key to the specified value in this table.
Definition: SmartDashboard.cpp:108
static Sendable * GetData(llvm::StringRef keyName)
Returns the value at the specified key.
Definition: SmartDashboard.cpp:65
static bool GetBoolean(llvm::StringRef keyName, bool defaultValue)
Returns the value at the specified key.
Definition: SmartDashboard.cpp:118
Definition: Sendable.h:15
Base class for all sensors.
Definition: SensorBase.h:20
static void PutString(llvm::StringRef keyName, llvm::StringRef value)
Maps the specified key to the specified value in this table.
Definition: SmartDashboard.cpp:152
static void PutData(llvm::StringRef key, Sendable *data)
Maps the specified key to the specified value in this table.
Definition: SmartDashboard.cpp:33
static std::shared_ptr< nt::Value > GetValue(llvm::StringRef keyName)
Retrieves the complex value (such as an array) in this table into the complex data object The key can...
Definition: SmartDashboard.cpp:96
The interface for sendable objects that gives the sendable a default name in the Smart Dashboard...
Definition: NamedSendable.h:19
Definition: SmartDashboard.h:18
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:39
static void PutValue(llvm::StringRef keyName, std::shared_ptr< nt::Value > value)
Maps the specified key to the specified complex value (such as an array) in this table.
Definition: SmartDashboard.cpp:84
static void PutNumber(llvm::StringRef keyName, double value)
Maps the specified key to the specified value in this table.
Definition: SmartDashboard.cpp:130