blob: ac77f85c7d1126b69547477520667e385e5cd8fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
//-Copyright: Matra Datavision 1992,1993
//-Version:
//-History:
// Version Date Purpose
// 01/04/93 Creation
//-Language C++
//-Declarations
#include <Standard_Integer.hxx>
#include <PColStd_HashAsciiString.ixx>
#include <Standard_RangeError.hxx>
#include <PCollection_HAsciiString.hxx>
//=======================================================================
// Function : Create
//=======================================================================
PColStd_HashAsciiString::PColStd_HashAsciiString()
{}
//=======================================================================
// Function : HashCode
//=======================================================================
Standard_Integer PColStd_HashAsciiString::HashCode
(const Handle(PCollection_HAsciiString) &MyKey,
const Standard_Integer Upper) const
{
Standard_Integer total=0;
if ( Upper < 1 ){
Standard_RangeError::
Raise("Try to apply HasCode method with negative or null argument.");
}
for (Standard_Integer I = 1 ; I <= MyKey->Length() ; I++ ) {
total = total + (Standard_Integer) (MyKey->Value(I));
}
total = ::HashCode( total , Upper ) ;
return total;
}
//=======================================================================
// Function : Compare
//=======================================================================
Standard_Boolean PColStd_HashAsciiString::Compare
(const Handle(PCollection_HAsciiString) &One,
const Handle(PCollection_HAsciiString) &Two) const
{
return (One->IsSameString(Two));
}
|