The Fib multimedia system
Fib is a system for storing multimedia data (like images or films).
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cVectorArea.h
Go to the documentation of this file.
1 /**
2  * @class cVectorArea
3  * file name: cVectorArea.h
4  * @author Betti Oesterholz
5  * @date 13.02.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents a basic Fib-vector.
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 of all Fib-subareavectors.
28  * Thes subareavectors are used in Fib areaelements, for the subarea of
29  * the point.
30  * The lowerbound of the subarea is allways the first element of the
31  * vector and the upperbound the second, even if the first value is
32  * greater then the second.
33  *
34  */
35 /*
36 History:
37 13.02.2010 Oesterholz created
38 25.08.2011 Oesterholz underarea to subarea
39 02.01.2012 Oesterholz changes for cTypeArea and cFibMatrix
40 */
41 
42 #ifndef ___C_VECTOR_AREA_H__
43 #define ___C_VECTOR_AREA_H__
44 
45 
46 #include "version.h"
47 #include "fibDatatyps.h"
48 
49 #include "cFibVector.h"
50 
51 using std::vector;
52 
53 
54 namespace fib{
55 
56 
57 class cVectorArea: public cFibVector{
58 
59 public:
60 
61 
62  /**
63  * The constructor of the subareavector.
64  *
65  * @param pInDefiningElement the Fib-element which
66  * defines/ uses the checksum -property -vector
67  */
68  cVectorArea( cFibElement * pInDefiningElement = NULL );
69 
70  /**
71  * The copy constructor of the vector.
72  *
73  * @param vector the vector from which to copy the data
74  * @param pInDefiningElement the Fib-element which defines/ uses
75  * the new vector
76  */
77  cVectorArea( const cVectorArea & vector,
78  cFibElement * pInDefiningElement = NULL );
79 
80  /**
81  * parameterconstructor
82  *
83  * @param lLowerBound the lower bound value to set
84  * @param lUpperBound the upper bound value to set
85  * @param pInDefiningElement the Fib-element which defines/ uses
86  * the new vector
87  */
88  cVectorArea( longFib lLowerBound, longFib lUpperBound,
89  cFibElement * pInDefiningElement = NULL );
90 
91  /**
92  * parameterconstructor
93  *
94  * @param lLowerBound the lower bound value to set
95  * @param pVariableUpperBound the upper bound variable to set
96  * @param pInDefiningElement the Fib-element which defines/ uses
97  * the new vector
98  */
99  cVectorArea( longFib lLowerBound, cFibVariable * pVariableUpperBound,
100  cFibElement * pInDefiningElement = NULL );
101 
102  /**
103  * parameterconstructor
104  *
105  * @param pVariableLowerBound the lower bound variable to set
106  * @param lUpperBound the upper bound value to set
107  * @param pInDefiningElement the Fib-element which defines/ uses
108  * the new vector
109  */
110  cVectorArea( cFibVariable * pVariableLowerBound, longFib lUpperBound,
111  cFibElement * pInDefiningElement = NULL );
112 
113  /**
114  * parameterconstructor
115  *
116  * @param pVariableLowerBound the lower bound variable to set
117  * @param pVariableUpperBound the upper bound variable to set
118  * @param pInDefiningElement the Fib-element which defines/ uses
119  * the new vector
120  */
121  cVectorArea( cFibVariable * pVariableLowerBound, cFibVariable * pVariableUpperBound,
122  cFibElement * pInDefiningElement = NULL );
123 
124 
125  /**
126  * The constructor for restoring a vector from an TinyXml element.
127  *
128  * @param pXmlNode a pointer to the TinyXml node the vector is stored in
129  * @param outStatus An reference to an integervalue where the errorvalue
130  * can be stored to.
131  * possible errorvalues are:
132  * - 0 loading successful
133  * - -1 loading error, invalid pXmlElement
134  * - -2 loading error, invalid data in pXmlElement
135  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
136  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
137  * object is wrong
138  * @param liDefinedVariables a list with the defined variables for the
139  * to restore vector, every variable should have it's number
140  * (the number under which it is stored) as it's value
141  */
142  cVectorArea( const TiXmlElement * pXmlElement, intFib & outStatus,
143  list<cFibVariable*> & liDefinedVariables );
144 
145  /**
146  * This constructor restores a subareasvector from the stream where it is
147  * stored in the compressed fib -format.
148  *
149  * @param iBitStream the stream where this vector is stored to in,
150  * because this stream is an cReadBits, any number of bits can be
151  * readed from it
152  * @param outStatus An reference to an integervalue where the errorvalue
153  * can be stored to. If the pointer is NULL no errorvalue will be
154  * given back.
155  * possible errorvalues are:
156  * - 0 loading successful
157  * - -1 loading error, invalid stream
158  * - -2 loading error, invalid data in stream
159  * - 1 loading warning, invalid data in stream, error could be corrected
160  * - 2 loading warning, invalid data in stream, maybe the loaded
161  * object is wrong
162  * @param liDefinedVariables a list with the defined variables for the
163  * to restore vector, every variable should have it's number
164  * (the number under which it is stored) as it's value
165  * @param pInVectorDomain the domain for this vector
166  * @param pInDomainVariable the domain for variables
167  */
168  cVectorArea( cReadBits & iBitStream, intFib & outStatus,
169  list<cFibVariable*> & liDefinedVariables,
170  const cDomain * pInVectorDomain, const cDomain * pInDomainVariable );
171 
172 
173 //TODO change cFibElement to cPoint
174  /**
175  * This method creates an instance of this vector type.
176  *
177  * @param iNumberOfElements number of elements in the vector (this will
178  * be ignored for the subareavector)
179  * @param definingAreaElement the Fib-areaelement which defines/ uses
180  * the subareasvector
181  */
182  virtual cVectorArea * createInstance(
183  unsignedIntFib iNumberOfElements=2,
184  cFibElement *definingAreaElement=NULL ) const;
185 
186  /**
187  * Sets the Fib-element which defines/ uses this vector.
188  * If the given pointer is the nullpointer (standardvalue), no
189  * Fib-element defines this vector.
190  *
191  * @param pInDefiningElement a pointer to the Fib-element which
192  * defines/ uses this vector
193  * @param bCheckDomains getthe domains of the defining element and
194  * check the vectorelements with it
195  */
196  virtual void setDefiningFibElement( cFibElement *fibElement=NULL,
197  bool bCheckDomains=true );
198 
199  /**
200  * Returns the type of the vector.
201  * You have to delete the returned object after usage.
202  *
203  * @return the type of the vector
204  */
205  virtual cTypeElement * getElementType() const;
206 
207  /**
208  * Returns a reference to the domain of the vector or
209  * the nullpointer NULL if no domain is defined for the vector.
210  * If the nullpointer NULL is returned the standarddomain is valid for the
211  * vector.
212  *
213  * @return a reference to the vectordomain of the vector
214  */
215  virtual cDomainVectorBasis * getDomain() const;
216 
217  /**
218  * Returns a reference to the standard domain of the vector.
219  * You have to delete the returned object after usage.
220  *
221  * @return a reference to the standard domain of the vector
222  */
223  virtual cDomainVectorBasis * getStandardDomain() const;
224 
225  /**
226  * Returns a reference to the value domain of the vector or
227  * the nullpointer NULL if no value domain is defined for the vector.
228  * If the nullpointer NULL is returned the standarddomain is valid for the
229  * vector.
230  *
231  * @return a reference to the definitionarea of the vector
232  */
233  virtual cDomainVectorBasis * getValueDomain() const;
234 
235  /**
236  * @return the name for the type of the vector
237  */
238  virtual string getVectorType() const;
239 
240 
241 //subarea methods
242  /**
243  * @return the lower bound of the subarea
244  */
245  longFib getLowerBound() const;
246 
247  /**
248  * @return the upper bound of the subarea
249  */
250  longFib getUpperBound() const;
251 
252  /**
253  * @return all values which are in the subarea
254  */
255  list<longFib> getAreaValues() const;
256 
257  /**
258  * This method sets the lower bound of the subarea to the given value.
259  *
260  * @param lValue the lower bound to set
261  * @return true if the lower bound is set to the given value lValue,
262  * else false
263  */
264  bool setLowerBoundValue( longFib lValue );
265 
266  /**
267  * This method sets the upper bound of the subarea to the given value.
268  *
269  * @param lValue the upper bound to set
270  * @return true if the upper bound is set to the given value lValue,
271  * else false
272  */
273  bool setUpperBoundValue( longFib lValue );
274 
275  /**
276  * This method sets the lower bound of the subarea to the given variable.
277  *
278  * @param pVariable the lower bound variable to set
279  * @return true if the lower bound is set to the given variable
280  * pVariable, else false
281  */
282  bool setLowerBoundVariable( cFibVariable *pVariable );
283 
284  /**
285  * This method sets the upper bound of the subarea to the given variable.
286  *
287  * @param pVariable the upper bound variable to set
288  * @return true if the upper bound is set to the given variable
289  * pVariable, else false
290  */
291  bool setUpperBoundVariable( cFibVariable *pVariable );
292 
293  /**
294  * This Method makes this vectorelements equal to the correspondending
295  * vectorelements of the given vector.
296  * The type of the vector and the number of elements won't be changed.
297  *
298  * @param vector the vector to copy
299  */
300  virtual cVectorArea & operator=( const cFibVector &vector );
301 
302 };//end class cVectorArea
303 
304 
305 }//end namespace fib
306 
307 #endif