Salome HOME
b24ee4b2cbffa3f09c2e4a065639cf92d666e167
[modules/hydro.git] / src / HYDROData / HYDROData_Iterator.h
1 #ifndef HYDROData_Iterator_HeaderFile
2 #define HYDROData_Iterator_HeaderFile
3
4 #include <HYDROData_Object.h>
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(Handle(HYDROData_Document) theDoc, ObjectKind theKind);
25
26   /**
27    * Iterates to the next object
28    */
29   HYDRODATA_EXPORT void Next();
30
31   /**
32    * Returns true if current object exists
33    */
34   HYDRODATA_EXPORT bool More() const;
35
36   /**
37    * Returns the current object of the iterator.
38    */
39   HYDRODATA_EXPORT Handle(HYDROData_Object) Current();
40
41 protected:
42
43   friend class HYDROData_Document;
44   friend class HYDROData_Image;
45
46   /**
47    * Creates object in the document, call HYDROData_Document method to create 
48    * objects from other packages.
49    * \param theDoc document where object will be located
50    * \param theKind kind of the new object, can not be UNKNOWN
51    */
52   static Handle_HYDROData_Object CreateObject(
53     Handle_HYDROData_Document theDoc, ObjectKind theKind);
54
55   /**
56    * Returns object associated to the given label.
57    */
58   static Handle_HYDROData_Object Object(const TDF_Label theLabel);
59
60   TDF_ChildIDIterator myIter; ///< iterator by the objects in the document
61 };
62
63 #endif