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