//---------------------------------------------------------------------------------------------------------------- // Class definition include //---------------------------------------------------------------------------------------------------------------- #include "ComposedCommand.h" //---------------------------------------------------------------------------------------------------------------- // Class implementation //---------------------------------------------------------------------------------------------------------------- /** @file ComposedCommand.cxx */ //------------------------------------------------------------------------------------------------------------ // Constructors & Destructors //------------------------------------------------------------------------------------------------------------ ComposedCommand :: ComposedCommand( ) { } ComposedCommand :: ~ComposedCommand( ) { clear(); } //------------------------------------------------------------------------------------------------------------ // Methods //------------------------------------------------------------------------------------------------------------ /* * Adds a command to the list of command * @param nwCommand Is the new command to include */ void ComposedCommand :: addCommand(CommandObject * nwCommand) { internalCommands.push_back(nwCommand); } /* * Virtual method implentation that includes the commands list into the given queue for execution * @param executionQueue Is the queue in which is included the command */ void ComposedCommand :: includeToExecute(std::deque &executionQueue) { std::deque::iterator actualCommandIter = internalCommands.end(); while( actualCommandIter != internalCommands.begin()) { (*actualCommandIter)->includeToExecute(executionQueue); actualCommandIter--; } } /* * Virtual method implementation that returns 1 as the ExecutableCommand is just one command effective * @return The value of commands that represents this */ int ComposedCommand :: count() { int count = 0; int i =0; while( icount(); i++; } return count; } /* * Virtual method implentation that that clears the commands inside the composed command calling each one to clean it self */ void ComposedCommand :: clear() { while( internalCommands.size()>0 ) { internalCommands.back()->clear(); internalCommands.pop_back(); } internalCommands.clear(); }