2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
/* Copyright (c) FIRST 2011-2016. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2016-05-25 22:40:15 -07:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
|
|
|
|
#include <map>
|
2016-09-05 13:55:31 -07:00
|
|
|
#include <memory>
|
2013-12-15 18:30:16 -05:00
|
|
|
#include <string>
|
2016-09-05 13:55:31 -07:00
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "SensorBase.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "SmartDashboard/NamedSendable.h"
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "SmartDashboard/Sendable.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "tables/ITable.h"
|
|
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
class SmartDashboard : public SensorBase {
|
|
|
|
|
public:
|
|
|
|
|
static void init();
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2016-05-20 17:30:37 -07:00
|
|
|
static void PutData(llvm::StringRef key, Sendable* data);
|
|
|
|
|
static void PutData(NamedSendable* value);
|
|
|
|
|
static Sendable* GetData(llvm::StringRef keyName);
|
2014-08-04 14:43:31 -04:00
|
|
|
|
2015-08-13 23:17:19 -07:00
|
|
|
static void PutBoolean(llvm::StringRef keyName, bool value);
|
|
|
|
|
static bool GetBoolean(llvm::StringRef keyName, bool defaultValue);
|
2014-08-04 14:43:31 -04:00
|
|
|
|
2015-08-13 23:17:19 -07:00
|
|
|
static void PutNumber(llvm::StringRef keyName, double value);
|
|
|
|
|
static double GetNumber(llvm::StringRef keyName, double defaultValue);
|
2014-08-04 14:43:31 -04:00
|
|
|
|
2015-08-13 23:17:19 -07:00
|
|
|
static void PutString(llvm::StringRef keyName, llvm::StringRef value);
|
|
|
|
|
static std::string GetString(llvm::StringRef keyName,
|
|
|
|
|
llvm::StringRef defaultValue);
|
2014-08-04 14:43:31 -04:00
|
|
|
|
2015-08-13 23:17:19 -07:00
|
|
|
static void PutValue(llvm::StringRef keyName,
|
|
|
|
|
std::shared_ptr<nt::Value> value);
|
|
|
|
|
static std::shared_ptr<nt::Value> GetValue(llvm::StringRef keyName);
|
2014-08-04 14:43:31 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
private:
|
2015-06-24 01:06:29 -07:00
|
|
|
virtual ~SmartDashboard() = default;
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/** The {@link NetworkTable} used by {@link SmartDashboard} */
|
2015-07-29 16:48:04 -04:00
|
|
|
static std::shared_ptr<ITable> m_table;
|
2014-08-04 14:43:31 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
2016-05-20 17:30:37 -07:00
|
|
|
* A map linking tables in the SmartDashboard to the
|
|
|
|
|
* {@link SmartDashboardData} objects they came from.
|
2015-06-25 15:07:55 -04:00
|
|
|
*/
|
2016-05-20 17:30:37 -07:00
|
|
|
static std::map<std::shared_ptr<ITable>, Sendable*> m_tablesToData;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|