Files
allwpilib/wpilibc/wpilibC++/include/LiveWindow/LiveWindow.h
thomasclark bb50f4b134 C++ testing
Made a toplevel directory for C++ and C++ tests

Change-Id: I4bc2074a7036ec7fe79568b411637a5bee9eb5b3

Added the C++ testing framework and one test

Change-Id: I1e80a1e16b251a49666820a9d4c8caa025da9785
2014-06-02 15:36:18 -04:00

68 lines
1.5 KiB
C++

#ifndef _LIVE_WINDOW_H
#define _LIVE_WINDOW_H
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITable.h"
#include "Commands/Scheduler.h"
#include <vector>
#include <map>
struct LiveWindowComponent
{
std::string subsystem;
std::string name;
bool isSensor;
LiveWindowComponent()
{}//WTF?
LiveWindowComponent(std::string subsystem, std::string name, bool isSensor)
{
this->subsystem = subsystem;
this->name = name;
this->isSensor = isSensor;
}
};
/**
* The LiveWindow class is the public interface for putting sensors and actuators
* on the LiveWindow.
*
* @author Brad Miller
*/
class LiveWindow {
public:
static LiveWindow * GetInstance();
void Run();
void AddSensor(const char *subsystem, const char *name, LiveWindowSendable *component);
void AddActuator(const char *subsystem, const char *name, LiveWindowSendable *component);
void AddSensor(std::string type, int module, int channel, LiveWindowSendable *component);
void AddActuator(std::string type, int module, int channel, LiveWindowSendable *component);
bool IsEnabled() { return m_enabled; }
void SetEnabled(bool enabled);
protected:
LiveWindow();
virtual ~LiveWindow();
private:
void UpdateValues();
void Initialize();
void InitializeLiveWindowComponents();
std::vector<LiveWindowSendable *> m_sensors;
std::map<LiveWindowSendable *, LiveWindowComponent> m_components;
static LiveWindow *m_instance;
ITable *m_liveWindowTable;
ITable *m_statusTable;
Scheduler *m_scheduler;
bool m_enabled;
bool m_firstTime;
};
#endif