Salome HOME
PR: merge from branch BR_UnitTests tag mergeto_trunk_17oct05
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_SComponentIterator.cxx
1 //  File   : SALOMEDSImpl_SComponentIterator.cxx
2 //  Author : Sergey RUIN
3 //  Module : SALOME
4
5
6 #include "SALOMEDSImpl_SComponentIterator.hxx"
7 #include "SALOMEDSImpl_Study.hxx"
8
9 using namespace std;
10
11 //============================================================================
12 /*! Function : constructor
13  * 
14  */
15 //============================================================================
16
17 SALOMEDSImpl_SComponentIterator::SALOMEDSImpl_SComponentIterator(const Handle(TDocStd_Document)& theDocument)
18 {
19   _lab = theDocument->Main();
20   _it.Initialize (_lab);
21 }
22
23 //============================================================================
24 /*! Function : Init
25  * 
26  */
27 //============================================================================
28 void SALOMEDSImpl_SComponentIterator::Init()
29
30   _it.Initialize (_lab);
31 }
32
33 //============================================================================
34 /*! Function : More
35  * 
36  */
37 //============================================================================
38 bool SALOMEDSImpl_SComponentIterator::More()
39 {
40   if (!_it.More())
41     return false;
42   TDF_Label L = _it.Value();
43   if (SALOMEDSImpl_SComponent::IsA(L))
44      return true;
45
46   return _it.More();
47 }
48
49  //============================================================================
50 /*! Function : Next
51   */
52 //============================================================================
53 void SALOMEDSImpl_SComponentIterator::Next()
54 {
55   _it.Next();
56 }
57
58
59 //============================================================================
60 /*! Function : Value
61  * 
62  */
63 //============================================================================
64 Handle(SALOMEDSImpl_SComponent) SALOMEDSImpl_SComponentIterator::Value()
65 {
66   return SALOMEDSImpl_Study::SComponent(_it.Value());
67 }
68