Salome HOME
Merge remote-tracking branch 'origin/BR_SHAPE_RECOGNITION' into BR_v14_rc
[modules/hydro.git] / src / HYDROData / HYDROData_Iterator.h
1 // Copyright (C) 2014-2015  EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
6 //
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10 // Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 // modify it under the terms of the GNU Lesser General Public
20 // License as published by the Free Software Foundation; either
21 // version 2.1 of the License, or (at your option) any later version.
22 //
23 // This library is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26 // Lesser General Public License for more details.
27 //
28 // You should have received a copy of the GNU Lesser General Public
29 // License along with this library; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
31 //
32 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
33 //
34
35 #ifndef HYDROData_Iterator_HeaderFile
36 #define HYDROData_Iterator_HeaderFile
37
38 #include "HYDROData_Document.h"
39
40 #include <TDF_ChildIDIterator.hxx>
41
42 /**\class HYDROData_Iterator
43  * \brief Allows to iterate all objects by the document and kind of object.
44  *
45  * Using the document data structures, iterates through objects, filtered by 
46  * kind of this object. This class must have information about all kinds of 
47  * objects of the document: for correct iteration and creation of them.
48  */
49 class HYDROData_Iterator
50 {
51 public:
52   /**
53    * Initializes iterator by objects of the document.
54    * \param theDoc document to iterate
55    * \param theKind kind of the iterated object, can be UNKNOWN: to iterate all objects
56    */
57   HYDRODATA_EXPORT HYDROData_Iterator( const Handle(HYDROData_Document)& theDoc,
58                                        const ObjectKind theKind = KIND_UNKNOWN);
59
60   /**
61    * Iterates to the next object
62    */
63   HYDRODATA_EXPORT void Next();
64
65   /**
66    * Returns true if current object exists
67    */
68   HYDRODATA_EXPORT bool More() const;
69
70   /**
71    * Returns the current object of the iterator.
72    */
73   HYDRODATA_EXPORT Handle(HYDROData_Entity) Current();
74
75 public:
76
77   /**
78    * Creates object in the document on the given label
79    * \param theDoc document where object will be located
80    * \param theKind kind of the new object, can not be UNKNOWN
81    */
82   static HYDRODATA_EXPORT Handle(HYDROData_Entity) CreateObject(
83     TDF_Label&        theNewLabel, 
84     const ObjectKind& theObjectKind );
85
86   /**
87    * Returns object associated to the given label.
88    */
89   static HYDRODATA_EXPORT Handle(HYDROData_Entity) Object( 
90     const TDF_Label& theLabel );
91
92 protected:
93
94   friend class HYDROData_Document;
95   friend class HYDROData_Entity;
96
97   /**
98    * Creates object in the document, call HYDROData_Document method to create 
99    * objects from other packages.
100    * \param theDoc document where object will be located
101    * \param theKind kind of the new object, can not be UNKNOWN
102    */
103   static Handle(HYDROData_Entity) CreateObject(
104     const Handle(HYDROData_Document)& theDoc,
105     const ObjectKind&                 theObjectKind );
106
107   TDF_ChildIDIterator myIter; ///< iterator by the objects in the document
108 };
109
110 #endif