source: NonGTP/Xerces/xerces/include/xercesc/util/HashBase.hpp @ 358

Revision 358, 2.3 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-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#if !defined(HASHBASE_HPP)
18#define HASHBASE_HPP
19
20#include <xercesc/util/XMemory.hpp>
21#include <xercesc/util/PlatformUtils.hpp>
22
23XERCES_CPP_NAMESPACE_BEGIN
24
25/**
26 * The <code>HashBase</code> interface is the general outline of a hasher.
27 * Hashers are used in <code>RefHashTableOf</code> hashtables to hash any
28 * type of key.  An examples is the <code>HashXMLCh</code> class which is
29 * designed to produce hash values for XMLCh* strings.  Any hasher inheriting
30 * from <code>HashBase</code> may be specified when the RefHashTableOf hashtable is constructed.
31 */
32class XMLUTIL_EXPORT HashBase : public XMemory
33{
34
35public:
36       
37        /**
38      * Returns a hash value based on the key
39      *
40      * @param key the key to be hashed
41          * @param mod the modulus the hasher should use
42      */
43        virtual unsigned int getHashVal(const void *const key, unsigned int mod
44        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
45
46        /**
47      * Compares two keys and determines if they are semantically equal
48      *
49      * @param key1 the first key to be compared
50          * @param key2 the second key to be compared
51          *
52          * @return true if they are equal
53      */
54        virtual bool equals(const void *const key1, const void *const key2) = 0;
55
56    virtual ~HashBase() {};
57
58    HashBase() {};
59
60private:
61        // -----------------------------------------------------------------------
62    //  Unimplemented constructors and operators
63    // -----------------------------------------------------------------------
64    HashBase(const HashBase&);
65    HashBase& operator=(const HashBase&);   
66};
67
68XERCES_CPP_NAMESPACE_END
69
70#endif
Note: See TracBrowser for help on using the repository browser.