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.
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.
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
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef HYDROData_Iterator_HeaderFile
20 #define HYDROData_Iterator_HeaderFile
22 #include "HYDROData_Document.h"
24 #include <TDF_ChildIDIterator.hxx>
26 /**\class HYDROData_Iterator
27 * \brief Allows to iterate all objects by the document and kind of object.
29 * Using the document data structures, iterates through objects, filtered by
30 * kind of this object. This class must have information about all kinds of
31 * objects of the document: for correct iteration and creation of them.
33 class HYDROData_Iterator
37 * Initializes iterator by objects of the document.
38 * \param theDoc document to iterate
39 * \param theKind kind of the iterated object, can be UNKNOWN: to iterate all objects
41 HYDRODATA_EXPORT HYDROData_Iterator( const Handle(HYDROData_Document)& theDoc,
42 const ObjectKind theKind = KIND_UNKNOWN);
45 * Iterates to the next object
47 HYDRODATA_EXPORT void Next();
50 * Returns true if current object exists
52 HYDRODATA_EXPORT bool More() const;
55 * Returns the current object of the iterator.
57 HYDRODATA_EXPORT Handle(HYDROData_Entity) Current();
62 * Creates object in the document on the given label
63 * \param theDoc document where object will be located
64 * \param theKind kind of the new object, can not be UNKNOWN
66 static HYDRODATA_EXPORT Handle(HYDROData_Entity) CreateObject(
67 TDF_Label& theNewLabel,
68 const ObjectKind& theObjectKind );
71 * Returns object associated to the given label.
73 static HYDRODATA_EXPORT Handle(HYDROData_Entity) Object(
74 const TDF_Label& theLabel );
78 friend class HYDROData_Document;
79 friend class HYDROData_Entity;
82 * Creates object in the document, call HYDROData_Document method to create
83 * objects from other packages.
84 * \param theDoc document where object will be located
85 * \param theKind kind of the new object, can not be UNKNOWN
87 static Handle(HYDROData_Entity) CreateObject(
88 const Handle(HYDROData_Document)& theDoc,
89 const ObjectKind& theObjectKind );
91 TDF_ChildIDIterator myIter; ///< iterator by the objects in the document