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