Merge "The LiveWindow instance isn't a global static"

This commit is contained in:
Jonathan Leitschuh (WPI)
2014-07-29 14:00:31 -07:00
committed by Gerrit Code Review
2 changed files with 4 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ struct LiveWindowComponent
bool isSensor; bool isSensor;
LiveWindowComponent() LiveWindowComponent()
{}//WTF? {}
LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) LiveWindowComponent(std::string subsystem, std::string name, bool isSensor)
{ {
this->subsystem = subsystem; this->subsystem = subsystem;
@@ -54,7 +54,6 @@ private:
std::vector<LiveWindowSendable *> m_sensors; std::vector<LiveWindowSendable *> m_sensors;
std::map<LiveWindowSendable *, LiveWindowComponent> m_components; std::map<LiveWindowSendable *, LiveWindowComponent> m_components;
static LiveWindow *m_instance;
ITable *m_liveWindowTable; ITable *m_liveWindowTable;
ITable *m_statusTable; ITable *m_statusTable;

View File

@@ -3,8 +3,6 @@
#include <algorithm> #include <algorithm>
#include <sstream> #include <sstream>
LiveWindow* LiveWindow::m_instance = NULL;
/** /**
* Get an instance of the LiveWindow main class * Get an instance of the LiveWindow main class
* This is a singleton to guarantee that there is only a single instance regardless of * This is a singleton to guarantee that there is only a single instance regardless of
@@ -12,11 +10,9 @@ LiveWindow* LiveWindow::m_instance = NULL;
*/ */
LiveWindow * LiveWindow::GetInstance() LiveWindow * LiveWindow::GetInstance()
{ {
if (m_instance == NULL) static LiveWindow* instance = new LiveWindow();
{
m_instance = new LiveWindow(); return instance;
}
return m_instance;
} }
/** /**