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