0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / TCollection / TCollection_BasicMapIterator.hxx
1 // Created on: 1993-02-26
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _TCollection_BasicMapIterator_HeaderFile
18 #define _TCollection_BasicMapIterator_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <Standard_Integer.hxx>
25 #include <Standard_Address.hxx>
26 #include <Standard_Boolean.hxx>
27 class TCollection_BasicMap;
28
29
30 //! This  class  provides    basic   services  for the
31 //! iterators  on Maps. The  iterators  are  inherited
32 //! from this one.
33 //!
34 //! The  iterator   contains  an   array   of pointers
35 //! (buckets). Each bucket is a  pointer  on a node. A
36 //! node contains a pointer on the next node.
37 //!
38 //! This class  provides also basic  services for  the
39 //! implementation of Maps.
40 //! A map iterator provides a step by step exploration of all
41 //! entries of a map. After initialization of a concrete derived
42 //! iterator, use in a loop:
43 //! -   the function More to know if there is a current entry for
44 //! the iterator in the map,
45 //! -   then the functions which read data on an entry of the
46 //! map (these functions are provided by each type of map),
47 //! -   then the function Next to set the iterator to the next   entry of the map.
48 //! Warning
49 //! -   A map is a non-ordered data structure. The order in
50 //! which entries of a map are explored by the iterator
51 //! depends on its contents, and change when the map is edited.
52 //! -   It is not recommended to modify the contents of a map
53 //! during iteration: the result is unpredictable.
54 class TCollection_BasicMapIterator 
55 {
56 public:
57
58   DEFINE_STANDARD_ALLOC
59
60   
61   //! Resets the iterator to the first node.
62   Standard_EXPORT void Reset();
63   
64   //! Returns true if there is a current entry for this iterator in the map.
65   //! Use the function Next to set this iterator to the position of
66   //! the next entry, if it exists.
67     Standard_Boolean More() const;
68   
69   //! Sets this iterator to the position of the next entry of the map.
70   //! Nothing is changed if there is no more entry to explore in
71   //! the map: this iterator is always positioned on the last entry
72   //! of the map but the function More returns false.
73   Standard_EXPORT void Next();
74
75
76
77
78 protected:
79
80   
81   //! Creates an empty iterator.
82   Standard_EXPORT TCollection_BasicMapIterator();
83   
84   //! Initialize on the first node in the buckets.
85   Standard_EXPORT TCollection_BasicMapIterator(const TCollection_BasicMap& M);
86   
87   //! Initialize on the first node in the buckets.
88   Standard_EXPORT void Initialize (const TCollection_BasicMap& M);
89
90
91   Standard_Address myNode;
92
93
94 private:
95
96
97
98   Standard_Integer myNbBuckets;
99   Standard_Address myBuckets;
100   Standard_Integer myBucket;
101
102
103 };
104
105
106 #include <TCollection_BasicMapIterator.lxx>
107
108
109
110
111
112 #endif // _TCollection_BasicMapIterator_HeaderFile