WPILib 2012
WPILibRoboticsLibraryforFRC
SmartDashboard/SmartDashboard.h
00001 /*----------------------------------------------------------------------------*/
00002 /* Copyright (c) FIRST 2011. All Rights Reserved.                                                         */
00003 /* Open Source Software - may be modified and shared by FRC teams. The code   */
00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
00005 /*----------------------------------------------------------------------------*/
00006 
00007 #ifndef __SMART_DASHBOARD_H__
00008 #define __SMART_DASHBOARD_H__
00009 
00010 #include "SensorBase.h"
00011 #include <map>
00012 #include <string>
00013 
00014 class NetworkTable;
00015 class SmartDashboardData;
00016 class SmartDashboardNamedData;
00017 
00018 class SmartDashboard : public SensorBase
00019 {
00020 public:
00021         static SmartDashboard *GetInstance();
00022 
00023         void PutData(const char *keyName, SmartDashboardData *value);
00024         void PutData(SmartDashboardNamedData *value);
00025         SmartDashboardData* GetData(const char *keyName);
00026         void PutBoolean(const char *keyName, bool value);
00027         bool GetBoolean(const char *keyName);
00028         void PutInt(const char *keyName, int value);
00029         int GetInt(const char *keyName);
00030         void PutDouble(const char *keyName, double value);
00031         double GetDouble(const char *keyName);
00032         void PutString(const char *keyName, const char *value);
00033         int GetString(const char *keyName, char *value, int valueLen);
00034         std::string GetString(std::string keyName);
00035         void PutString(std::string keyName, std::string value);
00036 
00037         void init();
00038         static int LogChar(char value, const char *name);
00039         static int LogChar(wchar_t value, const char *name);
00040         static int Log(INT32 value, const char *name);
00041         static int Log(INT64 value, const char *name);
00042         static int Log(bool value, const char *name);
00043         static int Log(float value, const char *name);
00044         static int Log(double value, const char *name);
00045         static int Log(const char *value, const char *name);
00046 
00047 private:
00048         SmartDashboard();
00049         virtual ~SmartDashboard();
00050         DISALLOW_COPY_AND_ASSIGN(SmartDashboard);
00051 
00052         static SmartDashboard *_instance;
00053 
00055         NetworkTable *m_table;
00060         std::map<NetworkTable *, SmartDashboardData *> m_tablesToData;
00061 };
00062 
00063 #endif
00064 
 All Classes Functions Variables