0026203: Foundation Classes - provide method ::Swap() for NCollection_IndexedMap...
[occt.git] / src / NIS / NIS_ObjectsIterator.cxx
1 // Created on: 2007-09-03
2 // Created by: Alexander GRIGORIEV
3 // Copyright (c) 2007-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #include <NIS_ObjectsIterator.hxx>
17 #include <NIS_InteractiveContext.hxx>
18
19 //=======================================================================
20 //function : NIS_ObjectsIterator()
21 //purpose  : Constructor
22 //=======================================================================
23
24 void NIS_ObjectsIterator::Initialize
25                         (const Handle(NIS_InteractiveContext)& theCtx)
26 {
27   if (theCtx.IsNull())
28     myIter = NCollection_SparseArray <Handle(NIS_InteractiveObject)>::Iterator();
29   else
30     for (myIter.Init (theCtx->myObjects); myIter.More(); myIter.Next())
31       if (myIter.Value().IsNull() == Standard_False)
32         break;
33 }
34
35 //=======================================================================
36 //function : Next
37 //purpose  : 
38 //=======================================================================
39
40 void NIS_ObjectsIterator::Next ()
41 {
42   for (myIter.Next(); myIter.More(); myIter.Next())
43     if (myIter.Value().IsNull() == Standard_False)
44       break;
45 }
46
47 //=======================================================================
48 //function : Value
49 //purpose  : 
50 //=======================================================================
51
52 const Handle(NIS_InteractiveObject)& NIS_ObjectsIterator::Value() const
53 {
54   if (More())
55     return myIter.Value();
56   static const Handle(NIS_InteractiveObject) aNullObj;
57   return aNullObj;
58 }