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