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