jerrym | f157933 | 2013-02-07 01:56:28 +0000 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/
|
| 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 |
|
| 11 | CommandGroupEntry::CommandGroupEntry() :
|
| 12 | m_timeout(-1.0),
|
| 13 | m_command(NULL),
|
| 14 | m_state(kSequence_InSequence)
|
| 15 | {
|
| 16 | }
|
| 17 |
|
| 18 | CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state) :
|
| 19 | m_timeout(-1.0),
|
| 20 | m_command(command),
|
| 21 | m_state(state)
|
| 22 | {
|
| 23 | }
|
| 24 |
|
| 25 | CommandGroupEntry::CommandGroupEntry(Command *command, Sequence state, double timeout) :
|
| 26 | m_timeout(timeout),
|
| 27 | m_command(command),
|
| 28 | m_state(state)
|
| 29 | {
|
| 30 | }
|
| 31 |
|
| 32 | bool 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 | }
|