The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
cFibVariable.h
Go to the documentation of this file.
1
/**
2
* @class cFibVariable
3
* file name: cFibVariable.h
4
* @author Betti Oesterholz
5
* @date 02.05.2009
6
* @mail webmaster@BioKom.info
7
*
8
* System: C++
9
*
10
* This class represents a Fib -variable.
11
* Copyright (C) @c LGPL3 2009 Betti Oesterholz
12
*
13
* This program is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU Lesser General Public License (LGPL) as
15
* published by the Free Software Foundation, either version 3 of the
16
* License, or any later version.
17
*
18
* This program is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU Lesser General Public License for more details.
22
*
23
* You should have received a copy of the GNU Lesser General Public License
24
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25
*
26
*
27
* This file contains the class for Fib -variables. Just Fib -elements
28
* can create Fib -variables. A variable contains a value or is undefined.
29
*/
30
/*
31
History:
32
17.04.2009 Oesterholz created
33
17.04.2009 Oesterholz cExtObjects as friend class added
34
19.10.2011 Oesterholz FEATURE_EQUAL_FIB_OBJECT implemented
35
03.01.2012 Oesterholz cVectorFibSet and cVectorFibMatrix as friends added
36
29.01.2012 Oesterholz cVectorExtObject and cVectorExtSubobject as friends added
37
*/
38
39
#ifndef ___C_FIB_VARIABLE_H__
40
#define ___C_FIB_VARIABLE_H__
41
42
#include "version.h"
43
#include "
fibDatatyps.h
"
44
#include "
iVariableUser.h
"
45
46
#include <set>
47
#include <map>
48
49
using
std::set;
50
using
std::map;
51
52
53
namespace
fib{
54
55
class
cFibElement
;
//cyclic dependencie
56
class
cRoot
;
//cyclic dependencie
57
class
cArea
;
//cyclic dependencie
58
class
cFunction
;
//cyclic dependencie
59
class
cFibVector
;
//cyclic dependencie
60
class
cFunctionVariable
;
//cyclic dependencie
61
62
class
cFibVariable
{
63
64
//TODO friend class cFunction
65
66
friend
class
cRoot
;
67
friend
class
cArea
;
68
friend
class
cFunction
;
69
friend
class
cExtObject
;
70
friend
class
cExtSubobject
;
71
friend
class
cFibVector
;
72
friend
class
cVectorFibSet
;
73
friend
class
cVectorFibMatrix
;
74
friend
class
cVectorExtObject
;
75
friend
class
cVectorExtSubobject
;
76
friend
class
cFunctionVariable
;
77
78
79
#ifndef TEST
80
protected
:
81
#else
82
public
:
//make the following constructor and methods public for the test
83
#endif
84
/**
85
* the type fore the type of the variable
86
*/
87
enum
eVariableType
{
88
UNDEFINED
,
89
REAL_VALUE
,
90
INTEGER_VALUE
91
};
92
/**
93
* the type of the variable
94
*/
95
eVariableType
variableType
;
96
97
/**
98
* the value if the variable is of type real
99
*/
100
doubleFib
doubleValue
;
101
102
/**
103
* the value if the variable is of type integer
104
*/
105
longFib
integerValue
;
106
107
/**
108
* the refernce to the Fib -element that defines the variable
109
*/
110
cFibElement
*
pDefiningFibElement
;
111
112
/**
113
* the set with the refernces to the Fib -elements that uses the
114
* variable
115
*/
116
set<iVariableUser*>
setUsingElements
;
117
118
119
120
public
:
121
122
/**
123
* The constructor of the variable.
124
*
125
* @param definingFibElement the Fib -element that defines the variable
126
*/
127
cFibVariable
(
cFibElement
*definingFibElement );
128
129
/**
130
* The copyconstructor of the variable.
131
*
132
* @param variable the Fib -element that should be copied
133
* @param definingFibElement the Fib -element that defines the variable
134
*/
135
cFibVariable
(
const
cFibVariable
& variable,
136
cFibElement
*definingFibElement = NULL );
137
138
/**
139
* The destructor of the variable.
140
*/
141
virtual
~cFibVariable
();
142
143
144
/**
145
* This method returns the value of the variable as an real value.
146
* It returns 0 if the variable is undefined.
147
*
148
* @return the value of the variable or 0 if the variable is undefined
149
*/
150
doubleFib
getValue
()
const
;
151
152
/**
153
* This method returns the value of the variable as an integer value.
154
* It returns 0 if the variable is undefined. If the value of the
155
* variable is an real value, the value is rounded to an integervalue.
156
*
157
* @return the value of the variable or 0 if the variable is undefined
158
*/
159
longFib
getIntegerValue
()
const
;
160
161
/**
162
* This method sets the value of the variable as an real value.
163
*
164
* @param dValue the value of the variable to set
165
*/
166
void
setValue
(
const
doubleFib
dValue );
167
168
/**
169
* This method sets the value of the variable as an integer value.
170
*
171
* @param lValue the value of the variable to set
172
*/
173
void
setIntegerValue
(
const
longFib
lValue );
174
175
/**
176
* This method returns a pointer to the Fib -element that defines the
177
* variable.
178
*
179
* @return a pointer to the Fib -element that defines the variable
180
*/
181
cFibElement
*
getDefiningElement
()
const
;
182
183
/**
184
* This method returns the number of Fib -elements that uses the
185
* variable. These have to be registered befor.
186
*
187
* @return the number of Fib -elements that uses the variable
188
*/
189
unsignedIntFib
getNumberOfUsingElements
()
const
;
190
191
/**
192
* This method returns a set of Fib -elements that uses the variable.
193
* These have to be registered befor.
194
*
195
* @return a set Fib -elements that uses the variable
196
*/
197
set<cFibElement*>
getUsingElements
()
const
;
198
199
/**
200
* @return if the value of the variable was set true is returned, else false
201
*/
202
bool
isSet
()
const
;
203
204
/**
205
* @return if the value is an integer value true, else false
206
*/
207
bool
isIntegerValue
()
const
;
208
209
210
#ifdef FEATURE_EQUAL_FIB_OBJECT
211
212
/**
213
* This Method checks if the given variable is equal to this variable.
214
*
215
* @param variable the variable to compare with this variable
216
* @param bCheckExternalObjects if true the external objects of
217
* cExtObject will be compared
218
* @return true if the given variable is equal to this variable, else false
219
*/
220
virtual
bool
equal
(
const
cFibVariable
&variable,
221
const
bool
bCheckExternalObjects=
true
)
const
;
222
223
#else //FEATURE_EQUAL_FIB_OBJECT
224
225
/**
226
* This Method checks if the given variable is equal to this variable.
227
*
228
* @param variable the variable to compare with this variable
229
* @return true if the given variable is equal to this variable, else false
230
*/
231
virtual
bool
equal
(
const
cFibVariable
&variable )
const
;
232
233
#endif//FEATURE_EQUAL_FIB_OBJECT
234
235
/**
236
* This Method checks if the given variable is equal to this variable.
237
*
238
* @param variable the variable to compare with this variable
239
* @return true if the given variable is equal to this variable, else false
240
*/
241
virtual
bool
operator==
(
const
cFibVariable
&variable )
const
;
242
243
/**
244
* This Method makes this variable equal to the given variable.
245
*
246
* @param variable the variable to copy
247
*/
248
virtual
cFibVariable
&
operator=
(
const
cFibVariable
&variable );
249
250
251
#ifndef TEST
252
protected
:
253
#else
254
public
:
//make the following constructor and methods public for the test
255
#endif
256
/**
257
* This method registers an element that uses the variable.
258
*
259
* @param usingElement the element that uses the variable
260
*/
261
void
registerUsingElement
(
iVariableUser
* usingElement );
262
263
/**
264
* This method unregisters an element that don't uses the variable
265
* anymore.
266
*
267
* @param usingElement the element that don't uses the variable
268
* anymore
269
*/
270
void
unregisterUsingElement
(
iVariableUser
* usingElement );
271
272
273
#ifdef FEATURE_EQUAL_FIB_OBJECT
274
275
/**
276
* This Method checks if the given variable is equal to this variable.
277
*
278
* @param variable the variable to compare with this variable
279
* @param mapEqualRootObjects the root objects of this object that wher
280
* already checked as equal
281
* map entries:
282
* key: the root-element of this Fib object that was checked
283
* value: the to the key correspondending root-element of the
284
* fibObject that was checked and which is equal to the key
285
* root-element
286
* (it is empty if bCheckExternalObjects == false)
287
* @param mapEqualDefinedVariables the Fib elements that defines
288
* variables and are equal;
289
* map entries:
290
* key: the Fib element of this Fib object that was checked
291
* value: the to the key correspondending Fib element of the
292
* fibObject that was checked and which sets its defined
293
* variables to the same values as the key Fib element
294
* @param bCheckExternalObjects if true the external objects of
295
* cExtObject will be compared
296
* @return true if the given variable is equal to this variable, else false
297
*/
298
virtual
bool
equalInternal(
const
cFibVariable
&variable,
299
map< const cRoot *, const cRoot * > & mapEqualRootObjects,
300
map< const cFibElement *, const cFibElement * > & mapEqualDefinedVariables,
301
const
bool
bCheckExternalObjects )
const
;
302
303
#endif //FEATURE_EQUAL_FIB_OBJECT
304
305
};
//end class cFibVariable
306
307
308
}
//end namespace fib
309
310
#endif
311
fib
incl
cFibVariable.h
Generated on Thu Feb 14 2013 14:06:56 for The Fib multimedia system by
1.8.1