2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
27 /*=========================================================================
29 Program: instantHandler
30 Module: $RCSfile: InstantHandler.h,v $
32 Date: $Date: 2012/11/15 12:12:26 $
33 Version: $Revision: 1.2 $
34 Objective: Handles the change of instant among the concept already inscribed
35 Authot: Monica Maria Lozano Romero
40 This software is distributed WITHOUT ANY WARRANTY; without even
41 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
42 PURPOSE. See the above copyright notice for more information.
45 =========================================================================*/
49 #ifndef __INSTANTHANDLER_H_INCLUDED__
50 #define __INSTANTHANDLER_H_INCLUDED__
61 #include "SomeEnvironment.h"
62 #include "ConceptInstantHandler.h"
63 #include "ViewerNDimensionsException.h"
82 //========== CONSTANTS =======
84 //====== LIFECYCLE ========
85 InstantHandler(SomeEnvironment<P>* environment)throw (ViewerNDimensionsException);
88 //====== OPERATIONS =======
91 * Adds a concept to handled in the instant, it means, when
92 * the next instant is used we are going to change this concepts in the instant
94 * the calls to this functions are made in order of position, where the last position (it means
95 * the higher position defined) is the concept thats is going to handled the real time
96 * THE LAST POSITION HANDLEDS THE REAL TIME DOESNT MATTER THE CONCEPT
98 * The user wants to reproduce doctors, pacients and time, and positions given are:
99 * 0=reproduce doctors, 1= reproduce pacients, 2= time, then 1,2 are going to be reproduced
100 * by PLUS PLUS, and time by REAL TIME
101 * @param nameConcept, name of the concept
102 * @param mode, mode of change
103 * @param position, position of reproduction
104 * @return true if succesful, false otherwise
106 bool addConceptToHandled(std::string nameConcept,int mode,int position)throw (ViewerNDimensionsException);
110 * Next instant of the concepts to change
114 void nextInstant()throw (ViewerNDimensionsException);
118 * Previous instant of the actual concept
122 void previousInstant()throw (ViewerNDimensionsException);
125 * Removes all the concept handled
127 void removeAllConcepts();
130 * Removes the concept with the name given
131 * @param nameConcept, name of the concept to remove
132 * WARNING the user know wich concept is erasing, also knows the
133 * mode of other concepts, if the user is deleting the concept that
134 * handled the real time, should change the mode to other concept that exist
136 void removeConceptToHandled(std::string nameConcept);
139 * sets all the concept to handled in 0
141 void resetConceptsHandled();
148 //====== INQUIRY =========
151 * get the actual instant for the concept identified by the name
153 Instant* getActualInstant()throw (ViewerNDimensionsException);
157 * If the actual concept has next instant, it means, if the index of the concept
158 * in the instant is less that the maximum value
159 * @return true if IS NOT in the maximum, false otherwise
161 bool hasNextInstant();
164 * If the concept has previous instant, it means, if the index of the concept
165 * in the instant is positive
166 * @return true if IS NOT in zero, false otherwise
168 bool hasPreviousInstant();
171 * returns the number con conceptsToHandled
173 int getSizeConceptsToChange();
176 * returns the number of possibles instants of the handler
177 * it depends of the concepts added in conceptsTochange
179 int getNumOfInstants();
182 * Returns the names of the concepts handled and its modes
185 void getConceptsInfo(std::vector<std::string>& namesConcepts,std::vector<int>& modes);
187 * Returns the name of the concept that handled the real time
190 void getTimeConcept(std::string& nameConcept);
191 //====== ACCESS ==========
193 * Sets the environment that is going to be handled
194 * @param environment, a pointer to the environmen
197 void setEnvironment(SomeEnvironment<P>* environment);
199 * Sets the actual instant of the instant handler
202 void setActualInstant(Instant* instant);
204 * Sets the time of reproduction to the concept
205 * that depends of the real time of the reproduction
209 void setTimeReproduction(double time);
211 * Sets the actual time of the reproduction,
212 * is the real time (seconds)
215 void setActualTime(double actualTime);
217 * Set the mode of a concept that's being handled
219 void setModeOfConcept(std::string nameConcept,int mode);
225 * Set the increase Value for changing the instant
227 void setIncreaseValue(int increase);
229 * Set the decrease Value for changing the instant
231 void setDecreaseValue(int decrease);
237 //======= ATTRIBUTES=======
240 * actual instant of the InstantHandler
242 Instant* actualInstant;
245 * Environment that's being handled
247 SomeEnvironment<P>* environment;
250 * concepts to change in the actual instant
252 std::vector<ConceptInstantHandler*> conceptsToChange;
255 * actual concept being manipulated
257 ConceptInstantHandler* actualConcept;
260 * if the actual concept has next
264 * if the actual concept has previous
269 * actual time of the reproduction
278 //====== PRIVATE METHODS=========
280 * Sets if the instant has next or not
285 * Sets if the instant has previous or not
288 void setHasPrevious();
290 * actualize the actual index of the concepts handled
292 void setConceptsToChange();
294 * resets all the next concepts to zero
296 void resetNextConcepts();
298 * Sets the next index of concepts to handled to the maximum value
300 void setNextConcepts();
302 * this method locates the new actual concept
303 * @param next, if has to locate the actual concept to the first concept that has next
304 * next=true, else search for the first concept that has previous
306 void toLocateActualConcept(bool next);
310 //include the implementation of the template
311 #include "InstantHandler_Txx.h"