source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/util/HashBase.hpp @ 2674

Revision 2674, 2.4 KB checked in by mattausch, 16 years ago (diff)
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#if !defined(HASHBASE_HPP)
19#define HASHBASE_HPP
20
21#include <xercesc/util/XMemory.hpp>
22#include <xercesc/util/PlatformUtils.hpp>
23
24XERCES_CPP_NAMESPACE_BEGIN
25
26/**
27 * The <code>HashBase</code> interface is the general outline of a hasher.
28 * Hashers are used in <code>RefHashTableOf</code> hashtables to hash any
29 * type of key.  An examples is the <code>HashXMLCh</code> class which is
30 * designed to produce hash values for XMLCh* strings.  Any hasher inheriting
31 * from <code>HashBase</code> may be specified when the RefHashTableOf hashtable is constructed.
32 */
33class XMLUTIL_EXPORT HashBase : public XMemory
34{
35
36public:
37       
38        /**
39      * Returns a hash value based on the key
40      *
41      * @param key the key to be hashed
42          * @param mod the modulus the hasher should use
43      */
44        virtual unsigned int getHashVal(const void *const key, unsigned int mod
45        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
46
47        /**
48      * Compares two keys and determines if they are semantically equal
49      *
50      * @param key1 the first key to be compared
51          * @param key2 the second key to be compared
52          *
53          * @return true if they are equal
54      */
55        virtual bool equals(const void *const key1, const void *const key2) = 0;
56
57    virtual ~HashBase() {};
58
59    HashBase() {};
60
61private:
62        // -----------------------------------------------------------------------
63    //  Unimplemented constructors and operators
64    // -----------------------------------------------------------------------
65    HashBase(const HashBase&);
66    HashBase& operator=(const HashBase&);   
67};
68
69XERCES_CPP_NAMESPACE_END
70
71#endif
Note: See TracBrowser for help on using the repository browser.