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
cConditionFalse.h
Go to the documentation of this file.
1 /**
2  * @class cConditionFalse
3  * file name: cConditionFalse.h
4  * @author Betti Oesterholz
5  * @date 30.04.2011
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents a false condition.
11  * Copyright (C) @c LGPL3 2011 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 false condition.
28  * This condition is allways false.
29  *
30  */
31 /*
32 History:
33 30.04.2011 Oesterholz created
34 19.10.2011 Oesterholz FEATURE_EQUAL_FIB_OBJECT implemented
35 */
36 
37 #ifndef ___C_CONDITION_FALSE_H__
38 #define ___C_CONDITION_FALSE_H__
39 
40 
41 #include "version.h"
42 #include "fibDatatyps.h"
43 #include "cReadBits.h"
44 
45 #include "cCondition.h"
46 
47 
48 using std::set;
49 
50 namespace fib{
51 
52 
54 public:
55 
56 
57  /**
58  * The constructor of the false condition.
59  *
60  * @param pInSuperiorCondition the condition which contains the
61  * new condition
62  * @param pInDefiningFibElement the Fib-element which defines/ uses
63  * the new condition
64  */
65  cConditionFalse( cCondition * pInSuperiorCondition = NULL,
66  cFibElement * pInDefiningFibElement = NULL );
67 
68  /**
69  * The copy constructor of the condition.
70  *
71  * @param condition the condition which to copy
72  * @param pInSuperiorCondition the condition which contains the
73  * new condition
74  * @param pInDefiningFibElement the Fib-element which defines/ uses
75  * the new condition
76  */
77  cConditionFalse( const cConditionFalse & condition,
78  cCondition * pInSuperiorCondition = NULL,
79  cFibElement *pInDefiningFibElement = NULL );
80 
81  /**
82  * The destructor of the condition.
83  */
84  virtual ~cConditionFalse();
85 
86  /**
87  * This method returns if this condition is valid, else false.
88  * All subcondition and underfunctions must be valid.
89  * No condition should contain itself or should be contained in one
90  * of its condition (no cycles allowed).
91  *
92  * @return true if this condition is valid, else false
93  */
94  virtual bool isValid() const;
95 
96  /**
97  * This method checks if the given variable is used in this condition.
98  *
99  * @see cFibVariable
100  * @param variable the variable to check if it is used
101  * @return true if the variable is used, else false
102  */
103  virtual bool isUsedVariable( const cFibVariable * variable ) const;
104 
105  /**
106  * This method returns all variables used in this condition.
107  *
108  * @see cFibVariable
109  * @return all variables used in this condition
110  */
111  virtual set<cFibVariable*> getUsedVariables();
112 
113  /**
114  * This method replace the variable variableOld with the variable
115  * variableNew in the condition.
116  *
117  * @see cFibVariable
118  * @see isVariable()
119  * @see isUsedVariable()
120  * @param variableOld the variable to replace
121  * @param variableNew the variable with which the variable variableOld
122  * is to replace
123  * @return true if the variable variableOld is replaced with variableNew,
124  * else false
125  */
126  virtual bool replaceVariable( cFibVariable * variableOld,
127  cFibVariable * variableNew );
128 
129  /**
130  * Returns the value false of the condition.
131  *
132  * @return false
133  */
134  virtual bool getValue() const;
135 
136  /**
137  * @return the number of conditions, a condition of this type has
138  */
139  virtual unsignedIntFib getNumberOfConditions() const;
140 
141  /**
142  * @return the number of underfunctions, a condition of this type has
143  */
145 
146  /**
147  * This method evaluades a value for the time needed to evalue the
148  * condition.
149  * This value should not exceed lMaxTime, if the value for the time
150  * is greater than lMaxTime the evaluation will be stopt and lMaxTime
151  * returned. If lMaxTime is 0 (for infinity) the evaluation won't be
152  * stoped, this is the standard case.
153  *
154  * @see cFibElement::evalueObject()
155  * @param lMaxTime the maximum time for the evaluation, the returned
156  * exceed this value; the value 0 stands for infinity, so the
157  * evaluation won't be stoped
158  * @return a value for the time needed to evalue this condition
159  */
160  virtual unsignedLongFib getTimeNeed( unsignedLongFib lMaxTime=0 ) const;
161 
162  /**
163  * This method evaluades the size of the Fib-object in bits in the
164  * compressed file form.
165  * The optionalpart field of point -elements will be ignored.
166  *
167  * @see store()
168  * @return the size of the Fib-object in bits in the compressed form
169  */
170  virtual unsignedLongFib getCompressedSize() const;
171 
172  /**
173  * This method stores this Fib-object in the compressed Fib-format
174  * into the given stream.
175  * It is needed becouse the stream can yust store byts but the size of
176  * Fib-elements can be any number of bits. Because of that ther have to
177  * be a possibility to exchange the missing bits betwean the Fib-elements.
178  *
179  * @see store
180  * @param stream the stream where this Fib-object should be stored to
181  * @param cRestBits the not yet writen bits which should be stored
182  * @param uiRestBitPosition the number of bits in the cRestBits which
183  * should be writen respectively containing valid information
184  * @return true if this Fib-object is stored, else false
185  */
186  virtual bool store( ostream & stream, char & cRestBits,
187  unsigned char & uiRestBitPosition ) const;
188 
189  /**
190  * This method stores this condition in the XML-format into the
191  * given stream.
192  * Variables should have ther number as ther value.
193  *
194  * @param stream the stream where this conditionshould be
195  * stored to
196  * @return true if this condition is stored, else false
197  */
198  virtual bool storeXml( ostream & stream ) const;
199 
200  /**
201  * @return the type for the condition
202  */
203  virtual unsignedIntFib getType() const;
204 
205  /**
206  * @return the name for the condition
207  */
208  virtual string getConditionName() const;
209 
210 #ifndef FEATURE_EQUAL_FIB_OBJECT
211  /**
212  * This Method checks if the given condition is equal to this condition.
213  *
214  * @param condition the condition to compare with this condition
215  * @return true if the given condition is equal to this condition, else false
216  */
217  virtual bool equal( const cCondition & condition ) const;
218 #endif //FEATURE_EQUAL_FIB_OBJECT
219 
220  /**
221  * This method duplicates this whole condition.
222  * subcondition of this condition are also cloned.
223  *
224  * @param pSuperiorCondition the condition which contains the cloned
225  * condition
226  * @param pInDefiningFibElement the Fib-element which defines/ uses
227  * the cloned condition
228  * @return the cloned/ duplicated condition
229  */
230  virtual cConditionFalse * clone(
231  cCondition * pInSuperiorCondition = NULL,
232  cFibElement *pInDefiningFibElement = NULL) const;
233 
234 protected:
235 
236 #ifdef FEATURE_EQUAL_FIB_OBJECT
237 
238  /**
239  * This Method checks if the given variable is equal to this variable.
240  *
241  * @param condition the condition to which this condition should be
242  * equal
243  * @param mapEqualRootObjects the root objects of this object that wher
244  * already checked as equal
245  * map entries:
246  * key: the root-element of this Fib object that was checked
247  * value: the to the key correspondending root-element of the
248  * fibObject that was checked and which is equal to the key
249  * root-element
250  * (it is empty if bCheckExternalObjects == false)
251  * @param mapEqualDefinedVariables the Fib elements that defines
252  * variables and are equal;
253  * map entries:
254  * key: the Fib element of this Fib object that was checked
255  * value: the to the key correspondending Fib element of the
256  * fibObject that was checked and which sets its defined
257  * variables to the same values as the key Fib element
258  * @param bCheckExternalObjects if true the external objects of
259  * cExtObject will be compared
260  * @return true if the given variable is equal to this variable, else false
261  */
262  virtual bool equalInternal( const cCondition & condition,
263  map< const cRoot *, const cRoot * > & mapEqualRootObjects,
264  map< const cFibElement *, const cFibElement * > & mapEqualDefinedVariables,
265  const bool bCheckExternalObjects ) const;
266 
267 #endif //FEATURE_EQUAL_FIB_OBJECT
268 
269 };//end class cConditionFalse
270 
271 
272 }//end namespace Fib
273 
274 #endif