2 //----------------------------------------------------------------------------------------------------------------
3 // Class definition include
4 //----------------------------------------------------------------------------------------------------------------
5 #include "ComposedCommand.h"
7 //----------------------------------------------------------------------------------------------------------------
8 // Class implementation
9 //----------------------------------------------------------------------------------------------------------------
10 /** @file ComposedCommand.cxx */
12 //------------------------------------------------------------------------------------------------------------
13 // Constructors & Destructors
14 //------------------------------------------------------------------------------------------------------------
17 ComposedCommand :: ComposedCommand( )
22 ComposedCommand :: ~ComposedCommand( )
27 //------------------------------------------------------------------------------------------------------------
29 //------------------------------------------------------------------------------------------------------------
32 * Adds a command to the list of command
33 * @param nwCommand Is the new command to include
35 void ComposedCommand :: addCommand(CommandObject * nwCommand)
37 internalCommands.push_back(nwCommand);
41 * Virtual method implentation that includes the commands list into the given queue for execution
42 * @param executionQueue Is the queue in which is included the command
44 void ComposedCommand :: includeToExecute(std::deque<CommandObject* > &executionQueue)
46 std::deque<CommandObject *>::iterator actualCommandIter = internalCommands.end();
47 while( actualCommandIter != internalCommands.begin())
49 (*actualCommandIter)->includeToExecute(executionQueue);
55 * Virtual method implementation that returns 1 as the ExecutableCommand is just one command effective
56 * @return The value of commands that represents this
58 int ComposedCommand :: count()
62 while( i<internalCommands.size() )
64 count += internalCommands[i]->count();
71 * Virtual method implentation that that clears the commands inside the composed command calling each one to clean it self
73 void ComposedCommand :: clear()
75 while( internalCommands.size()>0 )
77 internalCommands.back()->clear();
78 internalCommands.pop_back();
80 internalCommands.clear();