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