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