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