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
cFibBranch.h
Go to the documentation of this file.
1 /**
2  * @class cFibBranch
3  * file name: cFibBranch.h
4  * @author Betti Oesterholz
5  * @date 11.08.2009
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents a Fib-element, which are branches.
11  * Copyright (C) @c LGPL3 2009 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 file contains the basisclass of all Fib-elements, which are
28  * branches. Branches can have more than one underobject. It's not
29  * possible to create instances from this class.
30  * The Fib-elements are the elements of the Fib-multimedialanguage.
31  * The class cFibElement defines methods to change the structur of an
32  * Fib-object/-tree.
33  *
34  * If the structur of the Fib-object is changed just set the underobjects
35  * and call updateAllValues() from a position wher the highest Fib-element
36  * can be reached. The updateAllValues() method will make the conections.
37  * If you remove conections you have to be more carefull.
38  */
39 /*
40 History:
41 17.04.2009 Oesterholz created
42 06.01.2010 Oesterholz getAllFibElements() uses now getAllFibElementsFromPosition()
43 02.09.2010 Oesterholz the destructor cuts the conections from the
44  underobjects to this object
45 07.08.2011 Oesterholz isDefinedVariable() and getDefinedVariables() with
46  pCallingFibElement
47 19.10.2011 Oesterholz FEATURE_EQUAL_FIB_OBJECT implemented
48 */
49 
50 
51 #ifndef ___C_FIB_BRANCH_H__
52 #define ___C_FIB_BRANCH_H__
53 
54 #include "version.h"
55 #include "fibDatatyps.h"
56 
57 #include "cFibElement.h"
58 #include "cVectorPosition.h"
59 #include "cVectorProperty.h"
60 #include "cFibVariable.h"
61 #include "cDomains.h"
62 
63 #include "cFibObjectCounts.h"
64 
65 #include <list>
66 #include <ostream>
67 #include <istream>
68 
69 
70 using std::list;
71 using std::ostream;
72 using std::istream;
73 
74 using namespace fib;
75 
76 namespace fib{
77 
78 
79 
80 class cFibBranch: public cFibElement{
81 
82 friend class cFibElement;
83 
84 protected:
85 
86  /**
87  * the underobjects this Fib-element has
88  */
89  list<cFibElement*> fibUnderObjects;
90 
91 #ifdef FEATURE_FAST_UPDATE
92 
93  /**
94  * The number of Fib-elements of the given type below or equal this
95  * Fib-element.
96  */
97  cFibObjectCounts fibObjectCounts;
98 
99 #endif //FEATURE_FAST_UPDATE
100 
101 #ifdef FEATURE_SIMPLE_CONSTRUCTOR
102 
103  /**
104  * parameterconstructor
105  *
106  * @param liFibUnderObjects the underobjects of this Fib-branchelement
107  * @param pInSuperiorElement the Fib-Element in which this Fib-element
108  * is the underobject
109  */
110  cFibBranch( list<cFibElement*> liFibUnderObjects = list<cFibElement*>(),
111  cFibElement * pInSuperiorElement = NULL );
112 
113 #else //FEATURE_SIMPLE_CONSTRUCTOR
114 
115  /**
116  * parameterconstructor
117  *
118  * @param pInSuperiorElement the Fib-Element in which this Fib-element
119  * is the underobject
120  * @param pInPreviousFibElement the Fib-Element which stands in th order
121  * of Fib-elements befor this Fib-element
122  * @param pInNextFibElement the Fib-Element which stands in th order
123  * of Fib-elements behind this Fib-element
124  * @param liFibUnderObjects the underobjects of this Fib-branchelement
125  */
126  cFibBranch( cFibElement * pInSuperiorElement = NULL,
127  cFibElement * pInPreviousFibElement = NULL,
128  cFibElement * pInNextFibElement = NULL,
129  list<cFibElement*> liFibUnderObjects = list<cFibElement*>() );
130 
131 #endif //FEATURE_SIMPLE_CONSTRUCTOR
132 
133  /**
134  * copyconstructor
135  * This copyconstructor constructs a copy of this Fib-Element.
136  * It dosn't copy other Fib-elements than this, even if ther are in this
137  * Fib-element.
138  *
139  * @param fibBranchElement the Fib-element to copy
140  */
141  cFibBranch( const cFibBranch & fibBranchElement );
142 
143 
144 public:
145 
146  /**
147  * destructor
148  */
149  virtual ~cFibBranch();
150 
151  /**
152  * This method checks, if this Fib-element is an valid Fib-element.
153  *
154  * @return true if this Fib-element is an valid Fib-element, else false
155  */
156  virtual bool isValidFibElement() const;
157 
158 
159 #ifdef FEATURE_FAST_UPDATE
160 
161  /**
162  * This method returns the next Fib-element in the order of Fib-elements.
163  *
164  * @return a pointer to the next Fib-element in the order of Fib-elements
165  * or the NULL pointer if non such exists
166  */
167  virtual cFibElement *getNextFibElement();
168 
169  /**
170  * This method returns the next Fib-element in the order of
171  * Fib-elements with the given type cTyp.
172  *
173  * @param cType the type of the Fib-element to return
174  * @return a pointer to the next Fib-element in the order of
175  * Fib-elements with the given type or the NULL pointer if non such
176  * exists
177  */
178  virtual cFibElement *getNextFibElement( char cType );
179 
180  /**
181  * This method returns the lNumber'th Fib-element in the order of
182  * Fib-elements with the given type cTyp.
183  *
184  * @param lNumber the number of the Fib-Element to return
185  * @param bAbsolute if the lNumber is an absolute value for the wool
186  * Fib-object
187  * @return a pointer to the lNumber'th Fib-element in the order of
188  * Fib-elements or the NULL pointer if non such exists
189  */
190  virtual cFibElement *getConstFibElement( longFib lNumber,
191  bool bAbsolute=false ) const;
192 
193  /**
194  * This method returns the lNumber'th Fib-element in the order of
195  * Fib-elements of the given type cTyp with the given type cTyp.
196  *
197  * @param lNumber the number of the Fib-element to return
198  * @param cType the type of the Fib-element to return
199  * @param bAbsolute if the lNumber is an absolute value for the wool
200  * Fib-object
201  * @return a pointer to the lNumber'th Fib-element in the order of
202  * Fib-elements with the given type or the NULL pointer if non such
203  * exists
204  */
205  virtual cFibElement *getConstFibElement( char cType, longFib lNumber,
206  bool bAbsolute=false ) const;
207 
208 #endif
209 
210  /**
211  * This method checks if the given variable is used in the given
212  * direction from this Fib-element.
213  *
214  * @see cFibVariable
215  * @see isDefinedVariable()
216  * @param variable the variable to check if it is used
217  * @param direction the direction from this Fib-element, in which the
218  * variable should be used; standardvalue is ED_POSITION so yust
219  * this Fib-element will be checked
220  * @return true if the variable is used, else false
221  */
222  virtual bool isUsedVariable( const cFibVariable *variable ,
223  edDirection direction=ED_POSITION ) const;
224 
225  /**
226  * This method returns all variables used in the given direction from
227  * this Fib-element.
228  *
229  * @see cFibVariable
230  * @see isUsedVariable()
231  * @see isDefinedVariable()
232  * @param direction the direction from this Fib-element, in which the
233  * variable should be used; standardvalue is ED_POSITION so yust
234  * this Fib-element will be checked
235  * @return the set with all variables used in the given direction from
236  * this Fib-element
237  */
238  virtual set<cFibVariable*> getUsedVariables( edDirection direction=ED_POSITION );
239 
240  /**
241  * This method replace the variable variableOld with the variable
242  * variableNew in the object.
243  * Don't touch variable definitions, just the uses of the varaible
244  * variableOld will be changed.
245  *
246  * @see cFibVariable
247  * @see isUsedVariable()
248  * @see isDefinedVariable()
249  * @param variableOld the variable to replace
250  * @param variableNew the variable with which the variable variableOld
251  * is to replace
252  * @return true if the variable variableOld is replaced with variableNew,
253  * else false
254  */
255  virtual bool replaceVariable( cFibVariable *variableOld,
256  cFibVariable *variableNew );
257 
258 #ifdef FEATURE_FAST_UPDATE
259 
260  /**
261  * This method returns the number of this Fib-element in the order of
262  * Fib-Elements or order of Fib-Elements of the same type if bOfType
263  * is true.
264  *
265  * @see getNumberOfElements()
266  * @param bOfType if true the returned number is the number the order
267  * of Fib-elements of the same type as this Fib-Element, else in
268  * the order of all Fib-elements
269  * @return the number of this Fib-element in the order of fib
270  * -Elements or order of Fib-Elements of the same type if bOfType
271  * is true
272  */
273  virtual unsignedIntFib getNumberOfElement( bool bOfType=false ) const;
274 
275  /**
276  * This method returns the number of this Fib-element in the order of
277  * move points.
278  *
279  * @see getNumberOfMovePoints()
280  * @return the number of this Fib-element in the order of move points
281  */
282  virtual unsignedIntFib getNumberOfMovePoint() const;
283 
284 #endif //FEATURE_FAST_UPDATE
285 
286  /**
287  * This method returns the number of Fib-elements of a type in this Fib
288  * -object.
289  *
290  * @see getType()
291  * @see getNumberOfElement()
292  * @param cType the character of the type ( @see getType() ), for which
293  * the elements should be counted; u (the standartvalue) stands for
294  * Fib-Elements of any type
295  * @return the number of Fib-elements of a type in the Fib-object
296  */
297  virtual unsignedIntFib getNumberOfElements( char cType='u' ) const;
298 
299  /**
300  * This method returns the number of move points in this Fib-object.
301  *
302  * @see getNumberOfMovePoint()
303  * @return the number of move points in this Fib-object
304  */
305  virtual unsignedIntFib getNumberOfMovePoints() const;
306 
307  /**
308  * This method returns the number of object points in this Fib-object.
309  *
310  * @see getNumberOfObjectPoint()
311  * @return the number of object points in this Fib-object
312  */
313  virtual unsignedIntFib getNumberOfObjectPoints() const;
314 
315  /**
316  * This method returns the number of the Fib-element over wich the
317  * objectPoint object point is defined.
318  *
319  * @see getNumberOfElement()
320  * @see getNumberOfElements()
321  * @see getNumberOfObjectPoint()
322  * @see getNumberOfObjectPoints()
323  * @param uiObjectPoint the number of the object point for which the
324  * definig Fib-element number should be returned
325  * @param bAbsolute if the lNumber is an absolute value for the wool
326  * Fib-object
327  * @return the number of the Fib-element over wich the objectPoint
328  * object point is defined
329  */
330  virtual unsignedIntFib objectPointToElementPoint( const unsignedIntFib
331  uiObjectPoint, bool bAbsolute=false ) const;
332 
333  /**
334  * This method inserts the given Fib-element fibElement on the
335  * specified position. The replaced Fib-element will be the underobject
336  * of the inserted Fib-element fibElement.
337  *
338  * @see getNumberOfElement()
339  * @see getNumberOfElements()
340  * @see getType()
341  * @param cType the type of the Fib-element insted of which the given
342  * Fib-element fibElement should be inserted
343  * @param elementPoint the number of the Fib-element, in the order of
344  * Fib-elements of the given type cType, in which position the given
345  * Fib-element fibElement should be inserted; if 0 the given
346  * fibElement will be inserted under this Fib-element
347  * @param pFibElement a pointer to the the Fib-element to insert
348  * @param bAbsolute if the lNumber is an absolute value for the wool
349  * Fib-object
350  * @param bCheckVariables if true (standardvalue) it will be checked if
351  * the variables the Fib-element defines are needed, else the
352  * Fib-element will be removed even if its variables are needed elsewher
353  * @return true if the Fib-element fibElement was inserted, else false
354  */
355  virtual bool insertElement( cFibElement * pFibElement, const char cType='u',
356  const unsignedIntFib elementPoint=0, bool bAbsolute=false,
357  bool bCheckVariables=true );
358 
359  /**
360  * This method inserts the given Fib-object fibObject on the
361  * specified position. On the specified position a listelement will
362  * be inserted, with the old Fib-object and the given Fib-object
363  * fibObject as its underobjects.
364  *
365  * @see getNumberOfElement()
366  * @see getNumberOfElements()
367  * @see overwriteObjectWithObject()
368  * @see getType()
369  * @param cType the type of the Fib-element, on which position the
370  * given Fib-object fibObject should be inserted
371  * @param elementPoint the number of the Fib-element, in the order of
372  * Fib-elements of the given type cType, on which position the given
373  * Fib-object fibObject should be inserted
374  * @param fibObject the Fib-object to insert
375  * @param first if true, the inserted object will be the first
376  * underobject of the new listelement
377  * @param bAbsolute if the lNumber is an absolute value for the wool
378  * Fib-object
379  * @return true if the Fib-object fibObject was inserted, else false
380  */
381  virtual bool insertObjectInElement( cFibElement *fibObject, const char cType='u',
382  const unsignedIntFib elementPoint=0, bool first=true,
383  bool bAbsolute=false );
384 
385  /**
386  * This method overwrites the Fib-object on specified position with
387  * the given Fib-object fibObject. The Fib-object on specified
388  * position will be replaced with the given Fib-object fibObject.
389  *
390  * @see getNumberOfElement()
391  * @see getNumberOfElements()
392  * @see insertObjectInElement()
393  * @see getType()
394  * @param cType the type of the Fib-element, on which position the
395  * given Fib-object fibObject should be inserted
396  * @param elementPoint the number of the Fib-element, in the order of
397  * Fib-elements of the given type cType, on which position the given
398  * Fib-object fibObject should be inserted
399  * @param fibObject the Fib-object to insert
400  * @param bDeleteOld if true, delete the old Fib-object from the memory
401  * @param bAbsolute if the elementPoint is an absolute value for the wool
402  * Fib-object
403  * @return true if the old Fib-object was overwritten and the given
404  * Fib-object fibObject was inserted, else false
405  */
406  virtual bool overwriteObjectWithObject( cFibElement *fibObject, const char cType='u',
407  const unsignedIntFib elementPoint=0, bool bDeleteOld=true,
408  bool bAbsolute=false );
409 
410  /**
411  * This method removes the connected object with the given number in
412  * the order of connected object points.
413  * For this the defining underobject in an listelement will be removed.
414  * If the listelement contains after the operation yust one underobject,
415  * the listelement will be replaced with the underobject.
416  *
417  * @param objectPoint the number of the connected object to remove
418  * @param bDeleteOld if true, delete the connected object from the
419  * memory, else yust remove it's pointers
420  * @param bAbsolute if the objectPoint is an absolute value for the wool
421  * Fib-object
422  * @return true if the connected Fib-object was removed, else false
423  */
424  virtual bool removeObject( const unsignedIntFib objectPoint,
425  bool bDeleteOld=true, bool bAbsolute=false );
426 
427  /**
428  * This method checks, if all Fib-elements of this Fib-object
429  * have the underobjects they need to be correct.
430  *
431  * @return true if all Fib-elements of this Fib-object have the
432  * underobjects they need to be correct, else false
433  */
434  virtual bool hasUnderAllObjects( ) const;
435 
436  /**
437  * This method checks, if the Fib-element on the specified position
438  * is deletable.
439  * An deletable Fib-element doesn't make the Fib-object invalid if
440  * it is deleted (e.g. points- and listelements are never deletable).
441  *
442  * @see removeElement()
443  * @see cutElement()
444  * @see getType()
445  * @param cType the type of the Fib-element to check
446  * @param elementPoint the number of the Fib-element, in the order of
447  * Fib-elements of the given type cType, to check
448  * @param bAbsolute if the elementPoint is an absolute value for the wool
449  * Fib-object
450  * @param bCheckVariables if true (standardvalue) it will be checked if
451  * the variables the Fib-element defines are needed, else the
452  * Fib-element will be removed even if its variables are needed elsewher
453  * @return true if the Fib-element is deletable, else false
454  */
455  virtual bool isRemovableElement( const char cType='u', const unsignedIntFib
456  elementPoint=0, bool bAbsolute=false, bool bCheckVariables=true ) const;
457 
458  /**
459  * This method cuts the Fib-element on the specified position.
460  * This works like removeElement(), except that the removed element is
461  * returned.
462  *
463  * @see isDeletableElement()
464  * @see removeElement()
465  * @see getType()
466  * @param cType the type of the Fib-element to cut
467  * @param elementPoint the number of the Fib-element, in the order of
468  * Fib-elements of the given type cType, to cut
469  * @param bAbsolute if the elementPoint is an absolute value for the wool
470  * Fib-object
471  * @param bCheckVariables if true (standardvalue) it will be checked if
472  * the variables the Fib-element defines are needed, else the
473  * Fib-element will be removed even if its variables are needed elsewher
474  * @return the pointer to the cuted Fib-element or NULL, if the Fib
475  * -element couldn't cut
476  */
477  virtual cFibElement *cutElement( const char cType='u', const unsignedIntFib
478  elementPoint=0, bool bAbsolute=false, bool bCheckVariables=true );
479 
480 #ifdef FEATURE_FAST_UPDATE
481  /**
482  * This method deletes this given Fib-object with all the fib
483  * elements it contains and is contained in. The memory for the fib
484  * -object is freed.
485  */
486  virtual void deleteObject();
487 #endif //FEATURE_FAST_UPDATE
488 
489  /**
490  * This method moves a Fib-limb -element (cFibLimb) on the specified
491  * position over iHowfar Fib-elements.
492  * Moving is stoped if an invalid Fib-object would result (e.g. no Fib
493  * -element can be moved over an Fib-elements that defines a variable
494  * the moved Fib-element uses).
495  * Moving an Fib-element into an listelement will result in an
496  * listelement with the moved element in everyone of it's underobjects.
497  *
498  * @see isDeletableElement()
499  * @see removeElement()
500  * @see getType()
501  * @param cType the type of the Fib-element to move
502  * @param elementPoint the number of the Fib-element, in the order of
503  * Fib-elements of the given type cType, to move
504  * @param iHowfar the number of Fib-elements over which the to move
505  * Fib-element should be moved; if this value is positiv the Fib
506  * -element will be moved over Fib-elements it contains else over
507  * Fib-elements it is contained in
508  * @param bAbsolute if the elementPoint is an absolute value for the wool
509  * Fib-object
510  * @return the number of Fib-Elements over which the to move Fib
511  * -element was moved; if this value is positiv the Fib-element
512  * was moved over Fib-elements it contains else over Fib-elements
513  * it is contained in
514  */
515  virtual intFib moveLimbElement( const char cType='u', const unsignedIntFib
516  elementPoint=0, const intFib iHowfar=1, bool bAbsolute=false );
517 
518 
519 #ifndef FEATURE_EQUAL_FIB_OBJECT
520 
521  /**
522  * This method checks if the given Fib-object is equal to this Fib
523  * -object.
524  * Variables can be others, but must be defined and aused in equivalent
525  * Fib-elements.
526  *
527  * @param fibObject the Fib-object to which this Fib-object should be
528  * equal
529  * @return true if this Fib-object is equal to the given Fib-object,
530  * else false
531  */
532  virtual bool equal( const cFibElement & fibObject ) const;
533 
534 #endif //FEATURE_EQUAL_FIB_OBJECT
535 
536  /**
537  * @return this method returns true if this Fib-element is an
538  * branchelement, alse false
539  */
540  bool isBranch() const;
541 
542 protected:
543 #ifdef FEATURE_FAST_UPDATE
544 
545  /**
546  * This method evalues the Fib-element counters of the given Fib-object.
547  *
548  * @param pFibElement the Fib-object, for which to evalue the counts of
549  * the contained Fib-elements
550  * @return a vector with the counts of Fib-elements of the seperate typs
551  * in the given Fib-object
552  */
553  cFibObjectCounts evalueCountersForObject(
554  const cFibElement * pFibElement ) const;
555 
556  /**
557  * This method updates the Fib-element counters of all branchelements in
558  * this branchelement.
559  *
560  * @return the numbers with which the Fib-element counters wher updated
561  */
562  virtual cFibObjectCounts updateCounters();
563 
564  /**
565  * This method updates the Fib-element counters of all branchelements in
566  * this or higher this branchelement.
567  *
568  * @param vecDeltaNumberOfFibElements a vector with the Fib-elements
569  * counts, with which to update all branchelements counters in this
570  * or higher this branchelement
571  */
572  void updateAllCounters(
573  const cFibObjectCounts & vecDeltaNumberOfFibElements );
574 
575  /**
576  * This method updates the Fib-element counters of all branchelements in
577  * this or higher this branchelement.
578  */
579  void updateAllCounters();
580 
581  /**
582  * This method is a helpmethod for getNumberOfElement() .
583  * Basicly it counts the number of Fib-elements of the given type befor
584  * the given Fib-element pLastFibElement .
585  *
586  * @see getNumberOfElement()
587  * @see getNumberOfElements()
588  * @param pLastFibElement a pointer to the Fib-element which called this
589  * method last
590  * @param cType the type of the Fib-elements, for which to evalue the count,
591  * if 'u' Fib-elements of all typs are counted
592  * @return the number of Fib-elements of the given type cType befor the
593  * given Fib-element pLastFibElement
594  */
595  virtual unsignedIntFib getNumberOfElementUp( const cFibElement * pLastFibElement,
596  const char cType ) const;
597 
598  /**
599  * This method is a helpmethod for getNumberOfMovePoint() .
600  * Basicly it counts the number of move points befor the given
601  * Fib-element pLastFibElement .
602  *
603  * @see getNumberOfMovePoint()
604  * @see getNumberOfMovePoints()
605  * @param pLastFibElement a pointer to the Fib-element which called this
606  * method last
607  * @return the number of movepoints befor the given Fib-element pLastFibElement
608  */
609  virtual unsignedIntFib getNumberOfMovePointUp(
610  const cFibElement * pLastFibElement ) const;
611 
612  /**
613  * This method returns the next Fib-element in the order of
614  * Fib-elements which is above the given fib element.
615  * This method is used, if the method @see getNextFibElement() reaches
616  * an leaf in the object tree.
617  *
618  * @see getNextFibElement()
619  * @param pLastFibElement the Fib-element relativ to which the next
620  * Fib-element should lay
621  * @return a pointer to the next Fib-element in the order of Fib-elements
622  * or the NULL pointer if non such exists
623  */
624  virtual cFibElement *getNextFibElementUp( const cFibElement * pLastFibElement );
625 
626  /**
627  * This method returns the next Fib-element in the order of
628  * Fib-elements which is above the given fib element.
629  * This method is used, if the method @see getNextFibElement() reaches
630  * an leaf in the object tree.
631  *
632  * @see getNextFibElement()
633  * @param pLastFibElement the Fib-element relativ to which the next
634  * Fib-element should lay
635  * @param cType the type of the Fib-element to return
636  * @return a pointer to the next Fib-element in the order of Fib-elements
637  * or the NULL pointer if non such exists
638  */
639  virtual cFibElement * getNextFibElementUp( const cFibElement * pLastFibElement,
640  char cType );
641 
642  /**
643  * This method returns the lNumber'th Fib-element in the order of
644  * Fib-elements which is above the given Fib-element.
645  * This method is used, if the method @see getConstFibElement() reaches
646  * an leaf in the object tree.
647  *
648  * @see getConstFibElementUp()
649  * @param pLastFibElement the Fib-element relativ to which the next
650  * Fib-element should lay
651  * @param lNumber the number of the Fib-Element to return
652  * @return a pointer to the next Fib-element in the order of Fib-elements
653  * or the NULL pointer if non such exists
654  */
655  virtual cFibElement * getConstFibElementUp( const cFibElement * pLastFibElement,
656  longFib lNumber ) const;
657 
658  /**
659  * This method returns the lNumber'th Fib-element in the order of
660  * Fib-elements of the given type cTyp with the given type cTyp
661  * which is above the given Fib-element.
662  * This method is used, if the method @see getConstFibElement() reaches
663  * an leaf in the object tree.
664  *
665  * @see getConstFibElementUp()
666  * @param pLastFibElement the Fib-element relativ to which the next
667  * Fib-element should lay
668  * @param cType the type of the Fib-element to return
669  * @param lNumber the number of the Fib-Element to return
670  * @return a pointer to the next Fib-element in the order of Fib-elements
671  * or the NULL pointer if non such exists
672  */
673  virtual cFibElement * getConstFibElementUp( const cFibElement * pLastFibElement,
674  char cType, longFib lNumber ) const;
675 
676 #endif //FEATURE_FAST_UPDATE
677 
678 #ifndef FEATURE_NO_REGISTER_NEW_FIB_
679  /**
680  * With this method a new Fib-element in the Fib-Object is registert
681  * by the other Fib-elements in the Fib-Object.
682  *
683  * @param newFibElement the new Fib-element to register
684  * @param uINumberOfFibElement the number of the new Fib-element in the
685  * order of all Fib-Elements in the Fib-object
686  * @param bDirectionUp the direction in which the registration of the
687  * new Fib-element is performed in the Fib-object tree;
688  * from the position on which the new Fib-Element is added the
689  * method is called for both directions
690  * @return true if the registration was successfull, else false
691  */
692  virtual bool registerNewFibElement( cFibElement *newFibElement,
693  unsignedIntFib uINumberOfFibElement, bool bDirectionUp );
694 
695 
696  /**
697  * With this method a new part Fib-object in the Fib-Object is
698  * registert by the other Fib-elements in the Fib-Object.
699  *
700  * @param newFibObject the new part Fib-object to register
701  * @param uILowerNumberOfFibElements the number of the Fib-element in the
702  * new part Fib-object with the lowest number in the order of all
703  * Fib-Elements in the entire Fib-object
704  * @param uIUpperNumberOfFibElements the number of the Fib-element in the
705  * new part Fib-object with the highest number in the order of all
706  * Fib-Elements in the entire Fib-object
707  * @param bDirectionUp the direction in which the registration of the
708  * new part Fib-object is performed in the Fib-object tree;
709  * @return true if the registration was successfull, else false
710  */
711  virtual bool registerNewFibObject( cFibElement *newFibObject,
712  unsignedIntFib uILowerNumberOfFibElements,
713  unsignedIntFib uIUpperNumberOfFibElements, bool bDirectionUp );
714 #endif //FEATURE_NO_REGISTER_NEW_FIB_
715 
716 
717 #ifdef FEATURE_FAST_UPDATE
718 
719  /**
720  * This method cuts the connections of this Fib-element to the
721  * given Fib-element.
722  *
723  * @param pFibElement the Fib-element to which to cut the connection
724  */
725  virtual void cutConnectionsTo( const cFibElement * pFibElement );
726 
727  /**
728  * This method returns the number of the next connected object point
729  * in the order of connected object points that conntains the given
730  * Fib-element pLastFibElement.
731  *
732  * @param pLastFibElement a point to the Fib-elements for which the
733  * connected object point is to return
734  * @see getNumberOfObjectPoint()
735  * @see getNumberOfObjectPoints()
736  * @return the number of the next connected object point for the given
737  * Fib-element
738  */
739  virtual unsignedIntFib getNumberOfObjectPointUp(
740  const cFibElement * pLastFibElement ) const;;
741 
742  /**
743  * This method returns the numbers of all object points that contain the
744  * elementPoint Fib-element.
745  *
746  * @see getNumberOfElement()
747  * @see getNumberOfElements()
748  * @see getNumberOfObjectPoint()
749  * @see getNumberOfObjectPoints()
750  * @see getType()
751  * @param pLastFibElement a point to the Fib-elements for which the
752  * connected object points are to return
753  * @param pFirstFibElement the Fib-element for which this method was
754  * called ( the reference Fib-element)
755  * @return a list of the numbers of all object points that contain the
756  * elementPoint Fib-element of the type cType
757  */
758  virtual list<unsignedIntFib> elementPointToObjectPointsUp(
759  const cFibElement * pLastFibElement,
760  const cFibElement * pFirstFibElement ) const;
761 
762 #else //FEATURE_FAST_UPDATE
763 
764  /**
765  * This method cuts the connections of this Fib-element to other
766  * Fib-elements.
767  *
768  * @param direction the direction into which the connections are to be
769  * cutted
770  * ED_HIGHER, ED_HIGHER_EQUAL, ED_ALL: will cut the conection to
771  * superior and previous Fib-elements
772  * ED_BELOW, ED_BELOW_EQUAL, ED_ALL: will cut the conection to
773  * next- Fib-element and the underobjects
774  */
775  virtual void cutConnections( edDirection direction=ED_ALL );
776 
777  /**
778  * This method updates the values/ properties off all Fib-elements in
779  * this Fib-object beginning with this Fib-element.
780  * Every underobject should have all it's underobjects.
781  *
782  * @param previosFibElement the prvios Fib-element to this Fib-element
783  * in the order of Fib-elements; if it is NULL ther is no previos
784  * Fib-element to this
785  * @param pNextArm the next arm Fib-object in the next higher
786  * Fib-brancheelement
787  * @return a pointer to the last evalued Fib-element;
788  * if NULL an error has occured
789  */
790  virtual cFibElement* updateValues( cFibElement * previosFibElement=NULL,
791  cFibElement * pNextArm=NULL );
792 
793  /**
794  * This method returns the number of the next connected object point
795  * in the order of connected object points that conntains this Fib
796  * -element.
797  *
798  * @param uINumberOfStartFibElement the number, in the order of all
799  * Fib-elements, of the Fib-element for which the connected object
800  * point is to return
801  * @see getNumberOfObjectPoint
802  * @see getNumberOfObjectPoints()
803  * @return the number of the next connected object point for this Fib
804  * -element
805  */
806  virtual unsignedIntFib getNumberOfObjectPoint(
807  unsignedIntFib uINumberOfStartFibElement ) const;
808 
809  /**
810  * This method returns the numbers of all object points that contain the
811  * elementPoint Fib-element.
812  *
813  * @see elementPointToObjectPoints()
814  * @see getNumberOfElement()
815  * @see getNumberOfElements()
816  * @see getNumberOfObjectPoint()
817  * @see getNumberOfObjectPoints()
818  * @see getType()
819  * @param referenceFibObject the Fib-element for which the object points
820  * are to returned
821  * @param uiLastObjectPoint the number of the last object point to the
822  * referenceFibObject
823  * @return a list of the numbers of all object points that contain the
824  * elementPoint Fib-element of the type cType
825  */
826  virtual list<unsignedIntFib> elementPointToObjectPoints(
827  const cFibElement *referenceFibObject,
828  const unsignedIntFib uiLastObjectPoint ) const;
829 
830 #endif //FEATURE_FAST_UPDATE
831 
832  /**
833  * This method sets the each variable, which is defined over an leaf,
834  * to an uniqe integer number greater than the given number
835  * uiLastVariableNumber. While storing this number can be stored to
836  * identify the variable.
837  *
838  * @param uiLastVariableNumber the number which was last use, this
839  * means also is the greatest used, in this limb.
840  * @return the number which was last use, this
841  * means also is the greatest used, in this limb
842  * from the method
843  */
844  virtual unsignedIntFib enumerateVariablesForStoring(
845  unsignedIntFib uiLastVariableNumber = 0 );
846 
847  /**
848  * This method returns a number of (lNumberOfMaxReturnedElements)
849  * Fib-elements beginning from the actual Fib-element in the
850  * given direction of the given type cType.
851  * The actual Fib-element will never be included in the returned list.
852  *
853  * @param cType the type of the Fib-elements to return;
854  * 'w' stands for wrong/ not correct Fib-elements
855  * @param direction the direction, beginning from the reference
856  * Fib-element, in which the to return Fib-elements should stand
857  * @param lNumberOfMaxReturnedElements the maximal number of
858  * Fib-elements to return
859  * @return a list with the pointers to the to returning Fib-elements
860  */
861  virtual list<cFibElement*> getAllFibElementsFromPosition( char cType,
862  edDirection direction, unsignedLongFib lNumberOfMaxReturnedElements );
863 
864  /**
865  * This method checks if the given variable is defined in the given
866  * direction from this Fib-element.
867  * This is for intern use to get the correct data from
868  * isDefinedVariable() without pCallingFibElement.
869  *
870  * @see cFibVariable
871  * @see isUsedVariable()
872  * @param pVariable the variable to check if it is defined
873  * @param direction the direction from this Fib-element, in which the
874  * variable should be defined; standardvalue is ED_POSITION so yust
875  * this Fib-element will be checked
876  * @param pCallingFibElement the Fib-Element which called this method
877  * @return true if the variable is used, else false
878  */
879  virtual bool isDefinedVariableInternal( const cFibVariable * pVariable,
880  edDirection direction = ED_POSITION,
881  const cFibElement * pCallingFibElement = NULL ) const;
882 
883  /**
884  * This method returns all variables defined in the given direction from
885  * this Fib-element.
886  * This is for intern use to get the correct data from
887  * getDefinedVariables() without pCallingFibElement..
888  *
889  * @see cFibVariable
890  * @see getUsedVariables()
891  * @see isDefinedVariable()
892  * @param direction the direction from this Fib-element, in which the
893  * variable should be used; standardvalue is ED_POSITION so yust
894  * this Fib-element will be checked
895  * @param pCallingFibElement the Fib-Element which called this method
896  * @return the set with all variables used in the given direction from
897  * this Fib-element
898  */
899  virtual list< cFibVariable* > getDefinedVariablesInternal(
900  edDirection direction = ED_HIGHER,
901  const cFibElement * pCallingFibElement = NULL );
902 
903 #ifdef FEATURE_EQUAL_FIB_OBJECT
904 
905  /**
906  * This method checks if the given Fib-object is equal to this fib
907  * -object.
908  * Variables can be others, but must be defined and used in equivalent
909  * Fib-elements.
910  *
911  * @param fibObject the Fib-object to which this Fib-object should be
912  * equal
913  * @param mapEqualRootObjects the root objects of this object that wher
914  * already checked as equal
915  * map entries:
916  * key: the root-element of this Fib object that was checked
917  * value: the to the key correspondending root-element of the
918  * fibObject that was checked and which is equal to the key
919  * root-element
920  * (it is empty if bCheckExternalObjects == false)
921  * @param mapEqualDefinedVariables the Fib elements that defines
922  * variables and are equal;
923  * map entries:
924  * key: the Fib element of this Fib object that was checked
925  * value: the to the key correspondending Fib element of the
926  * fibObject that was checked and which sets its defined
927  * variables to the same values as the key Fib element
928  * @param bCheckExternalObjects if true the external objects of
929  * cExtObject will be compared
930  * @return true if this Fib-object is equal to the given Fib-object,
931  * else false
932  */
933  virtual bool equalInternal( const cFibElement & fibObject,
934  map< const cRoot *, const cRoot * > & mapEqualRootObjects,
935  map< const cFibElement *, const cFibElement * > & mapEqualDefinedVariables,
936  const bool bCheckExternalObjects ) const;
937 
938 #endif //FEATURE_EQUAL_FIB_OBJECT
939 
940 };//end class cFibBranch
941 
942 
943 }//end namespace fib
944 
945 #endif
946 
947