1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #ifndef __COMMANDS_REGISTER_STRUCTURE__
27 #define __COMMANDS_REGISTER_STRUCTURE__
29 //------------------------------------------------------------------------------------------------------------
31 //------------------------------------------------------------------------------------------------------------
35 #include "CommandObject.h"
37 class CommandsRegisterStructure{
39 //------------------------------------------------------------------------------------------------------------
40 // Constructors & Destructors
41 //------------------------------------------------------------------------------------------------------------
45 * Creates the CommandsRegisterStructure
47 CommandsRegisterStructure();
50 * Destroys the CommandsRegisterStructure
52 ~CommandsRegisterStructure();
54 //------------------------------------------------------------------------------------------------------------
56 //------------------------------------------------------------------------------------------------------------
59 * Registers a command in the vector with no verification, is should be well constructed
60 * @param theCommand The command to register
62 void registerCommand(CommandObject * theCommand);
65 * Gets the -ACTUAL- command text
68 //std::string getActualCommandText();
71 * Gets the -LAST- command text
74 //std::string getLastCommandText();
77 * Deletes all the registered actions and reinitialize the -ACTUAL- and -LAST- iterators
82 * Moves to the the previous position the -ACTUAL- iterator
83 * @return Indicates true if it was done
85 bool moveBack_Actual();
88 * Moves to the the next position the -ACTUAL- iterator
89 * @return Indicates true if it was done
91 bool moveForward_Actual();
94 * Moves to the the previous position the -LAST- iterator
95 * @return Indicates true if it was done
100 * Moves to the the next position the -LAST- iterator
101 * @return Indicates true if it was done
103 bool moveForward_Last();
106 * Indicates if the -LAST- iterator has a next action or not
107 * @return Returns true if it has
112 * Indicates if the -ACTUAL- iterator has a next action or not
113 * @return Returns true if it has
115 bool hasActualNext();
118 * Indicates if the -LAST- iterator has a previous action or not
119 * @return Returns true if it has
121 bool hasLastPrevious();
124 * Indicates if the -ACTUAL- iterator has a previous action or not
125 * @return Returns true if it has
127 bool hasActualPrevious();
130 * Puts to point the -ACTUAL- iterator up to the -LAST- iterator.
132 void levelActualToLast();
135 * Puts to point the -LAST- iterator up to the -ACTUAL- iterator and erases automatically the actions after the
136 * referenced last and the end of the registered actions if nothing is given by parameter.
138 void levelLastToActual(bool clearingAfterLast = true);
141 * Clear all the elements in the vector bettween the -LAST- iterator and the end of the vector
143 void clearAll_afterLast();
146 * Clear all the elements in the vector bettween the -ACTUAL- iterator and the start of the vector
148 void clearAll_beforeActual();
151 * Indicates if there are actions in the vector of not
152 * @return Returns true is there are not registered actions
157 * Indicates the quantity of actions that are registered
158 * @return Returns the total amount of registered actions in the vector
160 int getCommandsCount();
163 * Gets the -ACTUAL- iterator information data pointer
164 * @return The pointer to the referenced object by the -ACTUAL- iterator
166 CommandObject * getActual_Pointer();
169 * Gets the -LAST- iterator information data pointer
170 * @return The pointer to the referenced object by the -LAST- iterator
172 CommandObject * getLast_Pointer();
175 * Gets the command at the given position
176 * @return The pointer to the referenced object by the position
178 CommandObject * getCommandAt(int position);
181 * Gets the index of the actualAction in the vector
182 * @return actualIndexToExec Is the corresponding index
184 int getActualIndex();
187 * Gets the index of the lasAction in the vector
188 * @return lasAction Is the corresponding index
193 * Sets the index of the actualAction in the vector
194 * @param newActualIndex Is the corresponding index
196 void setActualIndex(int newActualIndex);
199 * Sets the index of the lasAction in the vector
200 * @param newLasIndex Is the corresponding index
202 void setLasIndex(int newLasIndex);
205 * Gets the registered commands vector size
206 * @return Returns the vector size
208 int getRegistereCommandsCount();
211 * Gets the total registered commands
212 * @return Returns the total of commands
214 int getTotalCommandsCount();
219 //------------------------------------------------------------------------------------------------------------
221 //------------------------------------------------------------------------------------------------------------
224 //------------------------------------------------------------------------------------------------------------
226 //------------------------------------------------------------------------------------------------------------
229 * Represents the actions successfully registered
231 std::vector<CommandObject*> registeredActions;
234 * Represents the index to the actual action to execute at the registered actions vector
236 //std::vector <CommandObject*>::iterator actualAction;
237 int actualIndexToExec;
240 * Represents the index to the last action executed at the registered actions vector
242 //std::vector <CommandObject*>::iterator lastAction;