b311480e |
1 | // Created on: 2005-12-09 |
2 | // Created by: Alexander GRIGORIEV |
973c2be1 |
3 | // Copyright (c) 2005-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
16 | #include <TColStd_MapIteratorOfPackedMapOfInteger.hxx> |
17 | #include <TColStd_PackedMapOfInteger.hxx> |
18 | |
19 | class TColStd_intMapNode; |
20 | |
21 | extern Standard_Integer TColStd_intMapNode_findNext (const TColStd_intMapNode *, |
22 | unsigned int& ); |
23 | |
24 | //======================================================================= |
25 | //function : TColStd_MapIteratorOfPackedMapOfInteger |
26 | //purpose : Constructor |
27 | //======================================================================= |
28 | |
29 | TColStd_MapIteratorOfPackedMapOfInteger::TColStd_MapIteratorOfPackedMapOfInteger |
30 | (const TColStd_PackedMapOfInteger& theMap) |
31 | : TCollection_BasicMapIterator (theMap), |
302f96fb |
32 | myIntMask (~0U) |
7fd59977 |
33 | { |
34 | if (myNode) { |
35 | const TColStd_intMapNode * aNode = |
36 | reinterpret_cast <const TColStd_intMapNode *>(myNode); |
37 | myKey = TColStd_intMapNode_findNext (aNode, myIntMask); |
38 | } |
39 | } |
40 | |
41 | |
42 | //======================================================================= |
43 | //function : Initialize |
44 | //purpose : |
45 | //======================================================================= |
46 | |
47 | void TColStd_MapIteratorOfPackedMapOfInteger::Initialize |
48 | (const TColStd_PackedMapOfInteger& theMap) |
49 | { |
50 | TCollection_BasicMapIterator::Initialize (theMap); |
302f96fb |
51 | myIntMask = ~0U; |
7fd59977 |
52 | if (myNode) { |
53 | const TColStd_intMapNode * aNode = |
54 | reinterpret_cast <const TColStd_intMapNode *>(myNode); |
55 | myKey = TColStd_intMapNode_findNext (aNode, myIntMask); |
56 | } |
57 | } |
58 | |
59 | //======================================================================= |
60 | //function : Reset |
61 | //purpose : |
62 | //======================================================================= |
63 | |
64 | void TColStd_MapIteratorOfPackedMapOfInteger::Reset () |
65 | { |
66 | TCollection_BasicMapIterator::Reset(); |
302f96fb |
67 | myIntMask = ~0U; |
7fd59977 |
68 | if (myNode) { |
69 | const TColStd_intMapNode * aNode = |
70 | reinterpret_cast <const TColStd_intMapNode *>(myNode); |
71 | myKey = TColStd_intMapNode_findNext (aNode, myIntMask); |
72 | } |
73 | } |
74 | |
75 | //======================================================================= |
76 | //function : Next |
77 | //purpose : |
78 | //======================================================================= |
79 | |
80 | void TColStd_MapIteratorOfPackedMapOfInteger::Next () |
81 | { |
82 | while (myNode) { |
83 | const TColStd_intMapNode * aNode = |
84 | reinterpret_cast <const TColStd_intMapNode *>(myNode); |
85 | myKey = TColStd_intMapNode_findNext (aNode, myIntMask); |
86 | if (myIntMask != ~0u) |
87 | break; |
88 | TCollection_BasicMapIterator::Next(); |
89 | } |
90 | } |