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