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