1 -- Created on: 1992-02-19
2 -- Created by: Jean Pierre TIRAULT
3 -- Copyright (c) 1992-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- Revised: Thu Jan 7 17:26:12 1993
18 -- By : Mireille MERCIEN
21 generic class HDataMap from PCollection (Key as Storable;
26 ---Purpose: A map is a Collection of bindings
27 -- between two objects. One is considered as
28 -- the key and a hash code value must be
32 raises MultiplyDefined from Standard,
33 NoMoreObject from Standard,
34 NoSuchObject from Standard
39 class MapNode inherits PManaged
40 ---Purpose: This class is used in the implementation of Map class.
43 Create( aKey : Key ; anItem : Item ; aNext : MapNode)
44 returns mutable MapNode from PCollection;
46 GetKey (me) returns any Key is static;
48 ---Purpose: Returns myKey
50 Value(me) returns any Item is static;
52 ---Purpose: Returns myItem.
54 Next(me) returns mutable MapNode is static;
56 ---Purpose: Returns myNext.
58 SetKey (me : mutable ; aKey : Key) is static;
60 ---Purpose: Modifies myKey.
62 SetValue( me : mutable; anItem: Item) is static;
64 ---Purpose: Modifies myItem.
66 SetNext( me : mutable; aNode: MapNode) is static;
68 ---Purpose: Modifies myNext.
70 ShallowCopy(me) returns mutable like me
73 ---Purpose: ShallowCopy redefinition
76 ShallowDump (me; s: in out OStream)
79 ---Purpose: ShallowDump redefinition
90 class Array instantiates HArray1 from PCollection(MapNode);
94 raises NoMoreObject from Standard,
95 NoSuchObject from Standard
97 ---Purpose: This class provides to iterate on a Map from the
98 -- first bucket entry to the last one in the table;
99 -- Going through the associated list for each bucket entry.
101 Create( aMap: HDataMap)
102 ---Purpose: Creates an iterator on <aMap> .
107 ---Purpose: Returns True if there is still an element to be read.
108 returns Boolean from Standard;
110 Next( me: in out) raises NoMoreObject from Standard;
112 ---Purpose: Goes to next element of <me>.
117 raises NoSuchObject from Standard;
122 raises NoSuchObject from Standard;
133 Create(NbBuckets : Integer ; F : FH) returns mutable HDataMap;
134 ---Purpose: Creation of a map of NbBuckets entries.
135 -- the table is empty.
136 -- If NbBuckets eq. 0 an exception will be raised.
138 NbBuckets(me) returns Integer from Standard;
140 ---Purpose: Returns the number of entries in the table.
142 IsEmpty(me) returns Boolean from Standard;
144 ---Purpose: Returns true if the table is empty.
146 Extent(me) returns Integer from Standard ;
148 ---Purpose: Returns the number of elements in the table.
149 ---Example: if me is the hash table ((a x)(b y)(c z)) Extent
152 IsBound(me; K : Key) returns Boolean;
154 ---Purpose: Returns True if an element is bounded to K
156 Find(me; K : Key) returns any Item raises NoSuchObject;
158 ---Purpose: Returns the element bounded to K.
159 -- Raises an exception if the binding does not exist.
161 -- me = ((a x)(b y)(c z)) , K = b
166 ---Purpose: Removes all the element in the table.
168 -- me = ((a x)(b y)(c z))
172 Bind(me:mutable; K : Key; T : Item)
173 raises MultiplyDefined;
175 ---Purpose: Creates a binding between a key K and an item T.
176 -- Raises an exception if the binding already exists.
178 -- me = ((a x)(b y)) , K = c , T = z
180 -- me = ((a x)(b y)(c z))
182 Rebind(me:mutable; K : Key; T : Item) raises NoSuchObject;
184 ---Purpose: Replaces the object binded to the key K by T.
185 -- Raises an exception if the binding does not exist.
187 -- me = ((a x)(b y)) , K = b , T = z
191 Unbind(me:mutable; K : Key) raises NoSuchObject;
193 ---Purpose: Removes the binding keyed by K.
194 -- Raises an exception if the binding does not exist.
196 -- me = ((a x)(b y)(c z)) , K = b
200 ShallowCopy(me) returns mutable like me
203 ---Purpose: ShallowCopy redefinition
204 ---C++: function call
207 ShallowDump (me; s: in out OStream)
210 ---Purpose: ShallowDump redefinition
211 ---C++: function call
214 GetArray (me) returns Array is private;
216 ---Purpose :Returns the field Buckets associated to the object.
219 GetFH (me) returns FH is private;
221 ---Purpose :Returns the field Hash associated to the object.
228 friends class MapIterator from PCollection