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
cFunctionExp.h
Go to the documentation of this file.
1 /**
2  * @class cFunctionExp
3  * file name: cFunctionExp.h
4  * @author Betti Oesterholz
5  * @date 08.05.2010
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents a Fib -function for exponent.
11  * Copyright (C) @c LGPL3 2010 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 class represents a Fib -function for exponent.
28  * This function works on two underfunctions. The first underfunction is
29  * the basis and the second the exponent.
30  * (underfunction1 ^ underfunction2 = pow( underfunction1, underfunction2) )
31  *
32  */
33 /*
34 History:
35 08.05.2010 Oesterholz created
36 */
37 
38 #ifndef ___C_FUNCTION_EXP_H__
39 #define ___C_FUNCTION_EXP_H__
40 
41 
42 #include "cFunctionTwoValue.h"
43 
44 #include "cmath"
45 
46 
47 namespace fib{
48 
49 
51 
52 public:
53 
54  /**
55  * The constructor of the underfunction.
56  *
57  * @param firstUnderfunction the first underfunction for the function
58  * @see pFirstUnderfunction
59  * @param secondUnderfunction the second underfunction for the function
60  * @see pSecondUnderfunction
61  * @param pInSuperiorFunction the underfunction which contains the
62  * new underfunction
63  * @param pInDefiningFibElement the fib -element which defines/ uses
64  * the new underfunction
65  */
66  cFunctionExp( const cUnderFunction & firstUnderfunction,
67  const cUnderFunction & secondUnderfunction,
68  cUnderFunction * pInSuperiorFunction = NULL,
69  cFibElement * pInDefiningFibElement = NULL );
70 
71  /**
72  * The copy constructor of the underfunction.
73  * This constructor will also copy the underfunctions of the given
74  * function.
75  *
76  * @param underfunction the underfunction which to copy
77  * @param pInSuperiorFunction the underfunction which contains the
78  * new underfunction
79  * @param pInDefiningFibElement the fib -element which defines/ uses
80  * the new underfunction
81  */
82  cFunctionExp( const cFunctionExp & underfunction,
83  cUnderFunction * pInSuperiorFunction = NULL,
84  cFibElement *pInDefiningFibElement = NULL );
85 
86  /**
87  * The constructor for restoring a value underfunction from an TinyXml element.
88  *
89  * @param pXmlNode a pointer to the TinyXml node the underfunction is stored in
90  * @param outStatus An reference to an integervalue where the errorvalue
91  * can be stored to.
92  * possible errorvalues are:
93  * - 0 loading successful
94  * - -1 loading error, invalid pXmlElement
95  * - -2 loading error, invalid data in pXmlElement
96  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
97  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
98  * object is wrong
99  * @param liDefinedVariables a list with the defined variables for the
100  * to restore fib -element, every variable should have it's number
101  * (the number under which it is stored) as it's value
102  * @param pInSuperiorFunction the underfunction which contains the
103  * new underfunction
104  * @param pInDefiningFibElement the fib -element which defines/ uses
105  * the new underfunction
106  */
107  cFunctionExp( const TiXmlElement * pXmlElement, intFib & outStatus,
108  list<cFibVariable*> & liDefinedVariables,
109  cUnderFunction * pInSuperiorFunction = NULL,
110  cFibElement * pInDefiningFibElement = NULL );
111 
112  /**
113  * This constructor restores a value underfunction from the stream
114  * where it is stored in the compressed fib -format.
115  * Beware: The bits for the functiontype should be allready readed, this
116  * constructor reads yust the two underfunctions.
117  *
118  * @param iBitStream the stream where this underfunction is stored to in,
119  * because this stream is an cReadBits, any number of bits can be
120  * readed from it
121  * @param outStatus An reference to an integervalue where the errorvalue
122  * can be stored to. If the pointer is NULL no errorvalue will be
123  * given back.
124  * possible errorvalues are:
125  * - 0 loading successful
126  * - -1 loading error, invalid stream
127  * - -2 loading error, invalid data in stream
128  * - 1 loading warning, invalid data in stream, error could be corrected
129  * - 2 loading warning, invalid data in stream, maybe the loaded
130  * object is wrong
131  * @param liDefinedVariables a list with the defined variables for the
132  * to restore fib -element, every variable should have it's number
133  * (the number under which it is stored) as it's value
134  * @param pInDomainValue the domain for value underfunction
135  * @param pInDomainVariable the domain for variables
136  * @param pInSuperiorFunction the underfunction which contains the
137  * new underfunction
138  * @param pInDefiningFibElement the fib -element which defines/ uses
139  * the new underfunction
140  */
141  cFunctionExp( cReadBits & iBitStream, intFib & outStatus,
142  list<cFibVariable*> & liDefinedVariables,
143  const cDomainSingle * pInDomainValue, const cDomainSingle * pInDomainVariable,
144  cUnderFunction * pInSuperiorFunction = NULL,
145  cFibElement * pInDefiningFibElement = NULL );
146 
147 
148  /**
149  * Returns the value of the underfunction or 0 if non such exists.
150  *
151  * @return the value of the underfunction or 0 if non
152  * such exists
153  */
154  virtual doubleFib getValue() const;
155 
156  /**
157  * This method stores this Fib -object in the compressed Fib -format
158  * into the given stream.
159  * It is needed becouse the stream can yust store byts but the size of
160  * fib -elements can be any number of bits. Because of that ther have to
161  * be a possibility to exchange the missing bits betwean the fib -elements.
162  *
163  * @see store
164  * @param stream the stream where this Fib -object should be stored to
165  * @param cRestBits the not yet writen bits which should be stored
166  * @param uiRestBitPosition the number of bits in the cRestBits which
167  * should be writen respectively containing valid information
168  * @return true if this Fib -object is stored, else false
169  */
170  virtual bool store( ostream & stream, char & cRestBits,
171  unsigned char & uiRestBitPosition ) const;
172 
173  /**
174  * @return the type for the underfunction
175  */
176  virtual unsignedIntFib getType() const;
177 
178  /**
179  * @return the name for the underfunction
180  */
181  virtual string getUnderFunctionName() const;
182 
183  /**
184  * This method duplicates this whole underfunction.
185  * Underfunctions of this underfunction are also cloned.
186  *
187  * @param pSuperiorUnderFunction the underfunction which contains
188  * @param pInDefiningFibElement the Fib -element which defines/ uses
189  * @return the cloned/ duplicated underfunction
190  */
191  virtual cFunctionExp * clone(
192  cUnderFunction * pInSuperiorUnderFunction = NULL,
193  cFibElement *pInDefiningFibElement = NULL) const;
194 
195 
196 
197 };//end class cFunctionExp
198 
199 
200 }//end namespace fib
201 
202 #endif