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
cTypeFibSet.h
Go to the documentation of this file.
1 /**
2  * @class cTypeFibSet
3  * file name: cTypeFibSet.h
4  * @author Betti Oesterholz
5  * @date 04.12.2011
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents Fib set-element type.
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 basisclass of all Fib set-Element typs.
28  * Fib set-Element typs are typs of the elements in an set-element.
29  *
30  */
31 /*
32 History:
33 04.12.2011 Oesterholz created
34 12.02.2012 Oesterholz restoreXml*() without restoring domain possible
35 */
36 
37 #ifndef ___C_TYPE_FIB_SET_H__
38 #define ___C_TYPE_FIB_SET_H__
39 
40 
41 #include "version.h"
42 #include "fibDatatyps.h"
43 #include "cTypeElement.h"
44 
45 #include "vector"
46 
47 using std::vector;
48 
49 
50 namespace fib{
51 
52 
53 class cTypeFibSet: public cTypeElement{
54 private:
55  /**
56  * The number of the set-element domain for which this type stands.
57  */
59 
60 public:
61 
62  /**
63  * The constructor for set-element typs.
64  *
65  * @param uiInNumberOfDomain the number of the set-element domain
66  * for which this type stands
67  */
68  cTypeFibSet( const unsignedIntFib uiInNumberOfDomain = 0 );
69 
70  /**
71  * The copyconstructor for set-element typs.
72  *
73  * @param typeExternObject the type set-element to copy
74  */
75  cTypeFibSet( const cTypeFibSet &typeExternObject );
76 
77 
78  /**
79  * This Function returns for the type of the element an number.
80  * The values, which are returned, mean:
81  * - 1: cTypeDimension
82  * - 2: cTypeUnderArea
83  * - 3: cTypeUnderFunction
84  * - 5: cTypeInVar
85  * - 6: cTypeProperty
86  * - 10: cTypeVariable
87  * - 11: cTypeComments
88  * - 12: cTypeExtObject
89  * - 13: cTypeExtSubobject
90  * - 14: cTypeFibSet
91  * - 15: cTypeFibMatrix
92  * - 16: cTypeExtObjectInput
93  *
94  * @return for the type of the element an number
95  */
96  virtual unsignedIntFib getType() const;
97 
98  /**
99  * This method returns a pointer to a new instance of the standard
100  * domain for elements of this set-element type.
101  * You have to delete the returned object after usage.
102  *
103  * @return the standard domain for elements of this type
104  */
105  virtual cDomain * getStandardDomain( ) const;
106 
107  /**
108  * This method checks, if this element type is compatible with the
109  * given domain. Just domains which are compadible can be used for the
110  * elements of this type.
111  *
112  * @param domain the domain, which should be compatible
113  * @return true if the given domain is compatible, else false
114  */
115  virtual bool isCompatible( const cDomain &domain ) const;
116 
117  /**
118  * This method checks if the given type is equal to this type.
119  *
120  * @return true if the given type is equal to this type, else false
121  */
122  virtual bool operator==( const cTypeElement &typeElement ) const;
123 
124  /**
125  * This method clones this object.
126  *
127  * @return a clone of this object
128  */
129  virtual cTypeFibSet *clone() const;
130 
131  /**
132  * This method evaluades the size of the type element in bits in the
133  * compressed file form.
134  *
135  * @see store()
136  * @return the size of the type element in bits in the compressed form
137  */
138  virtual unsignedLongFib getCompressedSize() const;
139 
140  /**
141  * This method stores this type in the XML-format into the
142  * given stream.
143  *
144  * @param ostream the stream where domains should be stored to
145  * @param domain the domain which should be stored to this type;
146  * if a Nullpointer NULL (the standardvalue) is given, no domain
147  * will be stored to this type
148  * @return true if this type are stored, else false
149  */
150  virtual bool storeXml( ostream & ostream,
151  const cDomain * domain = NULL ) const;
152 
153  /**
154  * This method restores a type with a domain in the XML -format from an
155  * TinyXml element.
156  *
157  * @param pXmlNode a pointer to the TinyXml node wher the type is stored in
158  * @param outStatus an integer value with the errorvalue
159  * possible errorvalues are:
160  * - 0 loading successful
161  * - -1 loading error, invalid pXmlElement
162  * - -2 loading error, invalid data in pXmlElement
163  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
164  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
165  * object is wrong
166  * @param bRestoreDomain if true a domain is to be asumed in the type
167  * element and it will be restored, else no domain will be restores
168  * @return a pointer to the restored domain, or NULL if it couldn't be restored
169  */
170  virtual cDomain * restoreXmlWithDomain( const TiXmlElement * pXmlElement,
171  intFib & outStatus, const bool bRestoreDomain = true );
172 
173  /**
174  * This method stores this type element in the compressed Fib format
175  * into the given stream.
176  * It is needed because the stream can yust store byts but the size of
177  * Fib elements can be any number of bits. Because of that ther have to
178  * be a possibility to exchange the missing bits betwean the Fib elements.
179  *
180  * @see cFibElement::store
181  * @param stream the stream where this type element should be stored to
182  * @param cRestBits the not yet writen bits which should be stored
183  * @param uiRestBitPosition the number of bits in the cRestBits which
184  * should be writen respectively containing valid information
185  * @return true if the type element is stored, else false
186  */
187  virtual bool store( ostream & stream, char & cRestBits,
188  unsigned char & uiRestBitPosition ) const;
189 
190  /**
191  * This method restores a type from a bitstream, wher it is
192  * stored in the compressed Fib format.
193  *
194  * @see store
195  * @param iBitStream the stream where the type is stored in,
196  * because the stream is an cReadBits, any number of bits can be
197  * readed from it
198  * @return an integervalue with the errorvalue
199  * possible errorvalues are:
200  * - 0 loading successful
201  * - -1 loading error, invalid pXmlElement
202  * - -2 loading error, invalid data in pXmlElement
203  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
204  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
205  * object is wrong
206  */
207  virtual intFib restore( cReadBits & iBitStream );
208 
209  /**
210  * @return the number of the domain for which this type stands
211  * @see uiNumberOfDomain
212  */
214 
215 };//end class cTypeFibSet
216 
217 
218 }//end namespace fib
219 
220 #endif //___C_TYPE_FIB_SET_H__