0026595: Lost some comments in OCCT-code after cdl elimination
[occt.git] / src / Transfer / Transfer_TransferMapOfProcessForTransient.hxx
1 // Created on: 1992-02-03
2 // Created by: Christian CAILLET
3 // Copyright (c) 1992-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 _Transfer_TransferMapOfProcessForTransient_HeaderFile
18 #define _Transfer_TransferMapOfProcessForTransient_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
23
24 #include <TCollection_BasicMap.hxx>
25 #include <TColStd_MapTransientHasher.hxx>
26 #include <Standard_Integer.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Address.hxx>
29 class Standard_DomainError;
30 class Standard_OutOfRange;
31 class Standard_NoSuchObject;
32 class Standard_Transient;
33 class Transfer_Binder;
34 class Transfer_IndexedDataMapNodeOfTransferMapOfProcessForTransient;
35
36
37
38 class Transfer_TransferMapOfProcessForTransient  : public TCollection_BasicMap
39 {
40 public:
41
42   DEFINE_STANDARD_ALLOC
43
44   
45   //! Constructs an IndexedDataMap with NbBuckets
46   //! (defaulted to 1) buckets.
47   //! Note that the map will be automatically redimensioned
48   //! during its use if the number of entries becomes too large.
49   //! Use:
50   //! -   the function Add to add an entry (key, item, index) in the map,
51   //! -   operator() to read an item from an index, or to
52   //! assign a new value to this item,
53   //! -   the function FindFromKey or ChangeFromKey to
54   //! read an item from a key, or to assign a new value to this item,
55   //! -   the function RemoveLast to remove the last entry from the map,
56   //! -   and other available edition and querying functions.
57   Standard_EXPORT Transfer_TransferMapOfProcessForTransient(const Standard_Integer NbBuckets = 1);
58   
59   //! Replace the content of this map by  the content of
60   //! the map <Other>.
61   Standard_EXPORT Transfer_TransferMapOfProcessForTransient& Assign (const Transfer_TransferMapOfProcessForTransient& Other);
62 Transfer_TransferMapOfProcessForTransient& operator = (const Transfer_TransferMapOfProcessForTransient& Other)
63 {
64   return Assign(Other);
65 }
66   
67   //! Changes the  number    of  buckets of  <me>  to be
68   //! <NbBuckets>. The entries (key + item + index) already
69   //! stored in this map are maintained.
70   Standard_EXPORT void ReSize (const Standard_Integer NbBuckets);
71   
72   //! Removes all keys in the map.
73   Standard_EXPORT void Clear();
74 ~Transfer_TransferMapOfProcessForTransient()
75 {
76   Clear();
77 }
78   
79   //! Adds  the Key  <K> to the  Map <me>.   Returns the
80   //! index of  the  Key.  The key is new  in the map if
81   //! Extent  has  been  incremented.  The Item  <I>  is
82   //! stored with the key. If the key was already in the
83   //! map the previous item is not replaced by <I>.
84   Standard_EXPORT Standard_Integer Add (const Handle(Standard_Transient)& K, const Handle(Transfer_Binder)& I);
85   
86   //! Substitutes the Key at  index <I>  with  <K>.  <I>
87   //! must be a valid index, <K> must  be a new key. <T>
88   //! becomes the Item stored with <K>.
89   //! Trigger: Raises OutOfRange if I < 1 or I > Extent.
90   //! Raises DomainError if Contains(K).
91   Standard_EXPORT void Substitute (const Standard_Integer I, const Handle(Standard_Transient)& K, const Handle(Transfer_Binder)& T);
92   
93   //! Removes  the last key entered  in the map, i.e the
94   //! key of index Extent().
95   //! I must be a valid index and K must be a new key.
96   //! Exceptions
97   //! -   Standard_OutOfRange if the index I is less than 1 or
98   //! greater than the number of entries in this map.
99   //! -   Standard_DomainError if the key K is already in this map.
100   Standard_EXPORT void RemoveLast();
101   
102   //! Returns True if the key <K>  is stored  in the map <me>.
103   Standard_EXPORT Standard_Boolean Contains (const Handle(Standard_Transient)& K) const;
104   
105   //! Returns the Key of index <I>.
106   //! Exceptions
107   //! Standard_OutOfRange if I is less than 1 or greater than
108   //! the number of entries in this map.
109   Standard_EXPORT const Handle(Standard_Transient)& FindKey (const Standard_Integer I) const;
110   
111   //! Returns the Item of index <I>.
112   Standard_EXPORT const Handle(Transfer_Binder)& FindFromIndex (const Standard_Integer I) const;
113 const Handle(Transfer_Binder)& operator () (const Standard_Integer I) const
114 {
115   return FindFromIndex(I);
116 }
117   
118   //! Returns  the  Item of index <I>.  The Item  can be
119   //! modified with the syntax aMap(Index) = newItem.
120   Standard_EXPORT Handle(Transfer_Binder)& ChangeFromIndex (const Standard_Integer I);
121 Handle(Transfer_Binder)& operator () (const Standard_Integer I)
122 {
123   return ChangeFromIndex(I);
124 }
125   
126   //! Returns the index of the key <K>.
127   //! Returns 0 if K is not in the map.
128   Standard_EXPORT Standard_Integer FindIndex (const Handle(Standard_Transient)& K) const;
129   
130   //! Returns the Item of the key <K>
131   //! Trigger: Raises NoSuchObject if K is not in the map.
132   Standard_EXPORT const Handle(Transfer_Binder)& FindFromKey (const Handle(Standard_Transient)& K) const;
133   
134   //! Returns the Item of the key <K>
135   //! Trigger: Raises NoSuchObject if K is not in the map.
136   Standard_EXPORT Handle(Transfer_Binder)& ChangeFromKey (const Handle(Standard_Transient)& K);
137   
138   //! Returns the address of Item of the key <K>
139   //! or NULL if K is not in the map.
140   Standard_EXPORT Standard_Address FindFromKey1 (const Handle(Standard_Transient)& K) const;
141   
142   //! Returns the address of Item of the key <K>
143   //! or NULL if K is not in the map.
144   Standard_EXPORT Standard_Address ChangeFromKey1 (const Handle(Standard_Transient)& K);
145
146
147
148
149 protected:
150
151
152
153
154
155 private:
156
157   
158   //! As  copying  Map  is an expensive  operation it is
159   //! incorrect  to  do  it implicitly. This constructor
160   //! will raise an  error if the Map  is not  empty. To copy the
161   //! content of a  Map use the  Assign  method (operator =).
162   Standard_EXPORT Transfer_TransferMapOfProcessForTransient(const Transfer_TransferMapOfProcessForTransient& Other);
163
164
165
166
167 };
168
169
170
171
172
173
174
175 #endif // _Transfer_TransferMapOfProcessForTransient_HeaderFile