1 | /*
|
---|
2 | * Copyright 2001,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Id: HashCMStateSet.hpp,v 1.5 2004/09/08 13:56:21 peiyongz Exp $
|
---|
19 | * $Log: HashCMStateSet.hpp,v $
|
---|
20 | * Revision 1.5 2004/09/08 13:56:21 peiyongz
|
---|
21 | * Apache License Version 2.0
|
---|
22 | *
|
---|
23 | * Revision 1.4 2004/01/29 11:48:46 cargilld
|
---|
24 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
25 | *
|
---|
26 | * Revision 1.3 2003/12/17 00:18:35 cargilld
|
---|
27 | * Update to memory management so that the static memory manager (one used to call Initialize) is only for static data.
|
---|
28 | *
|
---|
29 | * Revision 1.2 2002/11/04 15:22:03 tng
|
---|
30 | * C++ Namespace Support.
|
---|
31 | *
|
---|
32 | * Revision 1.1.1.1 2002/02/01 22:22:10 peiyongz
|
---|
33 | * sane_include
|
---|
34 | *
|
---|
35 | * Revision 1.2 2001/11/22 20:23:00 peiyongz
|
---|
36 | * _declspec(dllimport) and inline warning C4273
|
---|
37 | *
|
---|
38 | * Revision 1.1 2001/08/16 21:54:01 peiyongz
|
---|
39 | * new class creation
|
---|
40 | *
|
---|
41 | */
|
---|
42 |
|
---|
43 | #if !defined(HASH_CMSTATESET_HPP)
|
---|
44 | #define HASH_CMSTATESET_HPP
|
---|
45 |
|
---|
46 | #include <xercesc/util/HashBase.hpp>
|
---|
47 | #include <xercesc/validators/common/CMStateSet.hpp>
|
---|
48 |
|
---|
49 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * The <code>HashCMStateSet</code> class inherits from <code>HashBase</code>.
|
---|
53 | * This is a CMStateSet specific hasher class designed to hash the values
|
---|
54 | * of CMStateSet.
|
---|
55 | *
|
---|
56 | * See <code>HashBase</code> for more information.
|
---|
57 | */
|
---|
58 |
|
---|
59 | class XMLUTIL_EXPORT HashCMStateSet : public HashBase
|
---|
60 | {
|
---|
61 | public:
|
---|
62 | HashCMStateSet();
|
---|
63 | virtual ~HashCMStateSet();
|
---|
64 | virtual unsigned int getHashVal(const void *const key, unsigned int mod
|
---|
65 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
66 | virtual bool equals(const void *const key1, const void *const key2);
|
---|
67 | private:
|
---|
68 | // -----------------------------------------------------------------------
|
---|
69 | // Unimplemented constructors and operators
|
---|
70 | // -----------------------------------------------------------------------
|
---|
71 | HashCMStateSet(const HashCMStateSet&);
|
---|
72 | HashCMStateSet& operator=(const HashCMStateSet&);
|
---|
73 | };
|
---|
74 |
|
---|
75 | inline HashCMStateSet::HashCMStateSet()
|
---|
76 | {
|
---|
77 | }
|
---|
78 |
|
---|
79 | inline HashCMStateSet::~HashCMStateSet()
|
---|
80 | {
|
---|
81 | }
|
---|
82 |
|
---|
83 | inline unsigned int HashCMStateSet::getHashVal(const void *const key, unsigned int mod
|
---|
84 | , MemoryManager* const)
|
---|
85 | {
|
---|
86 | const CMStateSet* const pkey = (const CMStateSet* const) key;
|
---|
87 | return ((pkey->hashCode()) % mod);
|
---|
88 | }
|
---|
89 |
|
---|
90 | inline bool HashCMStateSet::equals(const void *const key1, const void *const key2)
|
---|
91 | {
|
---|
92 | const CMStateSet* const pkey1 = (const CMStateSet* const) key1;
|
---|
93 | const CMStateSet* const pkey2 = (const CMStateSet* const) key2;
|
---|
94 |
|
---|
95 | return (*pkey1==*pkey2);
|
---|
96 | }
|
---|
97 |
|
---|
98 | XERCES_CPP_NAMESPACE_END
|
---|
99 |
|
---|
100 | #endif
|
---|