]> Creatis software - creaEnvironment.git/blob - lib/kernel_Environment/ConceptInstantHandler.h
*** empty log message ***
[creaEnvironment.git] / lib / kernel_Environment / ConceptInstantHandler.h
1 /*=========================================================================
2
3   Program:  ConceptInstantHandler
4   Module:    $RCSfile: ConceptInstantHandler.h,v $
5   Language:  C++
6   Date:      $Date: 2008/11/24 10:23:53 $
7   Version:   $Revision: 1.6 $
8   Objective: Wrapper fo the concepts that subscribe to the instant handler
9   Authot:       Monica Maria Lozano Romero
10
11   Copyright: (c) 2007
12   License:
13
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.
17
18
19 =========================================================================*/
20
21 // SYSTEM INCLUDES
22 #include <iostream>
23 #include <map>
24 #include <vector>
25 #include <string>
26
27 // PROJECT INCLUDES
28
29
30
31 // LOCAL INCLUDES
32
33 // FORWARD REFERENCES
34
35
36
37 /*
38 *       COMMENT
39 *       @param
40 *       @return
41 */
42
43
44 #ifndef __CONCEPTINSTANTHANDLER_H_INCLUDED__
45 #define __CONCEPTINSTANTHANDLER_H_INCLUDED__
46
47
48 #if defined(_WIN32) 
49         #ifdef creaEnvironment_BUILD_SHARED
50                 #define creaEnvironment_EXPORTS __declspec( dllexport )
51         #else
52                 #define creaEnvironment_EXPORTS 
53         #endif
54 #else
55         #define creaEnvironment_EXPORTS
56 #endif
57
58
59 class creaEnvironment_EXPORTS ConceptInstantHandler
60         {
61                                 public:
62                                                 //===== CONSTANTS ========
63                                                 /*
64                                                 * if the concept is  being reproduced in real time
65                                                 */
66                                                 const static int REAL_TIME=1;
67                                                 /*
68                                                 * if the concept is being reproduced by doing
69                                                 * plus plus to its indexes
70                                                 */
71                                                 const static int PLUS_PLUS=2;
72
73                                                 
74                                                 //====== LIFECYCLE ========
75                                                 ConceptInstantHandler(std::string name,int mode,int positionInReproduction);
76                                                 ~ConceptInstantHandler();                                       
77                                                 //====== OPERATIONS =======
78                                                 /*
79                                                 * change the actual index by increasing
80                                                 * the index until the maximum by the increaseValue
81                                                 */
82                                                 void nextIndex();
83                                                 /*
84                                                 * change the actual index by decreasing
85                                                 * the index until zero  by the decreaseValue
86                                                 */
87                                                 void previousIndex();
88                                                 
89                                                 
90                                                 //====== INQUIRY =========
91                                                 /*
92                                                 *       @return name
93                                                 */
94                                                 std::string getName();
95                                                 /*
96                                                 *       @return PositionInReproduction
97                                                 */
98                                                 int getPosition();
99                                                 /*
100                                                 *       @return mode
101                                                 */
102                                                 int getMode();
103                                                 /*
104                                                 *       @return increaseValue
105                                                 */
106                                                 int getIncreaseValue();
107                                                         
108                                                 /*
109                                                 *       @return decreaseValue
110                                                 */
111                                                 int getDecreaseValue();
112                                                 
113                                                 /*
114                                                 * @return indexInInstant
115                                                 */
116                                                 int getIndexInInstant();
117                                                 /*
118                                                 *       @return actualIndex
119                                                 */
120                                                 int geActualIndex();
121                                                 /*
122                                                 *       @return maximumIndex
123                                                 */
124                                                 
125                                                 int getMaximumIndex();
126                                                 /*
127                                                 *       @return timeReproduction
128                                                 */
129                                                 double getTimeReproduction();
130                                                 /*
131                                                 *       @return scaleTime
132                                                 */
133                                                 double getScale();
134                                                 
135                                                 /*
136                                                 * if the actual index is not the maximum index
137                                                 */
138                                                 bool hasNextIndex();
139                                                 /*
140                                                 * if the actual index is not zero
141                                                 */
142                                                 bool hasPreviousIndex();
143                                         
144                                                 /*
145                                                 * Get initial time
146                                                 */
147                                                 double getInitialTime();
148
149
150                                                 //====== ACCESS ==========
151                                                 /*
152                                                 *       Sets the name of the concept
153                                                 *       @param name, new name
154                                                 */
155                                                 void setName(std::string name);
156                                                 /*
157                                                 *       Sets the position of the concept
158                                                 *       @param position
159                                                 */
160                                                 void setPosition(int position);
161                                                 /*
162                                                 *       Sets the mode of the concept
163                                                 *       @param mode, new mode= REAL_TIME or
164                                                 *       PLUS_PLUS
165                                                 */
166                                                 void setMode(int mode);
167                                                 /*
168                                                 *       Set Increase of the concept
169                                                 *       @param increaseValue
170                                                 */
171                                                 void setIncreaseValue(int increaseValue);
172
173                                                 /*
174                                                 *       Set decrease of the concept
175                                                 *       @param decreaseValue
176                                                 */
177                                                 void setDecreaseValue(int decreaseValue);
178
179                                                 /*
180                                                 *  Sets  the index of the concept in the instant
181                                                 *  @param indexInInstant
182                                                 */
183                                                 void setIndexInInstant(int indexInInstant);
184                                                 /*
185                                                 *  Sets  sets the maximum value
186                                                 *  @param maximumIndex
187                                                 */
188                                                 void setMaximumIndex(int maximumIndex);
189                                                 /*
190                                                 * set the actualIndex
191                                                 * @param index
192                                                 */
193                                                 void setActualIndex(int index);
194                                                 /*
195                                                 * set the timeReproduction
196                                                 * @param time
197                                                 */
198                                                 void setTimeReproduction(double time);
199                                                 /*
200                                                 * set the scaleTime
201                                                 * @param scale
202                                                 */
203                                                 void setScale(double scale);
204                                                 /*
205                                                 * set the actualTime
206                                                 * @param actualTime
207                                                 */
208                                                 void setActualTime(double actualTime);
209                                                 /*
210                                                 *       reset the initial time
211                                                 */
212                                                 void resetInitialTime();
213                                                 /*
214                                                 * Sets the initial time
215                                                 */
216                                                 void setInitialTime(double time);
217                                                 
218                                                 
219                                 private:
220                                         
221                                         //======= ATTRIBUTES=======
222                                         
223                                         /*
224                                         * Name of the concept
225                                         */
226                                         std::string name;
227                                         /*
228                                         *       Mode of changing the instant
229                                         *       REAL_TIME
230                                         *   PLUS_PLUS
231                                         */
232                                         int mode;
233                                         
234                                         /*
235                                         * position in the reproduction
236                                         */
237                                         int positionInReproduction;
238                                         /*
239                                         * Increment for an instant
240                                         * for default is 1
241                                         */
242                                         int increaseValue;
243                                         /*
244                                         * Decrease for an instant
245                                         * for default is 1
246                                         */
247                                         int decreaseValue;
248                                         /*
249                                         * index in Instant
250                                         */
251                                         int indexInInstant;
252                                         /*
253                                         * index that it is
254                                         */
255                                         int actualIndex;
256                                         /*
257                                         * maximum index that can have in the instant
258                                         */
259                                         int maximumIndex;
260                                         /*
261                                         * Time in miliseconds of the reproduction 
262                                         */
263                                         double timeReproduction;
264                                         /*
265                                         * Scale use for calculate the index
266                                         * of the concept according to the time of reproduction
267                                         * defined in timeReproduction
268                                         * scaleTime=maximumIndex/timeReproduction
269                                         */
270                                         double scaleTime;
271                                         /*
272                                         *       actual time of the reproduction
273                                         *       is in miliseconds
274                                         */
275                                         double actualTime;
276                                         /*
277                                         *       Initial time
278                                         *   is in miliseconds
279                                         */
280                                         double initialTime;
281
282
283
284                                         //====== PRIVATE METHODS=========
285                                         
286                                                         
287         };
288 #endif