]> Creatis software - creaEnvironment.git/blob - lib/kernel_Environment/InstantPlayer.h
License Files Headers
[creaEnvironment.git] / lib / kernel_Environment / InstantPlayer.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:  InstantPlayer
30   Module:    $RCSfile: InstantPlayer.h,v $
31   Language:  C++
32   Date:      $Date: 2012/11/15 12:12:26 $
33   Version:   $Revision: 1.2 $
34   Objective: it do the play methods as stop,pause, play, etc using an instant handler
35   Authot:       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 //      MACRO
48 #ifndef __INSTANTPLAYER_H_INCLUDED__    
49 #define __INSTANTPLAYER_H_INCLUDED__    
50
51 // SYSTEM INCLUDES
52
53
54
55 // PROJECT INCLUDES
56
57 #include "InstantHandler.h"
58 #include "ViewerNDimensionsException.h"
59
60
61 // LOCAL INCLUDES
62
63 // FORWARD REFERENCES
64
65
66
67 /*
68 *       COMMENT
69 *       @param
70 *       @return
71 */
72
73 template <class S>
74 class InstantPlayer
75         {
76
77                 public:
78                         //====== CONSTANTS =======
79                         const static int REAL_TIME=1;
80                         const static int PLUS_PLUS=2;
81
82                         //========= LYFECYCLE ==========
83                         InstantPlayer(SomeEnvironment<S>* environment)throw (ViewerNDimensionsException);
84                         ~InstantPlayer();
85                         
86                         
87                         //========= OPERATIONS =========
88                         /*
89                         *       When the user wants to play  the dimensions selected by the user
90                         *       and are already defined
91                         *       @return 
92                         */
93                         //void play();
94                         /*
95                         *       Paused the reproduction of the dimension played
96                         *       @return
97                         */
98                         void pause();
99                         /*
100                         *       Used for change to the next instant in the reproduction
101                         *       Note: next instant from the instant that's being reproduced
102                         *       @param loop , if want to do next instant with looping
103                         *       @return true if the player has changed of instant, false if not
104                         */
105
106                         bool nextInstant(bool loop=false)throw (ViewerNDimensionsException);
107                         /*
108                         *       Used for change to the previous instant in the reproduction
109                         *       Note: previous instant from the instant that's being reproduced
110                         *       @return true if the player has changed of instant, false if not
111                         */
112
113                         bool previousInstant()throw (ViewerNDimensionsException);
114                         /*
115                         *       Used for stops the reproduction
116                         *       POSTCONDITION
117                         *   in the index value in the index of the dimensin in the actual Instant
118                         *       is now 0
119                         *       @return
120                         */
121                          void stop();
122                         /*
123                         * Removes all the concepts handled
124                         */
125                          void removeAllConcepts();
126                         
127                          /*
128                          *      Removes the concept with the name given
129                          *      @param nameConcept, name of the concept to remove
130                          */
131                          void removeConceptToHandled(std::string nameConcept);
132
133                          //====== INQUIRY ========
134                          /*
135                          *      Returns the things of the actual instant
136                          */
137                         std::vector<S*>* getThingsOfInstant()throw (ViewerNDimensionsException);
138                          /*
139                          * return the actual instant in the instant handler
140                          */
141                          Instant* getActualInstant()throw (ViewerNDimensionsException);
142                          /*
143                          *       add new concept to handled 
144                          *       @param nameConcept
145                          *       @param mode= REAL_TIME,PLUS_PLUS
146                          *       @param position, position in the player
147                          */
148                          bool addConceptToHandled(std::string nameConcept,int mode,int position)throw (ViewerNDimensionsException);
149                          /*
150                          *  Returns the things of the actual instant and its names in the 
151                          *      environment
152                          */
153                          void getThingsWithName(std::vector<std::string>& names,std::vector< S* >& thingsVector)throw (ViewerNDimensionsException);
154                          /*
155                         * Returns the names of the concepts handled and its modes
156                         * DEPRECATED
157                         */
158                         void getConceptsInfo(std::vector<std::string>& namesConcepts,std::vector<int>& modes);
159                          /*
160                          *      Returns the name of the concept that handled the real time
161                          *      DEPRECATED
162                          */
163                          void getTimeConcept(std::string& nameConcept);
164                          /*
165                          * get the number of instants that is playing
166                          */
167                          int getNumInstantsPlaying();
168
169                           /*
170                          *      Returns the names of the concept with its respectively actual value
171                          *      @param conceptsAndIndexes is where is going to be save the data searched
172                          */
173                          void getConceptsActualIndexes(std::map<std::string,int>* conceptsAndIndexes)throw (ViewerNDimensionsException);
174                          
175                          //========= ACCESS =========
176                         /*
177                          * Sets the time of reproduction of the concept 
178                          * that managed the real time
179                          * @param time, is in milliseconds
180                          */
181                          void setTimeReproduction(double time);
182                          /*
183                          *      Sets the environment
184                          */
185                          void setEnvironment(SomeEnvironment<S>* environmment);
186                          /*
187                          *      Set Actual Instant
188                          */
189                          void setActualInstant(Instant* actualInstant);
190                          /*
191                          *      Set Actual Instant
192                          */
193                          void setActualInstant(std::vector<int>* actualInstant);
194                          /*
195                         * Set the increase Value for changing the instant
196                         */
197                         void setIncreaseValue(int increase);
198                         /*
199                         * Set the decrease Value for changing the instant
200                         */
201                         void setDecreaseValue(int decrease);
202
203                          /*
204                          * Set the mode of a concept that's being handled
205                          *      DEPRECATED
206                          */
207                          //void setModeOfConcept(std::string nameConcept,int mode);
208                          /*
209                          * Set actual time to the instant handler
210                          * DEPRECATED
211                          */
212                          //void setActualTime(double actualTime);
213                          /*
214                          * set the modes of the concept that handled the time
215                          * to the plus plus mode or real time mode
216                          * DEPRECATED
217                          */
218                         // void setTimeConceptToMode(int mode);
219                         
220
221
222         private:
223                 
224                         /*
225                         *        environment
226                         */
227
228                         SomeEnvironment < S >* environment;
229
230                         /*
231                         * The instant handler
232                         */
233                         InstantHandler < S > * instantHandler;
234
235                         /*
236                         * time reproduction
237                         * IS IN MILISECONDS
238                         */
239                         //double timeReproduction;
240
241                         /*
242                         * things of instant
243                         */
244                         //std::vector<S*>* thingsOfInstant;
245                         
246
247                 
248         };
249 //include the implementation of the template
250 #include "InstantPlayer_Txx.h"
251 #endif
252
253
254