Salome HOME
Added object, attribute and data model organization in the document.
[modules/shaper.git] / src / Model / Model_Iterator.h
1 // File:        Model_Iterator.h
2 // Created:     1 Apr 2014
3 // Author:      Mikhail PONIKAROV
4
5 #ifndef Model_Iterator_HeaderFile
6 #define Model_Iterator_HeaderFile
7
8 #include "Model.h"
9 #include "ModelAPI_Iterator.h"
10 #include <TDF_Label.hxx>
11 #include <TDF_ChildIDIterator.hxx>
12
13 class Model_Document;
14
15 /**\class Model_Iterator
16  * \ingroup DataModel
17  * \brief Allows to iterate features of the document. Is created by the document
18  * (see method featuresIterator).
19  */
20
21 class MODEL_EXPORT Model_Iterator : public ModelAPI_Iterator
22 {
23   std::shared_ptr<Model_Document> myDoc; ///< the document of iterated objects
24   TDF_ChildIDIterator myIter; ///< iterator of the features-labels
25 public:
26   /// Iterates to the next feature
27   virtual void Next();
28   /// Returns true if the current iteration is valid and next iteration is possible
29   virtual bool More();
30   /// Returns the currently iterated feature
31   virtual std::shared_ptr<ModelAPI_Feature> Current();
32   /// Returns the kind of the current feature (faster than Current()->getKind())
33   virtual std::string CurrentKind();
34   /// Returns the name of the current feature (faster than Current()->getName())
35   virtual std::string CurrentName();
36
37 protected:
38   /// Initializes iterator
39   /// \param theDoc document where the iteration is performed
40   /// \param theLab label of the features group to iterate
41   Model_Iterator(std::shared_ptr<Model_Document> theDoc, TDF_Label theLab);
42
43   friend class Model_Document;
44 };
45
46 #endif