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
cExtObject.h
Go to the documentation of this file.
1 /**
2  * @class cExtObject
3  * file name: cExtObject.h
4  * @author Betti Oesterholz
5  * @date 27.07.2011
6  * @mail webmaster@BioKom.info
7  *
8  * System: C++
9  *
10  * This class represents the external object element.
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 the external objects element of the Fib-multimedialanguage.
28  * It is for calling an external object.
29  *
30  */
31 /*
32 History:
33 27.07.2011 Oesterholz created
34 23.01.2012 Oesterholz input values changed to input vector
35 */
36 
37 #ifndef ___C_EXT_OBJECT_H__
38 #define ___C_EXT_OBJECT_H__
39 
40 
41 //#define FEATURE_C_EXT_OBJECT_USE_LIST
42 
43 
44 #include "version.h"
45 
46 #include "fibDatatyps.h"
47 
48 #include "cFibElement.h"
49 #include "cFibBranch.h"
50 #include "cRoot.h"
51 #include "cVectorExtObject.h"
52 
53 #ifdef FEATURE_C_EXT_OBJECT_USE_LIST
54  #include <list>
55 #else //FEATURE_C_EXT_OBJECT_USE_LIST
56  #include <vector>
57 #endif //FEATURE_C_EXT_OBJECT_USE_LIST
58 
59 
60 
61 namespace fib{
62 
63 
64 class cExtObject: public cFibBranch{
65 
66 friend class cFibElement;
67 friend class cFibBranch;
68 friend class cRoot;
69 
70 private:
71 
72  /**
73  * The identifier of the external Fib-object this external element
74  * stands for.
75  */
77 
78  /**
79  * The vector with the input values of the external object element.
80  */
82 
83 #ifdef FEATURE_C_EXT_OBJECT_USE_LIST
84  /**
85  * The list with the subobjects the external Fib-object can use.
86  * The list element pair elements are:
87  * first: a pointer to the subobject to use
88  * second: a list with the pointers to the output variables this
89  * extern object element defines for the subobject
90  */
91  list< pair< cFibElement * , list< cFibVariable * > > > vecSubobjects;
92 #else //FEATURE_C_EXT_OBJECT_USE_LIST
93 
94  /**
95  * The list with the subobjects the external Fib-object can use.
96  * The list element pair elements are:
97  * first: a pointer to the subobject to use
98  * second: a list with the pointers to the output variables this
99  * extern object element defines for the subobject
100  */
101  vector< pair< cFibElement * , vector< cFibVariable * > > > vecSubobjects;
102 #endif //FEATURE_C_EXT_OBJECT_USE_LIST
103 
104 
105 public:
106 
107  /**
108  * parameterconstructor
109  *
110  * @param lInIdentifier The identifier of the external Fib-object this
111  * external element stands for. @see lIdentifier
112  * @param vecInInputValues the vector with the input values of this
113  * external element @see vecInputValues
114  * @param pInSuperiorElement the Fib-element in which this
115  * Fib-element is an subobject
116  */
117  cExtObject( const longFib lInIdentifier,
118  const cVectorExtObject & vecInInputValues,
119  cFibElement * pInSuperiorElement = NULL );
120 
121  /**
122  * parameterconstructor
123  *
124  * @param lInIdentifier The identifier of the external Fib-object this
125  * external element stands for. @see lIdentifier
126  * @param uiNumberOfInputValues the number of input values of this
127  * external element @see vecInputValues
128  * @param pInSuperiorElement the Fib-element in which this
129  * Fib-element is an subobject
130  */
131  cExtObject( const longFib lInIdentifier,
132  const unsignedIntFib uiNumberOfInputValues=0,
133  cFibElement * pInSuperiorElement = NULL );
134 
135  /**
136  * copyconstructor
137  * This copyconstructor constructs a copy of the given external object element.
138  * It dosn't copy other Fib-elements than the given, even if ther are
139  * in the external object element.
140  *
141  * @param extObjElement the external object element to copy
142  */
143  cExtObject( const cExtObject & extObjElement );
144 
145 
146 protected:
147 
148  /**
149  * The constructor for restoring a external object element from an TinyXml element.
150  *
151  * @param pXmlNode a pointer to the TinyXml node the Fib-object is stored in
152  * @param outStatus An reference to an integervalue where the errorvalue
153  * can be stored to.
154  * possible errorvalues are:
155  * - 0 loading successful
156  * - -1 loading error, invalid pXmlElement
157  * - -2 loading error, invalid data in pXmlElement
158  * - 1 loading warning, invalid data in pXmlElement, error could be corrected
159  * - 2 loading warning, invalid data in pXmlElement, maybe the loaded
160  * object is wrong
161  * @param liDefinedVariables a list with the defined variables for the
162  * to restore Fib-element, every variable should have it's number
163  * (the number under which it is stored) as it's value
164  */
165  cExtObject( const TiXmlElement * pXmlElement, intFib & outStatus,
166  list< cFibVariable* > & liDefinedVariables );
167 
168  /**
169  * This method restores a external object objects from the stream where it is
170  * stored in the compressed Fib-format.
171  * This method is for internal use only.
172  *
173  * @param iBitStream the stream where this external object objects is stored to in,
174  * because this stream is an cReadBits, any number of bits can be
175  * readed from it
176  * @param outStatus An reference to an integervalue where the errorvalue
177  * can be stored to. If the pointer is NULL no errorvalue will be
178  * given back.
179  * possible errorvalues are:
180  * - 0 loading successful
181  * - -1 loading error, invalid stream
182  * - -2 loading error, invalid data in stream
183  * - 1 loading warning, invalid data in stream, error could be corrected
184  * - 2 loading warning, invalid data in stream, maybe the loaded
185  * object is wrong
186  * @param liDefinedVariables a list with the defined variables for the
187  * to restore fib-element, every variable should have it's number
188  * (the number under which it is stored) as it's value
189  * @param validDomains the domains valid for restoring the fib-elements
190  * @param pNextRoot the next higher root-element for the to restore
191  * fib-elements, or the last restored root-element
192  */
193  cExtObject( cReadBits & iBitStream, intFib & outStatus,
194  list<cFibVariable*> & liDefinedVariables, const cDomains & validDomains,
195  cRoot * pNextRoot );
196 
197 public:
198 
199  /**
200  * destructor
201  */
202  virtual ~cExtObject();
203 
204 
205  /**
206  * @see getTypeName
207  * @return a character for the typ of the Fib-element
208  * Types are:
209  * - u: element of unknown typ
210  * - p: point
211  * - l: list-element
212  * - y: property
213  * - c: comment
214  * - a: area
215  * - f: function
216  * - i: if-condition
217  * - o: extern object element
218  * - s: extern subobject element
219  * - v: set-element
220  * - m: matrix element
221  * - r: root-element
222  */
223  virtual char getType() const;
224 
225  /**
226  * This method checks, if this Fib-element is an valid Fib-element.
227  *
228  * @return true if this Fib-element is an valid Fib-element, else false
229  */
230  virtual bool isValidFibElement() const;
231 
232  /**
233  * This method evaluades the Fib-object.
234  *
235  * @param evaluePosition a reference to the object with the
236  * evaluePosition() method to evalue /store the positions and ther
237  * properties; everytime a point (to evalue) is reached in the
238  * evaluation, this method is called with the position and the
239  * properties of the point; @see iEvaluePosition
240  * @param objectPoint the object point in the order of true partobjects
241  * to evalue
242  * @param liVecProperties a list with the property vectors which should
243  * be global for the evalued object
244  * @return if the evalueation was successfull true, else false
245  */
246  virtual bool evalueObject( iEvaluePosition & evaluePosition,
247  const unsignedIntFib objectPoint,
248  list<cVectorProperty> & liVecProperties ) const;
249 
250  /**
251  * This method evaluades the Fib-object.
252  * Evertime a Fib-elements, with a type of the given type chars in
253  * liCFibElementTyps, is reached while evaluation, it is given
254  * back with the properties which it has.
255  * Ever pointelement is given back. The type chars for pointelements
256  * don't need to be in the list liCFibElementTyps.
257  *
258  * @param evalueFibElement a reference to the object with the
259  * evalueelement() method to evalue /store the Fib-elements and ther
260  * properties; everytime a Fib-element (with one of the type given
261  * in liCFibElementTyps) is reached in the evaluation, the method
262  * evalueelement() of this objects is called with the Fib-element
263  * and the properties of the Fib-element; @see iEvalueFibElement
264  * @param objectPoint the object point in the order of true partobjects
265  * to evalue
266  * @param liVecProperties a list with the property vectors which should
267  * be global for the evalued object
268  * @param liCFibElementTyps a list with the type chars (@see getType() )
269  * of the Fib-elements to return
270  * @return if the evalueation was successfull true, else false
271  */
272  virtual bool evalueObject( iEvalueFibElement & evalueFibElement,
273  const unsignedIntFib objectPoint,
274  list<cVectorProperty> & liVecProperties,
275  const list<char> & liCFibElementTyps );
276 
277  /**
278  * This method evaluades a value for the time needed to evalue the
279  * object.
280  * This value should not exceed lMaxTime, if the value for the time
281  * is greater than lMaxTime the evaluation will be stopt and lMaxTime
282  * returned. If lMaxTime is 0 (for infinity) the evaluation won't be
283  * stoped, this is the standard case.
284  *
285  * @see evalueObject()
286  * @param lMaxTime the maximum time for the evaluation, the returned
287  * exceed this value; the value 0 stands for infinity, so the
288  * evaluation won't be stoped
289  * @return a value for the time needed to evalue the object
290  */
291  virtual unsignedLongFib getTimeNeed( unsignedLongFib lMaxTime=0 ) const;
292 
293  /**
294  * This method evaluades the size of the Fib-object in bits in the
295  * compressed file form.
296  * The optionalpart field of external object elements will not be ignored.
297  *
298  * @see storeBit()
299  * @return the size of the Fib-object in bits in the compressed form
300  */
301  virtual unsignedLongFib getCompressedSize() const;
302 
303  /**
304  * This method replace the variable pVariableOld with the variable
305  * pVariableNew in the object.
306  *
307  * @see cFibVariable
308  * @see isUsedVariable()
309  * @see isDefinedVariable()
310  * @param pVariableOld the variable to replace
311  * @param pVariableNew the variable with which the variable variableOld
312  * is to be replace
313  * @return true if the variable pVariableOld is replaced with pVariableNew,
314  * else false
315  */
316  virtual bool replaceVariable( cFibVariable * pVariableOld,
317  cFibVariable * pVariableNew );
318 
319  /**
320  * This method checks if the given variable is used in the given
321  * direction from this fib-element.
322  *
323  * @see cFibVariable
324  * @see isDefinedVariable()
325  * @param variable the variable to check if it is used
326  * @param direction the direction from this fib-element, in which the
327  * variable should be used; standardvalue is ED_POSITION so yust
328  * this fib-element will be checked
329  * @return true if the variable is used, else false
330  */
331  virtual bool isUsedVariable( const cFibVariable *variable ,
332  edDirection direction=ED_POSITION ) const;
333 
334  /**
335  * This method returns all variables used in the given direction from
336  * this fib-element.
337  *
338  * @see cFibVariable
339  * @see isUsedVariable()
340  * @see isDefinedVariable()
341  * @param direction the direction from this fib-element, in which the
342  * variable should be used; standardvalue is ED_POSITION so yust
343  * this fib-element will be checked
344  * @return the set with all variables used in the given direction from
345  * this fib-element
346  */
347  virtual set<cFibVariable*> getUsedVariables( edDirection direction=ED_POSITION );
348 
349  /**
350  * @return true if this Fib-element is movebel else false
351  */
352  virtual bool isMovable() const;
353 
354 
355  /**
356  * This method copies the Fib-element on the specified position.
357  * Variables which are not defined in the Fib-element but used
358  * don't change ther reference.
359  *
360  * @see getType()
361  * @param cType the type of the Fib-element to copy
362  * @param elementPoint the number of the Fib-element, in the order of
363  * Fib-elements of the given type cType, to copy
364  * @param bAbsolute if the lNumber is an absolute value for the wool
365  * Fib-object
366  * @return the copy of the Fib-element
367  */
368  virtual cFibElement * copyElement( const char cType='u', const unsignedIntFib
369  elementPoint=0, bool bAbsolute=false ) const;
370 
371 #ifndef FEATURE_EQUAL_FIB_OBJECT
372 
373  /**
374  * This method checks if the given Fib-object is equal to this Fib
375  * -object.
376  * Variables can be others, but must be defined and used in equivalent
377  * Fib-elements.
378  *
379  * @param fibObject the Fib-object to which this Fib-object should be
380  * equal
381  * @return true if this Fib-object is equal to the given Fib-object,
382  * else false
383  */
384  virtual bool equal( const cFibElement & fibObject ) const;
385 
386  /**
387  * This method checks if the given Fib-element is equal to this
388  * Fib-element.
389  * The subobjects arn't compared, not even ther count is compared.
390  * Used variables can be others.
391  *
392  * @param fibelement the Fib-element to which this Fib-element should be
393  * equal
394  * @return true if this Fib-element is equal to the given Fib-object,
395  * else false
396  */
397  virtual bool equalElement( const cFibElement & fibelement ) const;
398 
399  /**
400  * This method checks if the given Fib-element sets the variable to
401  * the same values as this Fib-element.
402  *
403  * @param variableOwn a pointer to a defined variable in this Fib-element,
404  * it is compared to the equivalent variable pVariable in the given
405  * Fib-element fibelement
406  * @param fibelement the Fib-element to which this Fib-element should be
407  * compared
408  * @param variable a pointer to a defined variable in the other
409  * Fib-element fibelement
410  * @return true if this Fib-element sets the variable to the same
411  * values as the Fib-element fibElement
412  */
413  virtual bool equalValuesSet( const cFibVariable * variableOwn,
414  const cFibElement & fibelement,
415  const cFibVariable * variable ) const;
416 
417 #endif //FEATURE_EQUAL_FIB_OBJECT
418 
419  /**
420  * This method stores this Fib-object in the XML -format into the
421  * given stream.
422  *
423  * @param stream the stream where this Fib-object should be stored to
424  * @return true if this Fib-object is stored, else false
425  */
426  virtual bool storeXml( ostream & stream ) const;
427 
428 
429  /**
430  * This method inserts the given Fib-element fibelement on the
431  * specified position. The replaced Fib-element will be the subobject
432  * of the inserted Fib-element fibelement.
433  *
434  * @see getNumberOfElement()
435  * @see getNumberOfElements()
436  * @see getType()
437  * @param cType the type of the Fib-element insted of which the given
438  * Fib-element fibelement should be inserted
439  * @param elementPoint the number of the Fib-element, in the order of
440  * Fib-elements of the given type cType, in which position the given
441  * Fib-element fibelement should be inserted; if 0 the given
442  * fibelement will be inserted under this Fib-element
443  * @param fibelement the Fib-element to insert
444  * @param bAbsolute if the lNumber is an absolute value for the wool
445  * Fib-object
446  * @param bCheckVariables if true (standardvalue) it will be checked if
447  * the variables the Fib-element defines are needed, else the
448  * Fib-element will be removed even if its variables are needed elsewher
449  * @return true if the Fib-element fibelement was inserted, else false
450  */
451  virtual bool insertElement( cFibElement *fibelement, const char cType='u',
452  const unsignedIntFib elementPoint=0, bool bAbsolute=false,
453  bool bCheckVariables=true );
454 
455 
456  /**
457  * This method inserts the given Fib-object pFibObject on the
458  * specified position. In limb elements on the specified position a
459  * list element will be inserted, with the old Fib-object and the
460  * given Fib-object pFibObject as its subobjects.
461  *
462  * @see getNumberOfElement()
463  * @see getNumberOfElements()
464  * @see overwriteObjectWithObject()
465  * @see getType()
466  * @param cType the type of the Fib-element, on which position the
467  * given Fib-object fibObject should be inserted
468  * @param elementPoint the number of the Fib-element, in the order of
469  * Fib-elements of the given type cType, on which position the given
470  * Fib-object fibObject should be inserted
471  * @param fibObject the Fib-object to insert
472  * @param first if true, the inserted object will be the first
473  * subobject of the new list element
474  * @param bAbsolute if the lNumber is an absolute value for the wool
475  * Fib-object
476  * @return true if the Fib-object fibObject was inserted, else false
477  */
478  virtual bool insertObjectInElement( cFibElement *fibObject, const char cType='u',
479  const unsignedIntFib elementPoint=0, bool first=true,
480  bool bAbsolute=false );
481 
482  /**
483  * This method overwrites the Fib-object on specified position with
484  * the given Fib-object fibObject. The Fib-object on specified
485  * position will be replaced with the given Fib-object fibObject.
486  *
487  * @see getNumberOfElement()
488  * @see getNumberOfElements()
489  * @see insertObjectInElement()
490  * @see getType()
491  * @param cType the type of the Fib-element, on which position the
492  * given Fib-object fibObject should be inserted
493  * @param elementPoint the number of the Fib-element, in the order of
494  * Fib-elements of the given type cType, on which position the given
495  * Fib-object fibObject should be inserted
496  * @param fibObject the Fib-object to insert
497  * @param bDeleteOld if true, delete the old Fib-object from the memory
498  * @param bAbsolute if the elementPoint is an absolute value for the wool
499  * Fib-object
500  * @return true if the old Fib-object was overwritten and the given
501  * Fib-object fibObject was inserted, else false
502  */
503  virtual bool overwriteObjectWithObject( cFibElement *fibObject, const char cType='u',
504  const unsignedIntFib elementPoint=0, bool bDeleteOld=true,
505  bool bAbsolute=false );
506 
507  /**
508  * This method cuts the Fib-element on the specified position.
509  * This works like removeElement(), except that the removed element is
510  * returned.
511  *
512  * @see isDeletableelement()
513  * @see removeElement()
514  * @see getType()
515  * @param cType the type of the Fib-element to cut
516  * @param elementPoint the number of the Fib-element, in the order of
517  * Fib-elements of the given type cType, to cut
518  * @param bAbsolute if the elementPoint is an absolute value for the wool
519  * Fib-object
520  * @param bCheckVariables if true (standardvalue) it will be checked if
521  * the variables the Fib-element defines are needed, else the
522  * Fib-element will be removed even if its variables are needed elsewher
523  * @return the pointer to the cuted Fib-element or NULL, if the Fib
524  * -element couldn't cut
525  */
526  virtual cFibElement * cutElement( const char cType='u', const unsignedIntFib
527  elementPoint=0, bool bAbsolute=false, bool bCheckVariables=true );
528 
529  /**
530  * This method moves a Fib-limb -element (cFibLimb) on the specified
531  * position over iHowfar Fib-elements.
532  * Moving is stoped if an invalid Fib-object would result (e.g. no Fib
533  * -element can be moved over an Fib-elements that defines a variable
534  * the moved Fib-element uses).
535  * Moving an Fib-element into an list element will result in an
536  * list element with the moved element in everyone of it's subobjects.
537  *
538  * @see isDeletableelement()
539  * @see removeElement()
540  * @see getType()
541  * @param cType the type of the Fib-element to move
542  * @param elementPoint the number of the Fib-element, in the order of
543  * Fib-elements of the given type cType, to move
544  * @param iHowfar the number of Fib-elements over which the to move
545  * Fib-element should be moved; if this value is positiv the Fib
546  * -element will be moved over Fib-elements it contains else over
547  * Fib-elements it is contained in
548  * @param bAbsolute if the elementPoint is an absolute value for the wool
549  * Fib-object
550  * @return the number of Fib-elements over which the to move Fib
551  * -element was moved; if this value is positiv the Fib-element
552  * was moved over Fib-elements it contains else over Fib-elements
553  * it is contained in
554  */
555  virtual intFib moveLimbElement( const char cType='u', const unsignedIntFib
556  elementPoint=0, const intFib iHowfar=1, bool bAbsolute=false );
557 
558 
559 
560 /*
561  * external objects element methods
562  */
563 
564 
565  /**
566  * @return The identifier of the external Fib-object this external
567  * element stands for. @see lIdentifier
568  */
569  longFib getIdentifier() const;
570 
571  /**
572  * This method sets identifier of the external Fib-object this external
573  * element stands for.
574  * @see lIdentifier
575  *
576  * @param lInIdentifier The to set identifier of the external Fib-object
577  * this external element stands for.
578  */
579  void setIdentifier( const longFib lInIdentifier );
580 
581  /**
582  * @see vecInputValues
583  * @see getNumberOfInputValues()
584  * @see setNumberOfInputValues()
585  * @return the vector with the input values of this external object element
586  * @see vecInputValues
587  */
589 
590  /**
591  * @see vecInputValues
592  * @see getNumberOfInputValues()
593  * @see setNumberOfInputValues()
594  * @return the vector with the input values of this external object element
595  * @see vecInputValues
596  */
597  const cVectorExtObject * getInputVector() const;
598 
599  /**
600  * @see vecInputValues
601  * @see setNumberOfInputValues()
602  * @see getInputVector()
603  * @return the number of input values of this external element element
604  * @see vecInputValues
605  */
607 
608  /**
609  * This method sets the number of input values, this external object
610  * element has, to the given number.
611  *
612  * @see vecInputValues
613  * @see getNumberOfInputValues()
614  * @see getInputVector()
615  * @param uiNumberOfInputValues the number of input values this external
616  * object element should have
617  */
619  const unsignedIntFib uiNumberOfInputValues );
620 
621  /**
622  * @see vecSubobjects
623  * @see setNumberOfSubobject()
624  * @see getSubobject()
625  * @see setSubobject()
626  * @see addSubobject()
627  * @see deleteSubobject()
628  * @return the count of subobjects in this external object element
629  */
631 
632  /**
633  * This method sets the number of subobjects, this external object
634  * element have, to the given number. It will create or delete
635  * subobjects as necessary, wher created subobjects are NULL with 0
636  * output variables.
637  * The delete process will beginn on the end of the subobject list
638  * and stop if enough subobject are deleted.
639  *
640  * @see vecSubobjects
641  * @see getNumberOfSubobjects()
642  * @see getSubobject()
643  * @see setSubobject()
644  * @see addSubobject()
645  * @see deleteSubobject()
646  * @param uiNumberOfSubobjects the number of subobjects this external
647  * object element should have
648  * @param bDeleteOld if true, delete the old subobject from the memory
649  */
650  void setNumberOfSubobjects( const unsignedIntFib uiNumberOfSubobjects,
651  bool bDeleteOld=true );
652 
653  /**
654  * @see vecSubobjects
655  * @see setSubobject()
656  * @see getNumberOfSubobjects()
657  * @see setNumberOfSubobject()
658  * @see addSubobject()
659  * @see deleteSubobject()
660  * @param uiNumberSubobject the number of the subobject to
661  * return, @see vecSubobjects
662  * @return a pointer to the uiNumberSubobject'th subobject of
663  * this external object element or NULL if non such exists
664  */
665  cFibElement * getSubobject( const unsignedIntFib uiNumberSubobject );
666 
667  /**
668  * This method sets the iNumberSubobject'th subobject of this
669  * external object element to the given subobject.
670  * It will create new subobjects if ther are less than uiNumberSubobject
671  * subobjects (@see setNumberOfSubobject() ).
672  * The output variables for the iNumberSubobject'th subobject won't change.
673  *
674  * @see vecSubobjects
675  * @see getSubobject()
676  * @see getNumberOfSubobjects()
677  * @see setNumberOfSubobject()
678  * @see addSubobject()
679  * @see deleteSubobject()
680  * @param uiNumberSubobject the number of the subobject to set
681  * (counting from 1)
682  * @param pFibObject the pointer to the uiNumberVariable'th subobject
683  * this external object should have
684  * @param bDeleteOld if true, delete the old subobject from the memory
685  * @return true if the subobject was set to the given subobject,
686  * else false
687  */
688  bool setSubobject( const unsignedIntFib uiNumberSubobject,
689  cFibElement* pFibObject, bool bDeleteOld=true );
690 
691  /**
692  * This method returns the number of output variables of the
693  * uiNumberOfSubobject extern subobject in this external object element, or
694  * 0 if the subobject dosn't exists.
695  *
696  * @see vecSubobjects
697  * @see setNumberOfOutputVariables()
698  * @see getOutputVariables()
699  * @see getOutputVariable()
700  * @param uiNumberOfSubobject the number of the subobject for which
701  * the number of output variables is to be returned
702  * @return the count of output variables of the uiNumberOfSubobject
703  * extern subobject in this external object element, or 0 if the
704  * subobject dosn't exists
705  */
707  const unsignedIntFib uiNumberOfSubobject ) const;
708 
709  /**
710  * This method sets the number of output variables of the
711  * uiNumberOfSubobject'th extern subobject in this external object
712  * element to the given value uiNumberOfVariables.
713  *
714  * @see vecSubobjects
715  * @see getNumberOfOutputVariables()
716  * @see getOutputVariables()
717  * @see getOutputVariable()
718  * @param uiNumberOfSubobject the number of the subobject for which
719  * the number of output variables is to be set
720  * @param uiNumberOfVariables the number of output variables the
721  * uiNumberOfSubobject'th subobject of this external object
722  * element should have
723  * @return the new number of output variables the
724  * uiNumberOfSubobject'th subobject of this external object
725  * element have
726  */
728  const unsignedIntFib uiNumberOfSubobject,
729  const unsignedIntFib uiNumberOfVariables );
730 
731  /**
732  * This method returns a vector with the pointers to the output
733  * variables of the uiNumberOfSubobject'th subobject.
734  *
735  * @see vecSubobjects
736  * @see getOutputVariable()
737  * @see getNumberOfOutputVariables()
738  * @see setNumberOfOutputVariables()
739  * @param uiNumberOfSubobject the number of the subobject for which
740  * the output variables should be returned
741  * @return a vector with the pointers to the output variables of the
742  * uiNumberOfSubobject'th subobject, or an empty list if non exists
743  */
744  vector< cFibVariable* > getOutputVariables(
745  const unsignedIntFib uiNumberOfSubobject );
746 
747  /**
748  * This method returns a pointer to the uiNumberOfInputVariable'th
749  * output variable of the uiNumberOfSubobject'th subobject of
750  * this external object element.
751  *
752  * @see vecSubobjects
753  * @see getOutputVariables()
754  * @see getNumberOfOutputVariables()
755  * @see setNumberOfOutputVariables()
756  * @param uiNumberOfSubobject the number of the subobject for which
757  * the output variable should be returned
758  * @param uiNumberOfOutputVariable the number of the output variable of
759  * the uiNumberOfSubobject'th subobject to return
760  * @return a pointer to the uiNumberOfInputVariable'th output variable of
761  * the uiNumberOfSubobject'th subobject of this external object element,
762  * or NULL if non exists
763  */
764  cFibVariable * getOutputVariable( const unsignedIntFib uiNumberOfSubobject,
765  const unsignedIntFib uiNumberOfOutputVariable );
766 
767  /**
768  * This method adds the given subobject to the subobjects of this extern
769  * object element.
770  * This will fail if:
771  * - ther is no subobject (pSubobject==NULL)
772  *
773  * @see vecSubobjects
774  * @see getSubobject()
775  * @see setSubobject()
776  * @see deleteSubobject()
777  * @see getNumberOfSubobjects()
778  * @see setNumberOfSubobject()
779  * @see getOutputVariables()
780  * @see getNumberOfOutputVariables()
781  * @see setNumberOfOutputVariables()
782  * @param pSubobject a pointer to the subobject to add; the object
783  * will not be copied, so don't delete it
784  * @param uiPosition the position on which the subobject is to insert in
785  * this extern object element subobject vector (counting begins with 1),
786  * if 0 or greater the number of subobjects the subobject will be
787  * inserted to the end of the subobject list
788  * @param uiNumberOfOutVar the number of output variables of the subobject
789  * to add should have
790  * @return true if the subobject pSubobject was inserted, else false
791  */
792  bool addSubobject( cFibElement * pSubobject, unsignedIntFib uiPosition = 0,
793  const unsignedIntFib uiNumberOfOutVar = 0 );
794 
795  /**
796  * This method deletes the uiSubobjectNumber'th subobject in this extern
797  * object element.
798  *
799  * @see vecSubobjects
800  * @see getSubobject()
801  * @see setSubobject()
802  * @see addSubobject()
803  * @see getNumberOfSubobjects()
804  * @see setNumberOfSubobject()
805  * @see getOutputVariables()
806  * @see getNumberOfOutputVariables()
807  * @see setNumberOfOutputVariables()
808  * @param uiSubobjectNumber the number of the subobject in the subobject
809  * vector to delete
810  * @param bDeleteOld if true the subobject will be removed from the memory,
811  * else yust the reference will be removed from this extern object
812  * element;default is true
813  * @return true if the uiSubobjectNumber'th subobject was deleted, else false
814  */
815  bool deleteSubobject( unsignedIntFib uiSubobjectNumber,
816  bool bDeleteOld=true );
817 
818 
819 protected:
820 
821  /**
822  * This method stores this Fib-object in the compressed Fib-format
823  * into the given stream.
824  * It is needed because the stream can yust store byts but the size of
825  * Fib-elements can be any number of bits. Because of that ther have to
826  * be a possibility to exchange the missing bits betwean the Fib-elements.
827  *
828  * @see store
829  * @param stream the stream where this Fib-object should be stored to
830  * @param cRestBits the not yet writen bits which should be stored
831  * @param uiRestBitPosition the number of bits in the cRestBits which
832  * should be writen respectively containing valid information
833  * @return true if this Fib-object is stored, else false
834  */
835  virtual bool storeBit( ostream & stream, char & cRestBits,
836  unsigned char & uiRestBitPosition ) const;
837 
838  /**
839  * This method sets each variable, which is defined over an leaf,
840  * to an uniqe integer number greater than the given number
841  * uiLastVariableNumber. While storing this number can be used to
842  * identify the variable.
843  *
844  * @param uiLastVariableNumber the number which was last used, this
845  * means also is the greatest used, in this object
846  * @return the number which was last use, this
847  * means also is the greatest used, in this object
848  * from the method
849  */
851  unsignedIntFib uiLastVariableNumber = 0 );
852 
853  /**
854  * This method cuts the connections of this Fib-element to the
855  * given Fib-element.
856  *
857  * @param pFibElement the Fib-element to which to cut the connection
858  */
859  virtual void cutConnectionsTo( const cFibElement * pFibElement );
860 
861  /**
862  * This method syncronises the subobjects of this cExtObject-class with
863  * the subobjects list @see fibSubobjects of the cFibBranch class.
864  */
865  void syncSubobjects();
866 
867  /**
868  * This method copies the connected object with the given number in the
869  * order of connected objects.
870  * For this every Fib-element, beginning from this Fib-element, that
871  * is part of the connected object will be copied.
872  * Variables which are not defined in the connected object but used
873  * don't change ther reference.
874  * It is an help method for the copy method. It dosn't update the
875  * structural information of the created Fib-object.
876  *
877  * @see copy()
878  * @param iObjectPoint the number of the connected object to copy;
879  * the standartvalue is 0 for coping the complet actual object
880  * @return the copy of the connected object or NULL if non such exists
881  */
882  virtual cExtObject * copyInternal( const unsignedIntFib iObjectPoint = 0 ) const;
883 
884  /**
885  * This method checks if the given variable is defined in the given
886  * direction from this Fib-element.
887  * This is for intern use to get the correct data from
888  * isDefinedVariable() without pCallingFibElement.
889  *
890  * @see cFibVariable
891  * @see isUsedVariable()
892  * @param pVariable the variable to check if it is defined
893  * @param direction the direction from this Fib-element, in which the
894  * variable should be defined; standardvalue is ED_POSITION so yust
895  * this Fib-element will be checked
896  * @param pCallingFibElement the Fib-Element which called this method
897  * @return true if the variable is used, else false
898  */
899  virtual bool isDefinedVariableInternal( const cFibVariable * pVariable,
900  edDirection direction = ED_POSITION,
901  const cFibElement * pCallingFibElement = NULL ) const;
902 
903  /**
904  * This method returns all variables defined in the given direction from
905  * this Fib-element.
906  * This is for intern use to get the correct data from
907  * getDefinedVariables() without pCallingFibElement..
908  *
909  * @see cFibVariable
910  * @see getUsedVariables()
911  * @see isDefinedVariable()
912  * @param direction the direction from this Fib-element, in which the
913  * variable should be used; standardvalue is ED_POSITION so yust
914  * this Fib-element will be checked
915  * @param pCallingFibElement the Fib-Element which called this method
916  * @return the set with all variables used in the given direction from
917  * this Fib-element
918  */
919  virtual list< cFibVariable* > getDefinedVariablesInternal(
920  edDirection direction = ED_HIGHER,
921  const cFibElement * pCallingFibElement = NULL );
922 
923 
924 #ifdef FEATURE_EQUAL_FIB_OBJECT
925 
926  /**
927  * This method checks if the given Fib-object is equal to this fib
928  * -object.
929  * Variables can be others, but must be defined and used in equivalent
930  * Fib-elements.
931  *
932  * @param fibObject the Fib-object to which this Fib-object should be
933  * equal
934  * @param mapEqualRootObjects the root objects of this object that wher
935  * already checked as equal
936  * map entries:
937  * key: the root-element of this Fib object that was checked
938  * value: the to the key correspondending root-element of the
939  * fibObject that was checked and which is equal to the key
940  * root-element
941  * (it is empty if bCheckExternalObjects == false)
942  * @param mapEqualDefinedVariables the Fib elements that defines
943  * variables and are equal;
944  * map entries:
945  * key: the Fib element of this Fib object that was checked
946  * value: the to the key correspondending Fib element of the
947  * fibObject that was checked and which sets its defined
948  * variables to the same values as the key Fib element
949  * @param bCheckExternalObjects if true the external objects of
950  * cExtObject will be compared
951  * @return true if this Fib-object is equal to the given Fib-object,
952  * else false
953  */
954  virtual bool equalInternal( const cFibElement & fibObject,
955  map< const cRoot *, const cRoot * > & mapEqualRootObjects,
956  map< const cFibElement *, const cFibElement * > & mapEqualDefinedVariables,
957  const bool bCheckExternalObjects ) const;
958 
959  /**
960  * This method checks if the given Fib-element is equal to this fib
961  * -element.
962  * The subobjects arn't compared, not even ther count is compared.
963  * Used variables can be others.
964  *
965  * @param fibElement the Fib-element to which this Fib-element should be
966  * equal
967  * @param mapEqualRootObjects the root objects of this object that wher
968  * already checked as equal
969  * map entries:
970  * key: the root-element of this Fib object that was checked
971  * value: the to the key correspondending root-element of the
972  * fibObject that was checked and which is equal to the key
973  * root-element
974  * (it is empty if bCheckExternalObjects == false)
975  * @param mapEqualDefinedVariables the Fib elements that defines
976  * variables and are equal;
977  * map entries:
978  * key: the Fib element of this Fib object that was checked
979  * value: the to the key correspondending Fib element of the
980  * fibObject that was checked and which sets its defined
981  * variables to the same values as the key Fib element
982  * @param bCheckExternalObjects if true the external objects of
983  * cExtObject will be compared
984  * @return true if this Fib-element is equal to the given Fib-object,
985  * else false
986  */
987  virtual bool equalElementInternal( const cFibElement & fibElement,
988  map< const cRoot *, const cRoot * > & mapEqualRootObjects,
989  map< const cFibElement *, const cFibElement * > & mapEqualDefinedVariables,
990  const bool bCheckExternalObjects ) const;
991 
992 
993  /**
994  * This method checks if the given Fib-element sets the variable to
995  * the same values as this Fib-element.
996  *
997  * @param variableOwn a pointer to a defined variable in this Fib-element,
998  * it is compared to the equivalent variable fibElement in the given
999  * Fib-element fibElement
1000  * @param fibElement the Fib-element to which this Fib-element should be
1001  * compared
1002  * @param variable a pointer to a defined variable in the other
1003  * Fib-element fibElement
1004  * @param mapEqualRootObjects the root objects of this object that wher
1005  * already checked as equal
1006  * map entries:
1007  * key: the root-element of this Fib object that was checked
1008  * value: the to the key correspondending root-element of the
1009  * fibObject that was checked and which is equal to the key
1010  * root-element
1011  * (it is empty if bCheckExternalObjects == false)
1012  * @param mapEqualDefinedVariables the Fib elements that defines
1013  * variables and are equal;
1014  * map entries:
1015  * key: the Fib element of this Fib object that was checked
1016  * value: the to the key correspondending Fib element of the
1017  * fibObject that was checked and which sets its defined
1018  * variables to the same values as the key Fib element
1019  * @param bCheckExternalObjects if true the external objects of
1020  * cExtObject will be compared
1021  * @return true if this Fib-element sets the variable to the same
1022  * values as this Fib-element
1023  */
1024  virtual bool equalValuesSetInternal( const cFibVariable * variableOwn,
1025  const cFibElement & fibElement,
1026  const cFibVariable * variable,
1027  map< const cRoot *, const cRoot * > & mapEqualRootObjects,
1028  map< const cFibElement *, const cFibElement * > & mapEqualDefinedVariables,
1029  const bool bCheckExternalObjects ) const;
1030 
1031 #endif //FEATURE_EQUAL_FIB_OBJECT
1032 
1033 };//class cExtObject
1034 }//namespace fib
1035 
1036 #endif //___C_EXT_OBJECT_H__
1037 
1038 
1039 
1040 
1041 
1042