7 #include "Commands/Subsystem.h"
9 #include "Commands/Command.h"
10 #include "Commands/Scheduler.h"
11 #include "WPIErrors.h"
18 m_currentCommand(NULL),
19 m_defaultCommand(NULL),
20 m_initializedDefaultCommand(false)
25 m_currentCommandChanged =
true;
52 m_defaultCommand = NULL;
58 Command::SubsystemSet::iterator iter = requirements.begin();
59 for (; iter != requirements.end(); iter++)
70 wpi_setWPIErrorWithContext(CommandIllegalUse,
"A default command must require the subsystem");
74 m_defaultCommand = command;
78 if (m_defaultCommand != NULL)
96 if (!m_initializedDefaultCommand) {
97 m_initializedDefaultCommand =
true;
100 return m_defaultCommand;
109 m_currentCommand = command;
110 m_currentCommandChanged =
true;
119 return m_currentCommand;
127 void Subsystem::ConfirmCommand()
129 if (m_currentCommandChanged) {
132 if (m_currentCommand != NULL)
142 m_currentCommandChanged =
false;
162 if (m_defaultCommand != NULL) {
168 if (m_currentCommand != NULL) {
Subsystem(const char *name)
Command * GetCurrentCommand()
virtual ITable * GetTable()
virtual std::string GetName()
virtual std::string GetName()
virtual void PutBoolean(std::string key, bool value)=0
virtual std::string GetSmartDashboardType()
Command * GetDefaultCommand()
void RegisterSubsystem(Subsystem *subsystem)
virtual void InitTable(ITable *table)
void SetCurrentCommand(Command *command)
virtual void InitDefaultCommand()
void SetDefaultCommand(Command *command)
static Scheduler * GetInstance()
virtual void PutString(std::string key, std::string value)=0
SubsystemSet GetRequirements()