Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Execution Class Reference

#include <execution.h>

Collaboration diagram for Execution:

Collaboration graph
List of all members.

Public Member Functions

 Execution (CommandSequence &, ExecutionEnvironment &)
void reset (CommandSequence &)
bool tick (double)

Private Attributes

double commandTime
CommandSequence::const_iterator currentCommand
ExecutionEnvironmentenv
CommandSequence::const_iterator finalCommand

Constructor & Destructor Documentation

Execution::Execution CommandSequence ,
ExecutionEnvironment
 

Definition at line 15 of file execution.cpp.

00015                                                                      :
00016     currentCommand(cmd.begin()),
00017     finalCommand(cmd.end()),
00018     env(_env),
00019     commandTime(-1.0)
00020 {
00021 }


Member Function Documentation

void Execution::reset CommandSequence  ) 
 

Definition at line 59 of file execution.cpp.

References commandTime, currentCommand, and finalCommand.

Referenced by RepeatCommand::process().

00060 {
00061     currentCommand = cmd.begin();
00062     finalCommand = cmd.end();
00063     commandTime = -1.0;
00064 }

bool Execution::tick double   ) 
 

Definition at line 24 of file execution.cpp.

References commandTime, currentCommand, env, finalCommand, Command::getDuration(), and Command::process().

Referenced by RepeatCommand::process(), CelScriptWrapper::tick(), and CelestiaCore::tick().

00025 {
00026     // ignore the very first call to tick, because on windows dt may include the
00027     // time spent in the "Open File" dialog. Using commandTime < 0 as a flag
00028     // to recognize the first call:
00029     if (commandTime < 0.0)
00030     {
00031         commandTime = 0.0;
00032         return false;
00033     }
00034 
00035     while (dt > 0.0 && currentCommand != finalCommand)
00036     {
00037         Command* cmd = *currentCommand;
00038 
00039         double timeLeft = cmd->getDuration() - commandTime;
00040         if (dt >= timeLeft)
00041         {
00042             cmd->process(env, cmd->getDuration(), timeLeft);
00043             dt -= timeLeft;
00044             commandTime = 0.0;
00045             currentCommand++;
00046         }
00047         else
00048         {
00049             commandTime += dt;
00050             cmd->process(env, commandTime, dt);
00051             dt = 0.0;
00052         }
00053     }
00054 
00055     return currentCommand == finalCommand;
00056 }


Member Data Documentation

double Execution::commandTime [private]
 

Definition at line 29 of file execution.h.

Referenced by reset(), and tick().

CommandSequence::const_iterator Execution::currentCommand [private]
 

Definition at line 26 of file execution.h.

Referenced by reset(), and tick().

ExecutionEnvironment& Execution::env [private]
 

Definition at line 28 of file execution.h.

Referenced by tick().

CommandSequence::const_iterator Execution::finalCommand [private]
 

Definition at line 27 of file execution.h.

Referenced by reset(), and tick().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:19 2006 for Celestia by  doxygen 1.4.1