2 // File: SMDS_MapOfMeshElement.cxx
3 // Created: Fri Jan 25 11:47:26 2002
4 // Author: Jean-Michel BOULCOURT
5 // <jmb@coulox.paris1.matra-dtv.fr>
8 #include "SMDS_MapOfMeshElement.ixx"
9 #include <Standard_NoSuchObject.hxx>
12 #ifndef _Standard_DomainError_HeaderFile
13 #include <Standard_DomainError.hxx>
15 #ifndef _SMDS_MeshElement_HeaderFile
16 #include "SMDS_MeshElement.hxx"
18 #ifndef _SMDS_MeshElementMapHasher_HeaderFile
19 #include "SMDS_MeshElementMapHasher.hxx"
21 #ifndef _SMDS_StdMapNodeOfExtendedMap_HeaderFile
22 #include "SMDS_StdMapNodeOfExtendedMap.hxx"
24 #ifndef _SMDS_MapIteratorOfExtendedMap_HeaderFile
25 #include "SMDS_MapIteratorOfExtendedMap.hxx"
29 #define TheKey Handle_SMDS_MeshElement
30 #define TheKey_hxx <SMDS_MeshElement.hxx>
31 #define Hasher SMDS_MeshElementMapHasher
32 #define Hasher_hxx <SMDS_MeshElementMapHasher.hxx>
33 #define TCollection_StdMapNode SMDS_StdMapNodeOfExtendedMap
34 #define TCollection_StdMapNode_hxx <SMDS_StdMapNodeOfExtendedMap.hxx>
35 #define TCollection_MapIterator SMDS_MapIteratorOfExtendedMap
36 #define TCollection_MapIterator_hxx <SMDS_MapIteratorOfExtendedMap.hxx>
37 #define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedMap
38 #define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedMap_Type_()
39 #define TCollection_Map SMDS_ExtendedMap
40 #define TCollection_Map_hxx <SMDS_ExtendedMap.hxx>
44 //=======================================================================
47 //=======================================================================
49 const Handle(SMDS_MeshElement)& SMDS_MapOfMeshElement::Find(const TheKey& K) const
52 Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::Find");
54 // Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshElement::Find");
55 TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
56 TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
58 if (Hasher::IsEqual(p->Key(),K)) {
61 p = (TCollection_StdMapNode*) p->Next();
63 Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::Find");
67 //=======================================================================
68 //function : ChangeFind
70 //=======================================================================
72 Handle(SMDS_MeshElement)& SMDS_MapOfMeshElement::ChangeFind(const TheKey& K)
75 Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::ChangeFind");
77 //Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshElement::ChangeFind");
78 TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
79 TCollection_StdMapNode* p = data[Hasher::HashCode(K,NbBuckets())];
81 if (Hasher::IsEqual(p->Key(),K)) {
84 p = (TCollection_StdMapNode*) p->Next();
86 Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::ChangeFind");
91 //=======================================================================
94 //=======================================================================
96 const Handle(SMDS_MeshElement)& SMDS_MapOfMeshElement::FindID(const Standard_Integer ID) const
99 Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::FindID");
101 // Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshElement::Find");
102 TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
103 TCollection_StdMapNode* p = data[ID % NbBuckets()];
105 if (p->Key()->GetID() == ID) {
108 p = (TCollection_StdMapNode*) p->Next();
110 Standard_NoSuchObject::Raise("SMDS_MapOfMeshElement::Find");
114 //=======================================================================
115 //function : ContainsID
117 //=======================================================================
119 Standard_Boolean SMDS_MapOfMeshElement::ContainsID(const Standard_Integer ID) const
121 if (IsEmpty()) return Standard_False;
122 TCollection_StdMapNode** data = (TCollection_StdMapNode**) myData1;
123 TCollection_StdMapNode* p = data[ID % NbBuckets()];
125 if (p->Key()->GetID() == ID) {
126 return Standard_True;
128 p = (TCollection_StdMapNode*)p->Next();
130 return Standard_False;