CommandsRegisterStructure.h

Go to the documentation of this file.
00001 #ifndef __COMMANDS_REGISTER_STRUCTURE__
00002 #define __COMMANDS_REGISTER_STRUCTURE__
00003 
00004 //------------------------------------------------------------------------------------------------------------
00005 // Includes
00006 //------------------------------------------------------------------------------------------------------------
00007 
00008 #include <vector>
00009 #include <iostream>
00010 #include "CommandObject.h"
00011 
00012 class CommandsRegisterStructure{
00013 
00014 //------------------------------------------------------------------------------------------------------------
00015 // Constructors & Destructors
00016 //------------------------------------------------------------------------------------------------------------
00017 public:
00018 
00019         /*
00020         * Creates the CommandsRegisterStructure
00021         */
00022         CommandsRegisterStructure();
00023 
00024         /*
00025         * Destroys the CommandsRegisterStructure
00026         */
00027         ~CommandsRegisterStructure();
00028 
00029 //------------------------------------------------------------------------------------------------------------
00030 // Methods
00031 //------------------------------------------------------------------------------------------------------------
00032 
00037         void registerCommand(CommandObject * theCommand);
00038 
00039         /*
00040         * Gets the -ACTUAL- command text 
00041         * @return
00042         */
00043         //std::string getActualCommandText();
00044 
00045         /*
00046         * Gets the -LAST- command text 
00047         * @return
00048         */
00049         //std::string getLastCommandText();
00050 
00051         /*
00052         * Deletes all the registered actions and reinitialize the -ACTUAL- and  -LAST- iterators
00053         */
00054         void clearActions();
00055 
00056         /*
00057         * Moves to the the previous position the -ACTUAL- iterator
00058         * @return Indicates true if it was done
00059         */
00060         bool moveBack_Actual();
00061 
00062         /*
00063         * Moves to the the next position the -ACTUAL- iterator
00064         * @return Indicates true if it was done
00065         */
00066         bool moveForward_Actual();
00067 
00068         /*
00069         * Moves to the the previous position the -LAST- iterator
00070         * @return Indicates true if it was done
00071         */
00072         bool moveBack_Last();
00073 
00074         /*
00075         * Moves to the the next position the -LAST- iterator
00076         * @return Indicates true if it was done
00077         */
00078         bool moveForward_Last();
00079 
00080         /*
00081         * Indicates if the -LAST- iterator has a next action or not
00082         * @return Returns true if it has
00083         */
00084         bool hasLastNext();
00085 
00086         /*
00087         * Indicates if the -ACTUAL- iterator has a next action or not
00088         * @return Returns true if it has
00089         */
00090         bool hasActualNext();
00091 
00092         /*
00093         * Indicates if the -LAST- iterator has a previous action or not
00094         * @return Returns true if it has
00095         */
00096         bool hasLastPrevious();
00097 
00098         /*
00099         * Indicates if the -ACTUAL- iterator has a previous action or not
00100         * @return Returns true if it has
00101         */
00102         bool hasActualPrevious();
00103 
00104         /*
00105         * Puts to point the -ACTUAL- iterator up to the -LAST-  iterator.
00106         */
00107         void levelActualToLast();
00108 
00109         /*
00110         * Puts to point the -LAST- iterator up to the -ACTUAL- iterator and erases automatically the actions after the 
00111         * referenced last and the end of the registered actions if nothing is given by parameter.       
00112         */
00113         void levelLastToActual(bool clearingAfterLast = true);
00114 
00115         /*
00116         * Clear all the elements in the vector bettween the -LAST- iterator and the end of the vector
00117         */
00118         void clearAll_afterLast();
00119 
00120         /*
00121         * Clear all the elements in the vector bettween the -ACTUAL- iterator and the start of the vector       
00122         */
00123         void clearAll_beforeActual();
00124 
00129         bool isEmpty();
00130 
00135         int getCommandsCount();
00136 
00137         /*
00138         * Gets the -ACTUAL-  iterator information data pointer
00139         * @return The pointer to the referenced object by the -ACTUAL- iterator
00140         */
00141         CommandObject * getActual_Pointer();
00142 
00143         /*
00144         * Gets the -LAST-  iterator information data pointer
00145         * @return The pointer to the referenced object by the -LAST- iterator
00146         */
00147         CommandObject * getLast_Pointer();
00148 
00149         /*
00150         * Gets the command at the given position 
00151         * @return The pointer to the referenced object by the position
00152         */
00153         CommandObject * getCommandAt(int position);
00154 
00155         /*
00156         * Gets the index of the actualAction in the vector
00157         * @return actualIndexToExec Is the corresponding index
00158         */
00159         int getActualIndex();
00160 
00161         /*
00162         * Gets the index of the lasAction in the vector
00163         * @return lasAction Is the corresponding index
00164         */
00165         int getLasIndex();
00166 
00167         /*
00168         * Sets the index of the actualAction in the vector
00169         * @param newActualIndex Is the corresponding index
00170         */
00171         void setActualIndex(int newActualIndex);
00172 
00173         /*
00174         * Sets the index of the lasAction in the vector
00175         * @param newLasIndex Is the corresponding index
00176         */
00177         void setLasIndex(int newLasIndex);
00178 
00179         /*
00180         * Gets the registered commands vector size
00181         * @return Returns the vector size
00182         */
00183         int getRegistereCommandsCount();
00184 
00185         /*
00186         * Gets the total registered commands 
00187         * @return Returns the total of commands
00188         */
00189         int getTotalCommandsCount();
00190 
00191 
00192         
00193 
00194 //------------------------------------------------------------------------------------------------------------
00195 // Constants
00196 //------------------------------------------------------------------------------------------------------------
00197 
00198 private:        
00199 //------------------------------------------------------------------------------------------------------------
00200 // Attributes
00201 //------------------------------------------------------------------------------------------------------------
00202         
00203         /*
00204         * Represents the actions successfully registered 
00205         */
00206         std::vector<CommandObject*> registeredActions;
00207         
00208         /*
00209         * Represents the index to the actual action to execute at the registered actions vector
00210         */
00211         //std::vector <CommandObject*>::iterator actualAction;
00212         int actualIndexToExec;
00213         
00214         /*
00215         * Represents the index to the last action executed at the registered actions vector
00216         */
00217         //std::vector <CommandObject*>::iterator lastAction;   
00218         int lastAction;   
00219 
00220 };
00221 #endif

Generated on Wed Jun 27 23:28:33 2012 for creaContours_lib by  doxygen 1.5.7.1