secureswitools/swisistools/source/xmlparser/xerces/include/xercesc/util/HashBase.hpp
changeset 0 ba25891c3a9e
child 1 c42dffbd5b4f
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 /*
       
    18  * Licensed to the Apache Software Foundation (ASF) under one or more
       
    19  * contributor license agreements.  See the NOTICE file distributed with
       
    20  * this work for additional information regarding copyright ownership.
       
    21  * The ASF licenses this file to You under the Apache License, Version 2.0
       
    22  * (the "License"); you may not use this file except in compliance with
       
    23  * the License.  You may obtain a copy of the License at
       
    24  * 
       
    25  *      http://www.apache.org/licenses/LICENSE-2.0
       
    26  * 
       
    27  * Unless required by applicable law or agreed to in writing, software
       
    28  * distributed under the License is distributed on an "AS IS" BASIS,
       
    29  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    30  * See the License for the specific language governing permissions and
       
    31  * limitations under the License.
       
    32  */
       
    33 
       
    34 #if !defined(HASHBASE_HPP)
       
    35 #define HASHBASE_HPP
       
    36 
       
    37 #include <xercesc/util/XMemory.hpp>
       
    38 #include <xercesc/util/PlatformUtils.hpp>
       
    39 
       
    40 XERCES_CPP_NAMESPACE_BEGIN
       
    41 
       
    42 /**
       
    43  * The <code>HashBase</code> interface is the general outline of a hasher.
       
    44  * Hashers are used in <code>RefHashTableOf</code> hashtables to hash any
       
    45  * type of key.  An examples is the <code>HashXMLCh</code> class which is
       
    46  * designed to produce hash values for XMLCh* strings.  Any hasher inheriting
       
    47  * from <code>HashBase</code> may be specified when the RefHashTableOf hashtable is constructed.
       
    48  */
       
    49 class XMLUTIL_EXPORT HashBase : public XMemory
       
    50 {
       
    51 
       
    52 public:
       
    53 	
       
    54 	/**
       
    55       * Returns a hash value based on the key
       
    56       *
       
    57       * @param key the key to be hashed
       
    58 	  * @param mod the modulus the hasher should use
       
    59       */
       
    60 	virtual unsigned int getHashVal(const void *const key, unsigned int mod
       
    61         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager) = 0;
       
    62 
       
    63 	/**
       
    64       * Compares two keys and determines if they are semantically equal
       
    65       *
       
    66       * @param key1 the first key to be compared
       
    67 	  * @param key2 the second key to be compared
       
    68 	  *
       
    69 	  * @return true if they are equal
       
    70       */
       
    71 	virtual bool equals(const void *const key1, const void *const key2) = 0;
       
    72 
       
    73     virtual ~HashBase() {};
       
    74 
       
    75     HashBase() {};
       
    76 
       
    77 private:
       
    78 	// -----------------------------------------------------------------------
       
    79     //  Unimplemented constructors and operators
       
    80     // -----------------------------------------------------------------------
       
    81     HashBase(const HashBase&);
       
    82     HashBase& operator=(const HashBase&);    
       
    83 };
       
    84 
       
    85 XERCES_CPP_NAMESPACE_END
       
    86 
       
    87 #endif