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