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