Salome HOME
Merging with V7_main branch.
[modules/hydro.git] / src / HYDROData / HYDROData_Iterator.h
1
2 #ifndef HYDROData_Iterator_HeaderFile
3 #define HYDROData_Iterator_HeaderFile
4
5 #include "HYDROData_Document.h"
6
7 #include <TDF_ChildIDIterator.hxx>
8
9 /**\class HYDROData_Iterator
10  * \brief Allows to iterate all objects by the document and kind of object.
11  *
12  * Using the document data structures, iterates through objects, filtered by 
13  * kind of this object. This class must have information about all kinds of 
14  * objects of the document: for correct iteration and creation of them.
15  */
16 class HYDROData_Iterator
17 {
18 public:
19   /**
20    * Initializes iterator by objects of the document.
21    * \param theDoc document to iterate
22    * \param theKind kind of the iterated object, can be UNKNOWN: to iterate all objects
23    */
24   HYDRODATA_EXPORT HYDROData_Iterator( const Handle(HYDROData_Document)& theDoc,
25                                        const ObjectKind theKind = KIND_UNKNOWN);
26
27   /**
28    * Iterates to the next object
29    */
30   HYDRODATA_EXPORT void Next();
31
32   /**
33    * Returns true if current object exists
34    */
35   HYDRODATA_EXPORT bool More() const;
36
37   /**
38    * Returns the current object of the iterator.
39    */
40   HYDRODATA_EXPORT Handle(HYDROData_Entity) Current();
41
42 public:
43
44   /**
45    * Creates object in the document on the given label
46    * \param theDoc document where object will be located
47    * \param theKind kind of the new object, can not be UNKNOWN
48    */
49   static HYDRODATA_EXPORT Handle(HYDROData_Entity) CreateObject(
50     TDF_Label&        theNewLabel, 
51     const ObjectKind& theObjectKind );
52
53   /**
54    * Returns object associated to the given label.
55    */
56   static HYDRODATA_EXPORT Handle(HYDROData_Entity) Object( 
57     const TDF_Label& theLabel );
58
59 protected:
60
61   friend class HYDROData_Document;
62   friend class HYDROData_Entity;
63
64   /**
65    * Creates object in the document, call HYDROData_Document method to create 
66    * objects from other packages.
67    * \param theDoc document where object will be located
68    * \param theKind kind of the new object, can not be UNKNOWN
69    */
70   static Handle(HYDROData_Entity) CreateObject(
71     const Handle(HYDROData_Document)& theDoc,
72     const ObjectKind&                 theObjectKind );
73
74   TDF_ChildIDIterator myIter; ///< iterator by the objects in the document
75 };
76
77 #endif