2 // File: SMDS_MapOfMeshOrientedElement.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_MapOfMeshOrientedElement.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_StdMapNodeOfExtendedOrientedMap_HeaderFile
22 #include "SMDS_StdMapNodeOfExtendedOrientedMap.hxx"
24 #ifndef _SMDS_MapIteratorOfExtendedOrientedMap_HeaderFile
25 #include "SMDS_MapIteratorOfExtendedOrientedMap.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_StdMapNodeOfExtendedOrientedMap
34 #define TCollection_StdMapNode_hxx <SMDS_StdMapNodeOfExtendedOrientedMap.hxx>
35 #define TCollection_MapIterator SMDS_MapIteratorOfExtendedOrientedMap
36 #define TCollection_MapIterator_hxx <SMDS_MapIteratorOfExtendedOrientedMap.hxx>
37 #define Handle_TCollection_StdMapNode Handle_SMDS_StdMapNodeOfExtendedOrientedMap
38 #define TCollection_StdMapNode_Type_() SMDS_StdMapNodeOfExtendedOrientedMap_Type_()
39 #define TCollection_Map SMDS_ExtendedOrientedMap
40 #define TCollection_Map_hxx <SMDS_ExtendedOrientedMap.hxx>
44 //=======================================================================
47 //=======================================================================
49 const Handle(SMDS_MeshElement)& SMDS_MapOfMeshOrientedElement::Find(const TheKey& K) const
52 Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::Find");
54 // Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshOrientedElement::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_MapOfMeshOrientedElement::Find");
67 //=======================================================================
68 //function : ChangeFind
70 //=======================================================================
72 Handle(SMDS_MeshElement)& SMDS_MapOfMeshOrientedElement::ChangeFind(const TheKey& K)
75 Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::ChangeFind");
77 //Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshOrientedElement::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_MapOfMeshOrientedElement::ChangeFind");
91 //=======================================================================
94 //=======================================================================
96 const Handle(SMDS_MeshElement)& SMDS_MapOfMeshOrientedElement::FindID(const Standard_Integer ID) const
99 Standard_NoSuchObject::Raise("SMDS_MapOfMeshOrientedElement::FindID");
101 // Standard_NoSuchObject_Raise_if(IsEmpty(),"SMDS_MapOfMeshOrientedElement::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_MapOfMeshOrientedElement::Find");
114 //=======================================================================
115 //function : ContainsID
117 //=======================================================================
119 Standard_Boolean SMDS_MapOfMeshOrientedElement::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;