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