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