1 /*=========================================================================
3 Program: instantHandler
4 Module: $RCSfile: InstantHandler.h,v $
6 Date: $Date: 2008/10/31 15:08:40 $
7 Version: $Revision: 1.1 $
8 Objective: Handles the change of instant among the concept already inscribed
9 Authot: Monica Maria Lozano Romero
14 This software is distributed WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE. See the above copyright notice for more information.
19 =========================================================================*/
23 #ifndef __INSTANTHANDLER_H_INCLUDED__
24 #define __INSTANTHANDLER_H_INCLUDED__
35 #include "SomeEnvironment.h"
36 #include "ConceptInstantHandler.h"
37 #include "ViewerNDimensionsException.h"
56 //========== CONSTANTS =======
58 //====== LIFECYCLE ========
59 InstantHandler(SomeEnvironment<P>* environment)throw (ViewerNDimensionsException);
62 //====== OPERATIONS =======
65 * Adds a concept to handled in the instant, it means, when
66 * the next instant is used we are going to change this concepts in the instant
68 * the calls to this functions are made in order of position, where the last position (it means
69 * the higher position defined) is the concept thats is going to handled the real time
70 * THE LAST POSITION HANDLEDS THE REAL TIME DOESNT MATTER THE CONCEPT
72 * The user wants to reproduce doctors, pacients and time, and positions given are:
73 * 0=reproduce doctors, 1= reproduce pacients, 2= time, then 1,2 are going to be reproduced
74 * by PLUS PLUS, and time by REAL TIME
75 * @param nameConcept, name of the concept
76 * @param mode, mode of change
77 * @param position, position of reproduction
78 * @return true if succesful, false otherwise
80 bool addConceptToHandled(std::string nameConcept,int mode,int position)throw (ViewerNDimensionsException);
84 * Next instant of the concepts to change
88 void nextInstant()throw (ViewerNDimensionsException);
92 * Previous instant of the actual concept
96 void previousInstant()throw (ViewerNDimensionsException);
99 * Removes all the concept handled
101 void removeAllConcepts();
104 * Removes the concept with the name given
105 * @param nameConcept, name of the concept to remove
106 * WARNING the user know wich concept is erasing, also knows the
107 * mode of other concepts, if the user is deleting the concept that
108 * handled the real time, should change the mode to other concept that exist
110 void removeConceptToHandled(std::string nameConcept);
113 * sets all the concept to handled in 0
115 void resetConceptsHandled();
122 //====== INQUIRY =========
125 * get the actual instant for the concept identified by the name
127 Instant* getActualInstant()throw (ViewerNDimensionsException);
131 * If the actual concept has next instant, it means, if the index of the concept
132 * in the instant is less that the maximum value
133 * @return true if IS NOT in the maximum, false otherwise
135 bool hasNextInstant();
138 * If the concept has previous instant, it means, if the index of the concept
139 * in the instant is positive
140 * @return true if IS NOT in zero, false otherwise
142 bool hasPreviousInstant();
145 * returns the number con conceptsToHandled
147 int getSizeConceptsToChange();
150 * returns the number of possibles instants of the handler
151 * it depends of the concepts added in conceptsTochange
153 int getNumOfInstants();
156 * Returns the names of the concepts handled and its modes
159 void getConceptsInfo(std::vector<std::string>& namesConcepts,std::vector<int>& modes);
161 * Returns the name of the concept that handled the real time
164 void getTimeConcept(std::string& nameConcept);
165 //====== ACCESS ==========
167 * Sets the environment that is going to be handled
168 * @param environment, a pointer to the environmen
171 void setEnvironment(SomeEnvironment<P>* environment);
173 * Sets the actual instant of the instant handler
176 void setActualInstant(Instant* instant);
178 * Sets the time of reproduction to the concept
179 * that depends of the real time of the reproduction
183 void setTimeReproduction(double time);
185 * Sets the actual time of the reproduction,
186 * is the real time (seconds)
189 void setActualTime(double actualTime);
191 * Set the mode of a concept that's being handled
193 void setModeOfConcept(std::string nameConcept,int mode);
199 * Set the increase Value for changing the instant
201 void setIncreaseValue(int increase);
203 * Set the decrease Value for changing the instant
205 void setDecreaseValue(int decrease);
211 //======= ATTRIBUTES=======
214 * actual instant of the InstantHandler
216 Instant* actualInstant;
219 * Environment that's being handled
221 SomeEnvironment<P>* environment;
224 * concepts to change in the actual instant
226 std::vector<ConceptInstantHandler*> conceptsToChange;
229 * actual concept being manipulated
231 ConceptInstantHandler* actualConcept;
234 * if the actual concept has next
238 * if the actual concept has previous
243 * actual time of the reproduction
252 //====== PRIVATE METHODS=========
254 * Sets if the instant has next or not
259 * Sets if the instant has previous or not
262 void setHasPrevious();
264 * actualize the actual index of the concepts handled
266 void setConceptsToChange();
268 * resets all the next concepts to zero
270 void resetNextConcepts();
272 * Sets the next index of concepts to handled to the maximum value
274 void setNextConcepts();
276 * this method locates the new actual concept
277 * @param next, if has to locate the actual concept to the first concept that has next
278 * next=true, else search for the first concept that has previous
280 void toLocateActualConcept(bool next);
284 //include the implementation of the template
285 #include "InstantHandler_Txx.h"