]> Creatis software - creaEnvironment.git/blob - lib/kernel_Environment/SomeThing.h
License Files Headers
[creaEnvironment.git] / lib / kernel_Environment / SomeThing.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 //      MACRO
28
29 #ifndef __SOMETHING_H_INCLUDED__
30 #define  __SOMETHING_H_INCLUDED__
31
32 // SYSTEM INCLUDES
33
34 // PROJECT INCLUDES
35
36 #include <vector>
37 #include <iostream>
38
39 // LOCAL INCLUDES
40 #include "Instant.h"
41
42
43 // FORWARD REFERENCES
44
45 /*
46 *       COMMENT
47 *       @param
48 *       @return
49 */
50
51
52
53
54 template <class U>
55 class SomeThing
56                 {
57                                 public:
58                                         
59
60                                         //====== LIFECYCLE ========
61                                         
62                                         SomeThing(std::string name);
63                                                 
64                                         
65                                         ~SomeThing();
66                                                 
67                                         
68
69                                         //====== OPERATIONS =======
70                                         
71                                         /*
72                                         *       Add a new instant to the thing
73                                         *       @param instant: new instant
74                                         */
75                                         
76                                         bool addInstant(Instant* instant);
77                                         
78
79                                         //====== INQUIRY =========
80                                         /*
81                                         *       Get the thing stored
82                                         *       @return thing
83                                         */
84                                         
85                                         U* getThing();
86                                                 
87                                         /*
88                                         *       Get the name of the thing
89                                         *       @return nameThing
90                                         */
91                                         
92                                         std::string getName();
93                                                 
94                                         /*
95                                         *       Get all the instants
96                                         *       @return instants
97                                         */
98                                         
99                                         std::vector<Instant*>* getInstants();
100                                                 
101                                         /*
102                                         *       Get the instant that's in the index given
103                                         *       @param indexInstant: index of the instant that they want
104                                         *       @return instants[instantIndex]
105                                         */
106                                         
107                                         Instant* getInstant(int indexInstant);
108                                                 
109                                         /*
110                                         *       Get the number of instants that the 
111                                         *       thng has.
112                                         *       @return instants.size()
113                                         */
114                                 
115                                         int  getNumberInstants();
116                                                 
117                                         /*
118                                         *  if this is in the instant given
119                                         *  @param instant: instant to verified if this has it
120                                         *  @return  0<=i<numberOfInstants if this has the instant, -1 otherwise
121                                         */
122                                 
123                                         int hasInstant(Instant* instant);
124                                                 
125                                         //====== ACCESS ==========
126                                         /*
127                                         *       Set the thing
128                                         *       @param U* thing
129                                         */
130                                 
131                                         void setThing(U thing);
132                                                 
133                                         /*
134                                         *       Set the name of the thing
135                                         *       @param nameThing
136                                         */
137                                         
138                                         void setName(std::string name);
139                                                 
140                                         /*
141                                         *       Set the instants of the thing
142                                         *       @param instants
143                                         */
144                                         
145                                         void setInstants(std::vector<Instant*> instants);
146                                                 
147                                         /*
148                                         *       Remove an instant from the thing
149                                         *       @param indexInstant: index of the instant to be removed
150                                         *       @return true if succesful , false otherwise
151                                         */
152                                 
153                                         bool removeInstant(int indexInstant);
154                                                 
155                                         /*
156                                         *       Remove an instant from the thing
157                                         *       @param instant: instant to be deleted
158                                         *       @return true if succesful , false otherwise
159                                         */
160                                 
161                                         bool removeInstant(Instant* instant);
162                                                 
163
164                                 private:
165                                         
166                                         //======= ATTRIBUTES=======
167                                         /*
168                                         *       name of the something
169                                         *       WARNING 
170                                         *       has to be different from the
171                                         *   other existing somethings in the program 
172                                         *       using the handler
173                                         */
174                                         std::string nameThing;
175                                         /*
176                                         *       the thing that we are handling
177                                         *       it could be any object
178                                         */
179                                         U thing;
180                                         /*
181                                         *       instants that the thing
182                                         *       has defined
183                                         */
184                                         std::vector<Instant*> instantsVector;
185                                         
186         };
187 //include the implementation of the template
188 #include "SomeThing_Txx.h"
189 #endif
190
191
192