blob: 1f420a099b0efaadf5b21f139233b594746b8433 [file] [log] [blame]
jerrymf1579332013-02-07 01:56:28 +00001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2011. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5/*----------------------------------------------------------------------------*/
6
7#include "Commands/CommandGroupEntry.h"
8
9#include "Commands/Command.h"
10
11CommandGroupEntry::CommandGroupEntry() :
12 m_timeout(-1.0),
13 m_command(NULL),
14 m_state(kSequence_InSequence)
15{
16}
17
18CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state) :
19 m_timeout(-1.0),
20 m_command(command),
21 m_state(state)
22{
23}
24
25CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state, double timeout) :
26 m_timeout(timeout),
27 m_command(command),
28 m_state(state)
29{
30}
31
32bool CommandGroupEntry::IsTimedOut()
33{
34 if (m_timeout < 0.0)
35 return false;
36 double time = m_command->TimeSinceInitialized();
37 if (time == 0.0)
38 return false;
39 return time >= m_timeout;
40}