Salome HOME
Revert "Synchronize adm files"
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_UseCaseIterator.cxx
1 // Copyright (C) 2007-2014  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 //  File   : SALOMEDSImpl_UseCaseIterator.cxx
24 //  Author : Serge RUIN
25 //  Module : SALOME
26 //
27 #include "SALOMEDSImpl_UseCaseIterator.hxx"
28 #include "SALOMEDSImpl_SObject.hxx"
29 #include "SALOMEDSImpl_Study.hxx"
30
31 //============================================================================
32 /*! Function : empty constructor
33  *  Purpose  :
34  */
35 //============================================================================
36 SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator()
37 {
38   _node = NULL;    
39 }
40
41
42 //============================================================================
43 /*! Function : constructor
44  *  Purpose  :
45  */
46 //============================================================================
47 SALOMEDSImpl_UseCaseIterator::SALOMEDSImpl_UseCaseIterator(const DF_Label& theLabel, 
48                                                            const std::string& theGUID,
49                                                            const bool allLevels)
50 :_guid(theGUID), _levels(allLevels)
51 {
52   if((_node = (SALOMEDSImpl_AttributeTreeNode*)theLabel.FindAttribute(_guid))) {
53     _it.Initialize (_node, _levels);
54   }
55 }
56
57 //============================================================================
58 /*! Function : destructor
59  *  Purpose  :
60  */
61 //============================================================================
62 SALOMEDSImpl_UseCaseIterator::~SALOMEDSImpl_UseCaseIterator()
63 {
64 }
65
66 //============================================================================
67 /*! Function :Init
68  * 
69  */
70 //============================================================================
71 void SALOMEDSImpl_UseCaseIterator::Init(bool allLevels)
72
73   _it.Initialize (_node, allLevels);
74 }
75
76 //============================================================================
77 /*! Function : More
78  * 
79  */
80 //============================================================================
81 bool SALOMEDSImpl_UseCaseIterator::More()
82 {
83   return _it.More();
84 }
85
86 //============================================================================
87 /*! Function : Next
88  * 
89  */
90 //============================================================================
91 void SALOMEDSImpl_UseCaseIterator::Next()
92 {
93   _it.Next();
94 }
95
96
97 //============================================================================
98 /*! Function :
99  *  Purpose  :
100  */
101 //============================================================================
102
103 SALOMEDSImpl_SObject SALOMEDSImpl_UseCaseIterator::Value()
104 {
105   DF_Label L = _it.Value()->Label();
106   return SALOMEDSImpl_Study::SObject(L);
107 }
108
109 //============================================================================
110 /*! Function : GetPersistentCopy
111  * 
112  */
113 //============================================================================
114 SALOMEDSImpl_UseCaseIterator* SALOMEDSImpl_UseCaseIterator::GetPersistentCopy() const
115 {
116   SALOMEDSImpl_UseCaseIterator* itr = new SALOMEDSImpl_UseCaseIterator();
117   itr->_it = _it;
118   itr->_node = _node;
119   itr->_guid = _guid;
120   itr->_levels = _levels;
121   
122   return itr;
123 }