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
cTypeArea.h
Go to the documentation of this file.
1 /**
2  * @class cTypeArea
3  * file name: cTypeArea.h
4  * @author Betti Oesterholz
5  * @date 12.02.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents a Fib area type.
11  *
12  * Copyright (C) @c LGPL3 2010 Betti Oesterholz
13  *
14  * This program is free software: you can redistribute it and/or modify
15  * it under the terms of the GNU Lesser General Public License (LGPL) as
16  * published by the Free Software Foundation, either version 3 of the
17  * License, or any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with this program. If not, see <http://www.gnu.org/licenses/>.
26  *
27  *
28  * This file contains the class for typs of Fib areas.
29  * Fib area type are typs for the Fib area elements (cArea).
30  *
31  */
32 /*
33 History:
34 12.02.2010 Oesterholz created
35 25.08.2011 Oesterholz underarea to subarea
36 02.01.2012 Oesterholz subarea to area
37 12.02.2012 Oesterholz restoreXml*() without restoring domain possible
38 */
39 
40 #ifndef ___C_TYPE_AREA_H__
41 #define ___C_TYPE_AREA_H__
42 
43 
44 #include "cTypeElement.h"
45 
46 
47 namespace fib{
48 
49 
50 class cTypeArea: public cTypeElement{
51 
52 public:
53  /**
54  * Standardconstructor for the area type.
55  */
56  cTypeArea();
57 
58  /**
59  * This Function returns for the type of the element an number.
60  * The values, which are returned, mean:
61  * - 1: cTypeDimension
62  * - 2: cTypeArea
63  * - 3: cTypeUnderFunction
64  * - 5: cTypeInVar
65  * - 6: cTypeProperty
66  * - 10: cTypeVariable
67  * - 11: cTypeComments
68  * - 12: cTypeExternObject
69  * - 13: cTypeExtSubobject
70  * - 14: cTypeFibSet
71  * - 15: cTypeFibMatrix
72  *
73  * @return for the type of the element an number
74  */
75  virtual unsignedIntFib getType() const;
76 
77 
78  /**
79  * This method checks, if this element type is compatible with the
80  * given domain. Just domains which are compadible can be used for the
81  * elements of this type.
82  *
83  * @param domain the domain, which should be compatible
84  * @return true if the given domain is compatible, else false
85  */
86  virtual bool isCompatible( const cDomain &domain ) const;
87 
88  /**
89  * This Method returns a pointer to a new instance of the standart
90  * domain for elements of this type.
91  * You have to delete the returned object after usage.
92  *
93  * @return the standart domain for elements of this type
94  */
95  virtual cDomain *getStandardDomain( ) const;
96 
97  /**
98  * This Method clones this object.
99  *
100  * @return a clone of this object
101  */
102  virtual cTypeArea *clone() const;
103 
104  /**
105  * This method evaluades the size of the typeelement in bits in the
106  * compressed file form.
107  *
108  * @see store()
109  * @return the size of the typeelement in bits in the compressed form
110  */
111  virtual unsignedLongFib getCompressedSize() const;
112 
113  /**
114  * This method stores this type in the XML -format into the
115  * given stream.
116  *
117  * @param ostream the stream where domains should be stored to
118  * @param domain the domain which should be stored to this type;
119  * if a Nullpointer NULL (the standardvalue) is given, no domain
120  * will be stored to this type
121  * @return true if this type are stored, else false
122  */
123  virtual bool storeXml( ostream & ostream,
124  const cDomain * domain = NULL ) const;
125 
126  /**
127  * This method restores a type with a domain in the XML -format from an
128  * TinyXml element.
129  *
130  * @param pXmlNode a pointer to the TinyXml node wher the type is stored in
131  * @param outStatus an integer value with the errorvalue
132  * possible errorvalues are:
133  * - 0 loading successful
134  * - -1 loading error, invalid pXmlElement
135  * - -2 loading error, invalid data in pXmlElement
136  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
137  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
138  * object is wrong
139  * @param bRestoreDomain if true a domain is to be asumed in the type
140  * element and it will be restored, else no domain will be restores
141  * @return a pointer to the restored domain, or NULL if it couldn't be restored
142  */
143  virtual cDomain * restoreXmlWithDomain( const TiXmlElement * pXmlElement,
144  intFib & outStatus, const bool bRestoreDomain = true );
145 
146  /**
147  * This method stores this typeelement in the compressed Fib-format
148  * into the given stream.
149  * It is needed because the stream can yust store byts but the size of
150  * Fib-elements can be any number of bits. Because of that ther have to
151  * be a possibility to exchange the missing bits betwean the Fib-elements.
152  *
153  * @see cFibElement::store
154  * @param stream the stream where this typeelement should be stored to
155  * @param cRestBits the not yet writen bits which should be stored
156  * @param uiRestBitPosition the number of bits in the cRestBits which
157  * should be writen respectively containing valid information
158  * @return true if the typeelement is stored, else false
159  */
160  virtual bool store( ostream & stream, char & cRestBits,
161  unsigned char & uiRestBitPosition ) const;
162 
163  /**
164  * This method restores a type from a bitstream, wher it is
165  * stored in the compressed Fib-format.
166  *
167  * @see store
168  * @param iBitStream the stream where the type is stored in,
169  * because the stream is an cReadBits, any number of bits can be
170  * readed from it
171  * @return an integervalue with the errorvalue
172  * possible errorvalues are:
173  * - 0 loading successful
174  * - -1 loading error, invalid pXmlElement
175  * - -2 loading error, invalid data in pXmlElement
176  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
177  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
178  * object is wrong
179  */
180  virtual intFib restore( cReadBits & iBitStream );
181 
182 
183 };//end class cTypeArea
184 
185 
186 }//end namespace fib
187 
188 #endif //___C_TYPE_AREA_H__