Modified: xerces/c/trunk/src/xercesc/util/NameIdPool.c
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NameIdPool.c?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NameIdPool.c (original)
+++ xerces/c/trunk/src/xercesc/util/NameIdPool.c Mon Jul 21 06:08:10 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,7 +43,7 @@
                              , const unsigned int initSize
                              , MemoryManager* const manager) :
     fMemoryManager(manager)
-    , fBucketList(0)
+    , fBucketList(hashModulus, manager)
     , fIdPtrs(0)
     , fIdPtrsCount(initSize)
     , fIdCounter(0)
@@ -51,7 +51,6 @@
     if (!hashModulus)
         ThrowXMLwithMemMgr(IllegalArgumentException, 
XMLExcepts::Pool_ZeroModulus, fMemoryManager);
 
-    fBucketList = new (fMemoryManager) RefHashTableOf<TElem>(hashModulus, 
fMemoryManager);
     //
     //  Allocate the initial id pointers array. We don't have to zero them
     //  out since the fIdCounter value tells us which ones are valid. The
@@ -62,7 +61,7 @@
     fIdPtrs = (TElem**) fMemoryManager->allocate
     (
         fIdPtrsCount * sizeof(TElem*)
-    ); //new TElem*[fIdPtrsCount];
+    );
     fIdPtrs[0] = 0;
 }
 
@@ -73,19 +72,18 @@
     //  up when we clean the bucket lists.
     //
     fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
-
-    delete fBucketList;
 }
 
 
 // ---------------------------------------------------------------------------
 //  NameIdPool: Element management
 // ---------------------------------------------------------------------------
-template <class TElem> bool
-NameIdPool<TElem>::containsKey(const XMLCh* const key) const
+template <class TElem>
+inline bool NameIdPool<TElem>::
+containsKey(const XMLCh* const key) const
 {
     if (fIdCounter == 0) return false;
-    return fBucketList->containsKey(key);
+    return fBucketList.containsKey(key);
 }
 
 
@@ -93,7 +91,7 @@
 {
     if (fIdCounter == 0) return;
 
-    fBucketList->removeAll();
+    fBucketList.removeAll();
 
     // Reset the id counter
     fIdCounter = 0;
@@ -103,22 +101,25 @@
 // ---------------------------------------------------------------------------
 //  NameIdPool: Getters
 // ---------------------------------------------------------------------------
-template <class TElem> TElem*
-NameIdPool<TElem>::getByKey(const XMLCh* const key)
+template <class TElem>
+inline TElem* NameIdPool<TElem>::
+getByKey(const XMLCh* const key)
 {
     if (fIdCounter == 0) return 0;
-    return fBucketList->get(key);
+    return fBucketList.get(key);
 }
 
-template <class TElem> const TElem*
-NameIdPool<TElem>::getByKey(const XMLCh* const key) const
+template <class TElem>
+inline const TElem* NameIdPool<TElem>::
+getByKey(const XMLCh* const key) const
 {
     if (fIdCounter == 0) return 0;
-    return fBucketList->get(key);
+    return fBucketList.get(key);
 }
 
-template <class TElem> TElem*
-NameIdPool<TElem>::getById(const unsigned int elemId)
+template <class TElem>
+inline TElem* NameIdPool<TElem>::
+getById(const unsigned int elemId)
 {
     // If its either zero or beyond our current id, its an error
     if (!elemId || (elemId > fIdCounter))
@@ -128,7 +129,8 @@
 }
 
 template <class TElem>
-const TElem* NameIdPool<TElem>::getById(const unsigned int elemId) const
+inline const TElem* NameIdPool<TElem>::
+getById(const unsigned int elemId) const
 {
     // If its either zero or beyond our current id, its an error
     if (!elemId || (elemId > fIdCounter))
@@ -138,7 +140,7 @@
 }
 
 template <class TElem>
-MemoryManager* NameIdPool<TElem>::getMemoryManager() const
+inline MemoryManager* NameIdPool<TElem>::getMemoryManager() const
 {
     return fMemoryManager;
 }
@@ -161,7 +163,7 @@
         );
     }
 
-    fBucketList->put((void*)elemToAdopt->getKey(), elemToAdopt);
+    fBucketList.put((void*)elemToAdopt->getKey(), elemToAdopt);
 
     //
     //  Give this new one the next available id and add to the pointer list.

Modified: xerces/c/trunk/src/xercesc/util/NameIdPool.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/NameIdPool.hpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/NameIdPool.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/NameIdPool.hpp Mon Jul 21 06:08:10 2008
@@ -136,7 +136,7 @@
     //
     // -----------------------------------------------------------------------
     MemoryManager*                  fMemoryManager;
-    RefHashTableOf<TElem>*          fBucketList;
+    RefHashTableOf<TElem>           fBucketList;
     TElem**                         fIdPtrs;
     unsigned int                    fIdPtrsCount;
     unsigned int                    fIdCounter;

Modified: xerces/c/trunk/src/xercesc/util/RefHashTableOf.c
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHashTableOf.c?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHashTableOf.c (original)
+++ xerces/c/trunk/src/xercesc/util/RefHashTableOf.c Mon Jul 21 06:08:10 2008
@@ -30,7 +30,6 @@
 #include <xercesc/util/Janitor.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/util/NullPointerException.hpp>
-#include <assert.h>
 #include <new>
 
 XERCES_CPP_NAMESPACE_BEGIN
@@ -38,28 +37,43 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOf: Constructors and Destructor
 // ---------------------------------------------------------------------------
-template <class TVal>
-RefHashTableOf<TVal>::RefHashTableOf( const XMLSize_t modulus
-                                    , const bool adoptElems
-                                    , MemoryManager* const manager)
+template <class TVal, class THasher>
+RefHashTableOf<TVal, THasher>::RefHashTableOf(
+  const XMLSize_t modulus,
+  MemoryManager* const manager)
 
     : fMemoryManager(manager)
-    , fAdoptedElems(adoptElems)
+    , fAdoptedElems(true)
     , fBucketList(0)
     , fHashModulus(modulus)
     , fInitialModulus(modulus)
     , fCount(0)
-    , fHash(0)
+{
+    initialize(modulus);
+}
 
+template <class TVal, class THasher>
+RefHashTableOf<TVal, THasher>::RefHashTableOf(
+  const XMLSize_t modulus,
+  const THasher& hasher,
+  MemoryManager* const manager)
+
+    : fMemoryManager(manager)
+    , fAdoptedElems(true)
+    , fBucketList(0)
+    , fHashModulus(modulus)
+    , fInitialModulus(modulus)
+    , fCount(0)
+    , fHasher (hasher)
 {
     initialize(modulus);
 }
 
-template <class TVal>
-RefHashTableOf<TVal>::RefHashTableOf( const XMLSize_t modulus
-                                    , const bool adoptElems
-                                    , HashBase* hashBase
-                                    , MemoryManager* const manager)
+template <class TVal, class THasher>
+RefHashTableOf<TVal, THasher>::RefHashTableOf(
+  const XMLSize_t modulus,
+  const bool adoptElems,
+  MemoryManager* const manager)
 
     : fMemoryManager(manager)
     , fAdoptedElems(adoptElems)
@@ -67,29 +81,31 @@
     , fHashModulus(modulus)
     , fInitialModulus(modulus)
     , fCount(0)
-    , fHash(0)
+
 {
     initialize(modulus);
-    // set hasher
-    fHash = hashBase;
 }
 
-template <class TVal>
-RefHashTableOf<TVal>::RefHashTableOf(const XMLSize_t modulus
-                                     , MemoryManager* const manager)
+template <class TVal, class THasher>
+RefHashTableOf<TVal, THasher>::RefHashTableOf(
+  const XMLSize_t modulus,
+  const bool adoptElems,
+  const THasher& hasher,
+  MemoryManager* const manager)
 
     : fMemoryManager(manager)
-    , fAdoptedElems(true)
+    , fAdoptedElems(adoptElems)
     , fBucketList(0)
     , fHashModulus(modulus)
     , fInitialModulus(modulus)
     , fCount(0)
-    , fHash(0)
+    , fHasher (hasher)
 {
     initialize(modulus);
 }
 
-template <class TVal> void RefHashTableOf<TVal>::initialize(const XMLSize_t 
modulus)
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::initialize(const XMLSize_t modulus)
 {
     if (modulus == 0)
         ThrowXMLwithMemMgr(IllegalArgumentException, 
XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
@@ -98,12 +114,13 @@
     fBucketList = (RefHashTableBucketElem<TVal>**) fMemoryManager->allocate
     (
         fHashModulus * sizeof(RefHashTableBucketElem<TVal>*)
-    ); //new RefHashTableBucketElem<TVal>*[fHashModulus];
+    );
     for (XMLSize_t index = 0; index < fHashModulus; index++)
         fBucketList[index] = 0;
 }
 
-template <class TVal> RefHashTableOf<TVal>::~RefHashTableOf()
+template <class TVal, class THasher>
+RefHashTableOf<TVal, THasher>::~RefHashTableOf()
 {
     cleanup();
 }
@@ -112,25 +129,26 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOf: Element management
 // ---------------------------------------------------------------------------
-template <class TVal> bool RefHashTableOf<TVal>::isEmpty() const
+template <class TVal, class THasher>
+inline bool RefHashTableOf<TVal, THasher>::isEmpty() const
 {
     return fCount==0;
 }
 
-template <class TVal> bool RefHashTableOf<TVal>::
-containsKey(const void* const key) const
+template <class TVal, class THasher>
+inline bool RefHashTableOf<TVal, THasher>::containsKey(const void* const key) 
const
 {
     XMLSize_t hashVal;
     const RefHashTableBucketElem<TVal>* findIt = findBucketElem(key, hashVal);
     return (findIt != 0);
 }
 
-template <class TVal> void RefHashTableOf<TVal>::
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::
 removeKey(const void* const key)
 {
     // Hash the key
-    XMLSize_t hashVal = fHash==0?XMLString::hash((const XMLCh*)key, 
fHashModulus) : fHash->getHashVal(key, fHashModulus);
-    assert(hashVal < fHashModulus);
+    XMLSize_t hashVal = fHasher.getHashVal(key, fHashModulus);
 
     //
     //  Search the given bucket for this key. Keep up with the previous
@@ -141,7 +159,7 @@
 
     while (curElem)
     {
-        if (fHash==0?XMLString::equals((const XMLCh*)key, (const 
XMLCh*)curElem->fKey) : fHash->equals(key, curElem->fKey))
+        if (fHasher.equals(key, curElem->fKey))
         {
             if (!lastElem)
             {
@@ -162,9 +180,8 @@
                 delete curElem->fData;
 
             // Then delete the current element and move forward
-             // delete curElem;
+            // delete curElem;
             // destructor doesn't do anything...
-            // curElem->~RefHashTableBucketElem();
             fMemoryManager->deallocate(curElem);
 
             fCount--;
@@ -181,7 +198,8 @@
     ThrowXMLwithMemMgr(NoSuchElementException, 
XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager);
 }
 
-template <class TVal> void RefHashTableOf<TVal>::removeAll()
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::removeAll()
 {
     if(isEmpty())
         return;
@@ -223,13 +241,12 @@
 // now owns the returned data (case of hashtable adopting the data).
 // This function is called by transferElement so that the undeleted data can 
be transferred
 // to a new key which will own that data.
-template <class TVal> TVal* RefHashTableOf<TVal>::
+template <class TVal, class THasher> TVal* RefHashTableOf<TVal, THasher>::
 orphanKey(const void* const key)
 {
     // Hash the key
     TVal* retVal = 0;
-    XMLSize_t hashVal = fHash==0?XMLString::hash((const XMLCh*)key, 
fHashModulus) : fHash->getHashVal(key, fHashModulus);
-    assert(hashVal < fHashModulus);
+    XMLSize_t hashVal = fHasher.getHashVal(key, fHashModulus);
 
     //
     //  Search the given bucket for this key. Keep up with the previous
@@ -240,7 +257,7 @@
 
     while (curElem)
     {
-        if (fHash==0?XMLString::equals((const XMLCh*)key, (const 
XMLCh*)curElem->fKey) : fHash->equals(key, curElem->fKey))
+        if (fHasher.equals(key, curElem->fKey))
         {
             if (!lastElem)
             {
@@ -280,15 +297,14 @@
 //   similar to destructor
 //   called to cleanup the memory, in case destructor cannot be called
 //
-template <class TVal> void RefHashTableOf<TVal>::cleanup()
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::cleanup()
 {
     removeAll();
 
     // Then delete the bucket list & hasher
-    fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
+    fMemoryManager->deallocate(fBucketList);
     fBucketList = 0;
-    delete fHash;
-    fHash = 0;
 }
 
 //
@@ -296,16 +312,16 @@
 //   similar to constructor
 //   called to re-construct the fElemList from scratch again
 //
-template <class TVal> void RefHashTableOf<TVal>::reinitialize(HashBase* 
hashBase)
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::reinitialize(const THasher& hasher)
 {
-    if (fBucketList || fHash)
+    if (fBucketList)
         cleanup();
 
+    fHasher = hasher;
+
     fHashModulus = fInitialModulus;
     initialize(fHashModulus);
-
-    if (hashBase)
-        fHash = hashBase;
 }
 
 
@@ -318,7 +334,8 @@
 // except that the data is not deleted in "removeKey" even it is adopted so 
that it
 // can be transferred to key2.
 // whatever key2 has originally will be purged (if adopted)
-template <class TVal> void RefHashTableOf<TVal>::transferElement(const void* 
const key1, void* key2)
+template <class TVal, class THasher>
+inline void RefHashTableOf<TVal, THasher>::transferElement(const void* const 
key1, void* key2)
 {
     put(key2, orphanKey(key1));
 }
@@ -327,39 +344,37 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOf: Getters
 // ---------------------------------------------------------------------------
-template <class TVal> TVal* RefHashTableOf<TVal>::get(const void* const key)
+template <class TVal, class THasher>
+inline TVal* RefHashTableOf<TVal, THasher>::get(const void* const key)
 {
     XMLSize_t hashVal;
     RefHashTableBucketElem<TVal>* findIt = findBucketElem(key, hashVal);
-    if (!findIt)
-        return 0;
-    return findIt->fData;
+    return findIt ? findIt->fData : 0;
 }
 
-template <class TVal> const TVal* RefHashTableOf<TVal>::
+template <class TVal, class THasher>
+inline const TVal* RefHashTableOf<TVal, THasher>::
 get(const void* const key) const
 {
     XMLSize_t hashVal;
     const RefHashTableBucketElem<TVal>* findIt = findBucketElem(key, hashVal);
-    if (!findIt)
-        return 0;
-    return findIt->fData;
+    return findIt ? findIt->fData : 0;
 }
 
-template <class TVal>
-MemoryManager* RefHashTableOf<TVal>::getMemoryManager() const
+template <class TVal, class THasher>
+inline MemoryManager* RefHashTableOf<TVal, THasher>::getMemoryManager() const
 {
     return fMemoryManager;
 }
 
-template <class TVal>
-XMLSize_t RefHashTableOf<TVal>::getHashModulus() const
+template <class TVal, class THasher>
+inline XMLSize_t RefHashTableOf<TVal, THasher>::getHashModulus() const
 {
     return fHashModulus;
 }
 
-template <class TVal>
-XMLSize_t RefHashTableOf<TVal>::getCount() const
+template <class TVal, class THasher>
+inline XMLSize_t RefHashTableOf<TVal, THasher>::getCount() const
 {
     return fCount;
 }
@@ -367,8 +382,8 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOf: Getters
 // ---------------------------------------------------------------------------
-template <class TVal>
-void RefHashTableOf<TVal>::setAdoptElements(const bool aValue)
+template <class TVal, class THasher>
+inline void RefHashTableOf<TVal, THasher>::setAdoptElements(const bool aValue)
 {
     fAdoptedElems = aValue;
 }
@@ -376,7 +391,8 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOf: Putters
 // ---------------------------------------------------------------------------
-template <class TVal> void RefHashTableOf<TVal>::put(void* key, TVal* const 
valueToAdopt)
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::put(void* key, TVal* const valueToAdopt)
 {
     // Apply 0.75 load factor to find threshold.
     XMLSize_t threshold = fHashModulus * 3 / 4;
@@ -402,7 +418,6 @@
     }
     else
     {
-        //newBucket = new (fMemoryManager) RefHashTableBucketElem<TVal>(key, 
valueToAdopt, fBucketList[hashVal]);
         newBucket =
              new 
(fMemoryManager->allocate(sizeof(RefHashTableBucketElem<TVal>)))
              RefHashTableBucketElem<TVal>(key, valueToAdopt, 
fBucketList[hashVal]);
@@ -416,7 +431,8 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOf: Private methods
 // ---------------------------------------------------------------------------
-template <class TVal> void RefHashTableOf<TVal>::rehash()
+template <class TVal, class THasher>
+void RefHashTableOf<TVal, THasher>::rehash()
 {
     const XMLSize_t newMod = (fHashModulus * 2) + 1;
 
@@ -424,7 +440,7 @@
         (RefHashTableBucketElem<TVal>**) fMemoryManager->allocate
     (
         newMod * sizeof(RefHashTableBucketElem<TVal>*)
-    );//new RefHashTableBucketElem<TVal>*[newMod];
+    );
 
     // Make sure the new bucket list is destroyed if an
     // exception is thrown.
@@ -444,8 +460,7 @@
             // Save the next element before we detach this one
             RefHashTableBucketElem<TVal>* const nextElem = curElem->fNext;
 
-            const XMLSize_t hashVal = fHash==0?XMLString::hash((const 
XMLCh*)curElem->fKey, newMod) : fHash->getHashVal(curElem->fKey, newMod);
-            assert(hashVal < newMod);
+            const XMLSize_t hashVal = fHasher.getHashVal(curElem->fKey, 
newMod);
 
             RefHashTableBucketElem<TVal>* const newHeadElem = 
newBucketList[hashVal];
 
@@ -469,18 +484,18 @@
 
 }
 
-template <class TVal> RefHashTableBucketElem<TVal>* RefHashTableOf<TVal>::
+template <class TVal, class THasher>
+inline RefHashTableBucketElem<TVal>* RefHashTableOf<TVal, THasher>::
 findBucketElem(const void* const key, XMLSize_t& hashVal)
 {
     // Hash the key
-    hashVal = fHash==0?XMLString::hash((const XMLCh*)key, fHashModulus) : 
fHash->getHashVal(key, fHashModulus);
-    assert(hashVal < fHashModulus);
+    hashVal = fHasher.getHashVal(key, fHashModulus);
 
     // Search that bucket for the key
     RefHashTableBucketElem<TVal>* curElem = fBucketList[hashVal];
     while (curElem)
     {
-        if (fHash==0?XMLString::equals((const XMLCh*)key, (const 
XMLCh*)curElem->fKey) : fHash->equals(key, curElem->fKey))
+        if (fHasher.equals(key, curElem->fKey))
             return curElem;
 
         curElem = curElem->fNext;
@@ -488,18 +503,18 @@
     return 0;
 }
 
-template <class TVal> const RefHashTableBucketElem<TVal>* 
RefHashTableOf<TVal>::
+template <class TVal, class THasher>
+inline const RefHashTableBucketElem<TVal>* RefHashTableOf<TVal, THasher>::
 findBucketElem(const void* const key, XMLSize_t& hashVal) const
 {
     // Hash the key
-    hashVal = fHash==0?XMLString::hash((const XMLCh*)key, fHashModulus) : 
fHash->getHashVal(key, fHashModulus);
-    assert(hashVal < fHashModulus);
+    hashVal = fHasher.getHashVal(key, fHashModulus);
 
     // Search that bucket for the key
     const RefHashTableBucketElem<TVal>* curElem = fBucketList[hashVal];
     while (curElem)
     {
-        if (fHash==0?XMLString::equals((const XMLCh*)key, (const 
XMLCh*)curElem->fKey) : fHash->equals(key, curElem->fKey))
+        if (fHasher.equals(key, curElem->fKey))
             return curElem;
 
         curElem = curElem->fNext;
@@ -511,8 +526,8 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOfEnumerator: Constructors and Destructor
 // ---------------------------------------------------------------------------
-template <class TVal> RefHashTableOfEnumerator<TVal>::
-RefHashTableOfEnumerator(RefHashTableOf<TVal>* const toEnum
+template <class TVal, class THasher> RefHashTableOfEnumerator<TVal, THasher>::
+RefHashTableOfEnumerator(RefHashTableOf<TVal, THasher>* const toEnum
                          , const bool adopt
                          , MemoryManager* const manager)
     : fAdopted(adopt), fCurElem(0), fCurHash((XMLSize_t)-1), fToEnum(toEnum)
@@ -531,15 +546,16 @@
     findNext();
 }
 
-template <class TVal> 
RefHashTableOfEnumerator<TVal>::~RefHashTableOfEnumerator()
+template <class TVal, class THasher>
+RefHashTableOfEnumerator<TVal, THasher>::~RefHashTableOfEnumerator()
 {
     if (fAdopted)
         delete fToEnum;
 }
 
 
-template <class TVal> RefHashTableOfEnumerator<TVal>::
-RefHashTableOfEnumerator(const RefHashTableOfEnumerator<TVal>& toCopy) :
+template <class TVal, class THasher> RefHashTableOfEnumerator<TVal, THasher>::
+RefHashTableOfEnumerator(const RefHashTableOfEnumerator<TVal, THasher>& 
toCopy) :
     XMLEnumerator<TVal>(toCopy)
     , XMemory(toCopy)
     , fAdopted(toCopy.fAdopted)
@@ -552,7 +568,8 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOfEnumerator: Enum interface
 // ---------------------------------------------------------------------------
-template <class TVal> bool RefHashTableOfEnumerator<TVal>::hasMoreElements() 
const
+template <class TVal, class THasher>
+bool RefHashTableOfEnumerator<TVal, THasher>::hasMoreElements() const
 {
     //
     //  If our current has is at the max and there are no more elements
@@ -563,7 +580,8 @@
     return true;
 }
 
-template <class TVal> TVal& RefHashTableOfEnumerator<TVal>::nextElement()
+template <class TVal, class THasher>
+TVal& RefHashTableOfEnumerator<TVal, THasher>::nextElement()
 {
     // Make sure we have an element to return
     if (!hasMoreElements())
@@ -579,7 +597,8 @@
     return *saveElem->fData;
 }
 
-template <class TVal> void* RefHashTableOfEnumerator<TVal>::nextElementKey()
+template <class TVal, class THasher>
+void* RefHashTableOfEnumerator<TVal, THasher>::nextElementKey()
 {
     // Make sure we have an element to return
     if (!hasMoreElements())
@@ -595,7 +614,8 @@
     return saveElem->fKey;
 }
 
-template <class TVal> void RefHashTableOfEnumerator<TVal>::Reset()
+template <class TVal, class THasher>
+void RefHashTableOfEnumerator<TVal, THasher>::Reset()
 {
     fCurHash = (XMLSize_t)-1;
     fCurElem = 0;
@@ -607,7 +627,8 @@
 // ---------------------------------------------------------------------------
 //  RefHashTableOfEnumerator: Private helper methods
 // ---------------------------------------------------------------------------
-template <class TVal> void RefHashTableOfEnumerator<TVal>::findNext()
+template <class TVal, class THasher>
+void RefHashTableOfEnumerator<TVal, THasher>::findNext()
 {
     //
     //  If there is a current element, move to its next element. If this

Modified: xerces/c/trunk/src/xercesc/util/RefHashTableOf.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHashTableOf.hpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHashTableOf.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/RefHashTableOf.hpp Mon Jul 21 06:08:10 2008
@@ -34,70 +34,98 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
+// Default hasher for keys that are const XMLCh*.
+//
+struct StringHasher
+{
+  XMLSize_t getHashVal(const void* key, XMLSize_t mod) const
+  {
+    return XMLString::hash ((const XMLCh*)key, mod);
+  }
+
+  bool equals(const void *const key1, const void *const key2) const
+  {
+    return XMLString::equals ((const XMLCh*)key1, (const XMLCh*)key2);
+  }
+};
+
+// Some common hashers.
+//
+struct PtrHasher
+{
+  XMLSize_t getHashVal(const void* key, XMLSize_t mod) const
+  {
+    return ((XMLSize_t)key) % mod;
+  }
+
+  bool equals(const void *const key1, const void *const key2) const
+  {
+    return key1 == key2;
+  }
+};
+
 //
 //  Forward declare the enumerator so he can be our friend. Can you say
 //  friend? Sure...
 //
-template <class TVal> class RefHashTableOfEnumerator;
-template <class TVal> struct RefHashTableBucketElem;
-
+template <class TVal, class THasher = StringHasher>
+class RefHashTableOfEnumerator;
 
 //
 //  This should really be a nested class, but some of the compilers we
 //  have to support cannot deal with that!
 //
-template <class TVal> struct RefHashTableBucketElem
+template <class TVal>
+struct RefHashTableBucketElem
 {
-    RefHashTableBucketElem(void* key, TVal* const value, 
RefHashTableBucketElem<TVal>* next)
-               : fData(value), fNext(next), fKey(key)
-        {
-        }
-
-    RefHashTableBucketElem(){};
-    ~RefHashTableBucketElem(){};
-
-    TVal*                           fData;
-    RefHashTableBucketElem<TVal>*   fNext;
-       void*                                                   fKey;
+  RefHashTableBucketElem(void* key, TVal* const value, 
RefHashTableBucketElem<TVal>* next)
+      : fData(value), fNext(next), fKey(key)
+  {
+  }
+
+  RefHashTableBucketElem(){};
+  ~RefHashTableBucketElem(){};
+
+  TVal*                           fData;
+  RefHashTableBucketElem<TVal>*   fNext;
+  void*                           fKey;
 
 private:
     // -----------------------------------------------------------------------
     //  Unimplemented constructors and operators
     // -----------------------------------------------------------------------
-    RefHashTableBucketElem(const RefHashTableBucketElem<TVal>&);
-    RefHashTableBucketElem<TVal>& operator=(const 
RefHashTableBucketElem<TVal>&);
+  RefHashTableBucketElem(const RefHashTableBucketElem<TVal>&);
+  RefHashTableBucketElem<TVal>& operator=(const RefHashTableBucketElem<TVal>&);
 };
 
 
-template <class TVal> class RefHashTableOf : public XMemory
+template <class TVal, class THasher = StringHasher>
+class RefHashTableOf : public XMemory
 {
 public:
     // -----------------------------------------------------------------------
     //  Constructors and Destructor
     // -----------------------------------------------------------------------
-       // backwards compatability - default hasher is HashXMLCh
-    RefHashTableOf
-    (
-        const XMLSize_t modulus
-        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
-    );
-       // backwards compatability - default hasher is HashXMLCh
-    RefHashTableOf
-    (
-        const XMLSize_t modulus
-        , const bool adoptElems
-        , MemoryManager* const manager =  XMLPlatformUtils::fgMemoryManager
-    );
-       // if a hash function is passed in, it will be deleted when the 
hashtable is deleted.
-       // use a new instance of the hasher class for each hashtable, otherwise 
one hashtable
-       // may delete the hasher of a different hashtable if both use the same 
hasher.
-    RefHashTableOf
-    (
-        const XMLSize_t modulus
-        , const bool adoptElems
-        , HashBase* hashBase
-        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
-    );
+    RefHashTableOf(
+      const XMLSize_t modulus,
+      MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+    RefHashTableOf(
+      const XMLSize_t modulus,
+      const THasher& hasher,
+      MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+    RefHashTableOf(
+      const XMLSize_t modulus,
+      const bool adoptElems,
+      MemoryManager* const manager =  XMLPlatformUtils::fgMemoryManager);
+
+    RefHashTableOf(
+      const XMLSize_t modulus,
+      const bool adoptElems,
+      const THasher& hasher,
+      MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
     ~RefHashTableOf();
 
 
@@ -109,7 +137,7 @@
     void removeKey(const void* const key);
     void removeAll();
     void cleanup();
-    void reinitialize(HashBase* hashBase);
+    void reinitialize(const THasher& hasher);
     void transferElement(const void* const key1, void* key2);
     TVal* orphanKey(const void* const key);
 
@@ -131,21 +159,21 @@
     // -----------------------------------------------------------------------
     //  Putters
     // -----------------------------------------------------------------------
-       void put(void* key, TVal* const valueToAdopt);
+    void put(void* key, TVal* const valueToAdopt);
 
 
 private :
     // -----------------------------------------------------------------------
     //  Declare our friends
     // -----------------------------------------------------------------------
-    friend class RefHashTableOfEnumerator<TVal>;
+    friend class RefHashTableOfEnumerator<TVal, THasher>;
 
 private:
     // -----------------------------------------------------------------------
     //  Unimplemented constructors and operators
     // -----------------------------------------------------------------------
-    RefHashTableOf(const RefHashTableOf<TVal>&);
-    RefHashTableOf<TVal>& operator=(const RefHashTableOf<TVal>&);
+    RefHashTableOf(const RefHashTableOf<TVal, THasher>&);
+    RefHashTableOf<TVal, THasher>& operator=(const RefHashTableOf<TVal, 
THasher>&);
 
     // -----------------------------------------------------------------------
     //  Private methods
@@ -181,7 +209,7 @@
     XMLSize_t                      fHashModulus;
     XMLSize_t                      fInitialModulus;
     XMLSize_t                      fCount;
-    HashBase*                      fHash;
+    THasher                        fHasher;
 };
 
 
@@ -190,18 +218,19 @@
 //  An enumerator for a value array. It derives from the basic enumerator
 //  class, so that value vectors can be generically enumerated.
 //
-template <class TVal> class RefHashTableOfEnumerator : public 
XMLEnumerator<TVal>, public XMemory
+template <class TVal, class THasher>
+class RefHashTableOfEnumerator : public XMLEnumerator<TVal>, public XMemory
 {
 public :
     // -----------------------------------------------------------------------
     //  Constructors and Destructor
     // -----------------------------------------------------------------------
-    RefHashTableOfEnumerator(RefHashTableOf<TVal>* const toEnum
+    RefHashTableOfEnumerator(RefHashTableOf<TVal, THasher>* const toEnum
         , const bool adopt = false
         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
     virtual ~RefHashTableOfEnumerator();
 
-    RefHashTableOfEnumerator(const RefHashTableOfEnumerator<TVal>&);
+    RefHashTableOfEnumerator(const RefHashTableOfEnumerator<TVal, THasher>&);
     // -----------------------------------------------------------------------
     //  Enum interface
     // -----------------------------------------------------------------------
@@ -218,7 +247,8 @@
     // -----------------------------------------------------------------------
     //  Unimplemented constructors and operators
     // -----------------------------------------------------------------------
-    RefHashTableOfEnumerator<TVal>& operator=(const 
RefHashTableOfEnumerator<TVal>&);
+    RefHashTableOfEnumerator<TVal, THasher>&
+    operator=(const RefHashTableOfEnumerator<TVal, THasher>&);
 
     // -----------------------------------------------------------------------
     //  Private methods
@@ -247,7 +277,7 @@
     bool                                  fAdopted;
     RefHashTableBucketElem<TVal>*         fCurElem;
     XMLSize_t                             fCurHash;
-    RefHashTableOf<TVal>*                 fToEnum;
+    RefHashTableOf<TVal, THasher>*        fToEnum;
     MemoryManager* const                  fMemoryManager;
 };
 

Modified: xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp Mon Jul 21 
06:08:10 2008
@@ -44,6 +44,21 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
+struct CMStateSetHasher
+{
+  XMLSize_t getHashVal(const void *const key, XMLSize_t mod)
+  {
+    const CMStateSet* const pkey = (const CMStateSet*) key;
+    return ((pkey->hashCode()) % mod);
+  }
+
+  bool equals(const void *const key1, const void *const key2)
+  {
+    const CMStateSet* const pkey1 = (const CMStateSet*) key1;
+    const CMStateSet* const pkey2 = (const CMStateSet*) key2;
+    return (*pkey1==*pkey2);
+  }
+};
 
 // ---------------------------------------------------------------------------
 //  DFAContentModel: Constructors and Destructor
@@ -247,7 +262,7 @@
         }
 
         unsigned int nextLoop = 0;
-        if(!handleRepetitions(curElem, curState, loopCount, nextState, 
nextLoop, elemIndex, 0)) 
+        if(!handleRepetitions(curElem, curState, loopCount, nextState, 
nextLoop, elemIndex, 0))
         {
             *indexFailingChild=childIndex;
             return false;
@@ -382,7 +397,7 @@
         }
 
         unsigned int nextLoop = 0;
-        if(!handleRepetitions(curElem, curState, loopCount, nextState, 
nextLoop, elemIndex, &comparator)) 
+        if(!handleRepetitions(curElem, curState, loopCount, nextState, 
nextLoop, elemIndex, &comparator))
         {
             *indexFailingChild=childIndex;
             return false;
@@ -454,14 +469,14 @@
                     //  <xs:any namespace="##any" processContents="skip"/>
                     // </xs:sequence>
                     //
-                    // In the DFA there will be two transitions from the 
current state which 
+                    // In the DFA there will be two transitions from the 
current state which
                     // allow "foo". Note that this is not a UPA violation. The 
ambiguity of which
-                    // transition to take is resolved by the current value of 
the counter. Since 
+                    // transition to take is resolved by the current value of 
the counter. Since
                     // we've already seen enough instances of the first "foo" 
perhaps there is
                     // another element declaration or wildcard deeper in the 
element map which
                     // matches.
                     unsigned int tempNextState = 0;
-                    
+
                     while (++elemIndex < fElemMapSize) {
                         QName* inElem  = fElemMap[elemIndex];
                         ContentSpecNode::NodeTypes type = 
fElemMapType[elemIndex];
@@ -519,12 +534,12 @@
                             }
                         }
                     }
-                    
+
                     // if we still can't find a match, report the error
                     if (elemIndex == fElemMapSize)
                         return false;
-                    
-                    // if we found a match, set the next state and reset the 
+
+                    // if we found a match, set the next state and reset the
                     // counter if the next state is a counting state.
                     nextState = tempNextState;
                     Occurence* o = fCountingStates[nextState];
@@ -915,12 +930,11 @@
     // of sequential loop statesToDo to find out),
     // while the role that statesToDo plays remain unchanged.
     //
-    RefHashTableOf<XMLInteger> *stateTable =
-        new (fMemoryManager) RefHashTableOf<XMLInteger>
+    RefHashTableOf<XMLInteger, CMStateSetHasher> *stateTable =
+        new (fMemoryManager) RefHashTableOf<XMLInteger, CMStateSetHasher>
         (
             curArraySize
             , true
-            , new (fMemoryManager) HashCMStateSet()
             , fMemoryManager
         );
     //stateTable->put((CMStateSet*)setT, new (fMemoryManager) XMLInteger(0));

Modified: 
xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp 
(original)
+++ xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.cpp 
Mon Jul 21 06:08:10 2008
@@ -58,7 +58,6 @@
 #include <xercesc/util/XMLInitializer.hpp>
 
 #include <xercesc/internal/XTemplateSerializer.hpp>
-#include <xercesc/util/HashPtr.hpp>
 
 XERCES_CPP_NAMESPACE_BEGIN
 
@@ -124,7 +123,7 @@
 //  DatatypeValidatorFactory: Static member data
 // ---------------------------------------------------------------------------
 RefHashTableOf<DatatypeValidator>* DatatypeValidatorFactory::fBuiltInRegistry 
= 0;
-RefHashTableOf<XMLCanRepGroup>*    DatatypeValidatorFactory::fCanRepRegistry = 
0;
+RefHashTableOf<XMLCanRepGroup, PtrHasher>* 
DatatypeValidatorFactory::fCanRepRegistry = 0;
 
 void XMLInitializer::initializeDatatypeValidatorFactory()
 {
@@ -533,7 +532,7 @@
       * key:  dv
       * data: XMLCanRepGroup
       ***/
-     fCanRepRegistry  = new RefHashTableOf<XMLCanRepGroup>(29, true, new 
HashPtr() );
+     fCanRepRegistry  = new RefHashTableOf<XMLCanRepGroup, PtrHasher>(29, 
true);
 
      fCanRepRegistry->put((void*) 
getDatatypeValidator(SchemaSymbols::fgDT_DECIMAL),
                         new  XMLCanRepGroup(XMLCanRepGroup::Decimal));
@@ -899,4 +898,3 @@
 /**
   * End of file DatatypeValidatorFactory.cpp
   */
-

Modified: 
xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp 
(original)
+++ xerces/c/trunk/src/xercesc/validators/datatype/DatatypeValidatorFactory.hpp 
Mon Jul 21 06:08:10 2008
@@ -232,7 +232,7 @@
     // -----------------------------------------------------------------------
     XERCES_CPP_NAMESPACE_QUALIFIER 
RefHashTableOf<XERCES_CPP_NAMESPACE_QUALIFIER DatatypeValidator>*        
fUserDefinedRegistry;
     static XERCES_CPP_NAMESPACE_QUALIFIER RefHashTableOf<DatatypeValidator>* 
fBuiltInRegistry;
-    static XERCES_CPP_NAMESPACE_QUALIFIER RefHashTableOf<XMLCanRepGroup>*    
fCanRepRegistry;
+    static XERCES_CPP_NAMESPACE_QUALIFIER RefHashTableOf<XMLCanRepGroup, 
PtrHasher>*    fCanRepRegistry;
     XERCES_CPP_NAMESPACE_QUALIFIER MemoryManager* const fMemoryManager;
 
     friend class XPath2ContextImpl;
@@ -283,4 +283,3 @@
 /**
   * End of file DatatypeValidatorFactory.hpp
   */
-

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp Mon Jul 21 
06:08:10 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -82,9 +82,9 @@
         fGramDesc = new (fMemoryManager) 
XMLSchemaDescriptionImpl(XMLUni::fgXMLNSURIName, fMemoryManager);
 
         // Create annotation table
-        fAnnotations = new (fMemoryManager) RefHashTableOf<XSAnnotation>
+        fAnnotations = new (fMemoryManager) RefHashTableOf<XSAnnotation, 
PtrHasher>
         (
-            29, true, new (fMemoryManager) HashPtr(), fMemoryManager
+            29, true, fMemoryManager
         );
 
         //
@@ -169,7 +169,7 @@
         if(!fElemNonDeclPool)
             fElemNonDeclPool = new (fMemoryManager) 
RefHash3KeysIdPool<SchemaElementDecl>(29, true, 128, fMemoryManager);
         retVal->setId(fElemNonDeclPool->put((void*)retVal->getBaseName(), 
uriId, scope, retVal));
-    } else 
+    } else
     {
         retVal->setId(fElemDeclPool->put((void*)retVal->getBaseName(), uriId, 
scope, retVal));
     }
@@ -211,7 +211,7 @@
 
 void SchemaGrammar::setGrammarDescription(XMLGrammarDescription* gramDesc)
 {
-    if ((!gramDesc) || 
+    if ((!gramDesc) ||
         (gramDesc->getGrammarType() != Grammar::SchemaGrammarType))
         return;
 
@@ -233,7 +233,7 @@
 void SchemaGrammar::addAnnotation(XSAnnotation* const annotation)
 {
     XSAnnotation* lAnnot = fAnnotations->get(this);
-       
+
     if (lAnnot)
         lAnnot->setNext(annotation);
     else
@@ -273,8 +273,8 @@
         /***
          * Serialize NameIdPool<XMLNotationDecl>*           fNotationDeclPool;
          ***/
-        XTemplateSerializer::storeObject(fNotationDeclPool, serEng);        
-    
+        XTemplateSerializer::storeObject(fNotationDeclPool, serEng);
+
         /***
          *
          * Serialize RefHashTableOf<XMLAttDef>*             
fAttributeDeclRegistry;
@@ -289,7 +289,7 @@
         XTemplateSerializer::storeObject(fComplexTypeRegistry, serEng);
         XTemplateSerializer::storeObject(fGroupInfoRegistry, serEng);
         XTemplateSerializer::storeObject(fAttGroupInfoRegistry, serEng);
-       
+
         /***
          * Serialize RefHash2KeysTableOf<ElemVector>*       
fValidSubstitutionGroups;
          ***/
@@ -326,8 +326,8 @@
         /***
          * Deserialize NameIdPool<XMLNotationDecl>*           
fNotationDeclPool;
          ***/
-        XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng); 
       
-    
+        XTemplateSerializer::loadObject(&fNotationDeclPool, 109, 128, serEng);
+
         /***
          *
          * Deserialize RefHashTableOf<XMLAttDef>*             
fAttributeDeclRegistry;
@@ -342,7 +342,7 @@
         XTemplateSerializer::loadObject(&fComplexTypeRegistry, 29, true, 
serEng);
         XTemplateSerializer::loadObject(&fGroupInfoRegistry, 13, true, serEng);
         XTemplateSerializer::loadObject(&fAttGroupInfoRegistry, 13, true, 
serEng);
-       
+
         /***
          * Deserialize RefHash2KeysTableOf<ElemVector>*       
fValidSubstitutionGroups;
          ***/

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.hpp Mon Jul 21 
06:08:10 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -230,11 +230,11 @@
     XSAnnotation* getAnnotation();
     const XSAnnotation* getAnnotation() const;
 
-    /** 
+    /**
       * Get annotation hash table, to enumerate through them
       */
-    RefHashTableOf<XSAnnotation>*  getAnnotations();
-    const RefHashTableOf<XSAnnotation>*  getAnnotations() const;
+    RefHashTableOf<XSAnnotation, PtrHasher>*  getAnnotations();
+    const RefHashTableOf<XSAnnotation, PtrHasher>*  getAnnotations() const;
 
     /***
      * Support for Serialization/De-serialization
@@ -307,20 +307,20 @@
     //  fGramDesc: adopted
     //
     // -----------------------------------------------------------------------
-    XMLCh*                                 fTargetNamespace;
-    RefHash3KeysIdPool<SchemaElementDecl>* fElemDeclPool;
-    RefHash3KeysIdPool<SchemaElementDecl>* fElemNonDeclPool;
-    RefHash3KeysIdPool<SchemaElementDecl>* fGroupElemDeclPool;
-    NameIdPool<XMLNotationDecl>*           fNotationDeclPool;
-    RefHashTableOf<XMLAttDef>*             fAttributeDeclRegistry;
-    RefHashTableOf<ComplexTypeInfo>*       fComplexTypeRegistry;
-    RefHashTableOf<XercesGroupInfo>*       fGroupInfoRegistry;
-    RefHashTableOf<XercesAttGroupInfo>*    fAttGroupInfoRegistry;
-    RefHash2KeysTableOf<ElemVector>*       fValidSubstitutionGroups;
-    ValidationContext*                     fValidationContext;
-    MemoryManager*                         fMemoryManager;
-    XMLSchemaDescription*                  fGramDesc;
-    RefHashTableOf<XSAnnotation>*          fAnnotations;
+    XMLCh*                                   fTargetNamespace;
+    RefHash3KeysIdPool<SchemaElementDecl>*   fElemDeclPool;
+    RefHash3KeysIdPool<SchemaElementDecl>*   fElemNonDeclPool;
+    RefHash3KeysIdPool<SchemaElementDecl>*   fGroupElemDeclPool;
+    NameIdPool<XMLNotationDecl>*             fNotationDeclPool;
+    RefHashTableOf<XMLAttDef>*               fAttributeDeclRegistry;
+    RefHashTableOf<ComplexTypeInfo>*         fComplexTypeRegistry;
+    RefHashTableOf<XercesGroupInfo>*         fGroupInfoRegistry;
+    RefHashTableOf<XercesAttGroupInfo>*      fAttGroupInfoRegistry;
+    RefHash2KeysTableOf<ElemVector>*         fValidSubstitutionGroups;
+    ValidationContext*                       fValidationContext;
+    MemoryManager*                           fMemoryManager;
+    XMLSchemaDescription*                    fGramDesc;
+    RefHashTableOf<XSAnnotation, PtrHasher>* fAnnotations;
 
     bool                                   fValidated;
     DatatypeValidatorFactory               fDatatypeRegistry;
@@ -406,12 +406,12 @@
     return fAnnotations->get(this);
 }
 
-inline RefHashTableOf<XSAnnotation>* SchemaGrammar::getAnnotations()
+inline RefHashTableOf<XSAnnotation, PtrHasher>* SchemaGrammar::getAnnotations()
 {
     return fAnnotations;
 }
 
-inline const RefHashTableOf<XSAnnotation>* SchemaGrammar::getAnnotations() 
const
+inline const RefHashTableOf<XSAnnotation, PtrHasher>* 
SchemaGrammar::getAnnotations() const
 {
     return fAnnotations;
 }
@@ -548,7 +548,7 @@
 
 inline XMLSize_t
 SchemaGrammar::putElemDecl(XMLElementDecl* const elemDecl,
-                           const bool notDeclared) 
+                           const bool notDeclared)
 {
     if (notDeclared)
     {

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Jul 21 
06:08:10 2008
@@ -2324,7 +2324,7 @@
         if (fixedVal) {
 
             fixedVal = 0;
-            reportSchemaError(elem, XMLUni::fgXMLErrDomain, 
XMLErrs::AttributeDefaultFixedValue,                             
+            reportSchemaError(elem, XMLUni::fgXMLErrDomain, 
XMLErrs::AttributeDefaultFixedValue,
                               (name) ? name : ref);
         }
 
@@ -8725,11 +8725,10 @@
     fNonXSAttList = new (fMemoryManager) ValueVectorOf<DOMNode*>(4, 
fMemoryManager);
     fNotationRegistry = new (fMemoryManager) RefHash2KeysTableOf<XMLCh>(13, 
(bool) false, fMemoryManager);
     fSchemaInfoList = new (fMemoryManager) RefHash2KeysTableOf<SchemaInfo>(29, 
fMemoryManager);
-    fPreprocessedNodes = new (fMemoryManager) RefHashTableOf<SchemaInfo>
+    fPreprocessedNodes = new (fMemoryManager) RefHashTableOf<SchemaInfo, 
PtrHasher>
     (
         29
         , false
-        , new (fMemoryManager) HashPtr()
         , fMemoryManager
     );
     fLocator = new (fMemoryManager) XSDLocator();
@@ -8843,7 +8842,7 @@
         if (!fIC_ElementsNS) {
 
             fIC_ElementsNS = new (fMemoryManager) 
RefHashTableOf<ElemVector>(13, fMemoryManager);
-            fIC_NodeListNS = new (fMemoryManager) 
RefHashTableOf<ValueVectorOf<DOMElement*> >(29, true, new (fMemoryManager) 
HashPtr(), fMemoryManager);
+            fIC_NodeListNS = new (fMemoryManager) 
RefHashTableOf<ValueVectorOf<DOMElement*>, PtrHasher>(29, true, fMemoryManager);
         }
 
         if (fIC_ElementsNS->containsKey(fTargetNSURIString))
@@ -9175,7 +9174,7 @@
 void TraverseSchema::validateAnnotations() {
 
     MemoryManager  *memMgr = fMemoryManager;
-    RefHashTableOfEnumerator<XSAnnotation> xsAnnotationEnum = 
RefHashTableOfEnumerator<XSAnnotation> (fSchemaGrammar->getAnnotations(), 
false, memMgr);
+    RefHashTableOfEnumerator<XSAnnotation, PtrHasher> xsAnnotationEnum = 
RefHashTableOfEnumerator<XSAnnotation, PtrHasher> 
(fSchemaGrammar->getAnnotations(), false, memMgr);
     XSAnnotation& xsAnnot = xsAnnotationEnum.nextElement();
     XSAnnotation* nextAnnot;
 

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp Mon Jul 21 
06:08:10 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -183,7 +183,7 @@
     const XMLCh*        traverseNotationDecl(const DOMElement* const childElem,
                                              const XMLCh* const name,
                                              const XMLCh* const uriStr);
-    ContentSpecNode*    traverseChoiceSequence(const DOMElement* const 
elemDecl,                                               
+    ContentSpecNode*    traverseChoiceSequence(const DOMElement* const 
elemDecl,
                                                const int modelGroupType,
                                                bool& hasChildren);
     ContentSpecNode*    traverseAny(const DOMElement* const anyDecl);
@@ -390,7 +390,7 @@
       * the type is a complex type
       */
     ComplexTypeInfo* getElementComplexTypeInfo(const DOMElement* const elem,
-                                               const XMLCh* const typeStr,     
                                          
+                                               const XMLCh* const typeStr,
                                                const XMLCh* const 
otherSchemaURI);
 
     /**
@@ -436,7 +436,7 @@
                                     const bool toTrim = false);
 
     /* return minOccurs */
-    int checkMinMax(ContentSpecNode* const specNode,    
+    int checkMinMax(ContentSpecNode* const specNode,
                      const DOMElement* const elem,
                      const int allContext = Not_All_Context);
 
@@ -446,8 +446,8 @@
     void processComplexContent(const DOMElement* const elem,
                                const XMLCh* const typeName,
                                const DOMElement* const childElem,
-                               ComplexTypeInfo* const typeInfo,                
               
-                               const XMLCh* const baseLocalPart,               
                
+                               ComplexTypeInfo* const typeInfo,
+                               const XMLCh* const baseLocalPart,
                                const bool isMixed,
                                const bool isBaseAnyType = false);
 
@@ -486,7 +486,7 @@
       * Process attributes of a complex type
       */
     void processAttributes(const DOMElement* const elem,
-                           const DOMElement* const attElem,                    
       
+                           const DOMElement* const attElem,
                            ComplexTypeInfo* const typeInfo,
                            const bool isBaseAnyType = false);
 
@@ -745,7 +745,7 @@
     RefHashTableOf<XercesGroupInfo>*               fGroupRegistry;
     RefHashTableOf<XercesAttGroupInfo>*            fAttGroupRegistry;
     RefHashTableOf<ElemVector>*                    fIC_ElementsNS;
-    RefHashTableOf<SchemaInfo>*                    fPreprocessedNodes;
+    RefHashTableOf<SchemaInfo, PtrHasher>*         fPreprocessedNodes;
     SchemaInfo*                                    fSchemaInfo;
     XercesGroupInfo*                               fCurrentGroupInfo;
     XercesAttGroupInfo*                            fCurrentAttGroupInfo;
@@ -756,7 +756,7 @@
     ValueVectorOf<const DOMElement*>*              fDeclStack;
     ValueVectorOf<unsigned int>**                  fGlobalDeclarations;
     ValueVectorOf<DOMNode*>*                       fNonXSAttList;
-    RefHashTableOf<ValueVectorOf<DOMElement*> >*   fIC_NodeListNS;
+    RefHashTableOf<ValueVectorOf<DOMElement*>, PtrHasher>* fIC_NodeListNS;
     RefHash2KeysTableOf<XMLCh>*                    fNotationRegistry;
     RefHash2KeysTableOf<XMLCh>*                    fRedefineComponents;
     RefHash2KeysTableOf<IdentityConstraint>*       fIdentityConstraintNames;
@@ -923,4 +923,3 @@
 /**
   * End of file TraverseSchema.hpp
   */
-

Modified: 
xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.cpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.cpp 
(original)
+++ xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.cpp 
Mon Jul 21 06:08:10 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -78,11 +78,10 @@
 void ValueStoreCache::startElement() {
 
     fGlobalMapStack->push(fGlobalICMap);
-    fGlobalICMap = new (fMemoryManager) RefHashTableOf<ValueStore>
+    fGlobalICMap = new (fMemoryManager) RefHashTableOf<ValueStore, PtrHasher>
     (
         13
         , false
-        , new (fMemoryManager) HashPtr()
         , fMemoryManager
     );
 }
@@ -93,8 +92,8 @@
         return; // must be an invalid doc!
     }
 
-    RefHashTableOf<ValueStore>* oldMap = fGlobalMapStack->pop();
-    RefHashTableOfEnumerator<ValueStore> mapEnum(oldMap, false, 
fMemoryManager);
+    RefHashTableOf<ValueStore, PtrHasher>* oldMap = fGlobalMapStack->pop();
+    RefHashTableOfEnumerator<ValueStore, PtrHasher> mapEnum(oldMap, false, 
fMemoryManager);
 //    Janitor<RefHashTableOf<ValueStore> > janMap(oldMap);
 
     while (mapEnum.hasMoreElements()) {
@@ -127,11 +126,10 @@
 void ValueStoreCache::init() {
 
     fValueStores = new (fMemoryManager) RefVectorOf<ValueStore>(8, true, 
fMemoryManager);
-    fGlobalICMap = new (fMemoryManager) RefHashTableOf<ValueStore>
+    fGlobalICMap = new (fMemoryManager) RefHashTableOf<ValueStore, PtrHasher>
     (
         13
         , false
-        , new (fMemoryManager) HashPtr()
         , fMemoryManager
     );
     fIC2ValueStoreMap = new (fMemoryManager) RefHash2KeysTableOf<ValueStore>
@@ -141,7 +139,7 @@
         , new (fMemoryManager) HashPtr()
         , fMemoryManager
     );
-    fGlobalMapStack = new (fMemoryManager) 
RefStackOf<RefHashTableOf<ValueStore> >(8, true, fMemoryManager);
+    fGlobalMapStack = new (fMemoryManager) 
RefStackOf<RefHashTableOf<ValueStore, PtrHasher> >(8, true, fMemoryManager);
 }
 
 void ValueStoreCache::initValueStoresFor(SchemaElementDecl* const elemDecl,
@@ -183,4 +181,3 @@
 /**
   * End of file ValueStoreCache.cpp
   */
-

Modified: 
xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.hpp?rev=678409&r1=678408&r2=678409&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.hpp 
(original)
+++ xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.hpp 
Mon Jul 21 06:08:10 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -121,9 +121,9 @@
     //  Data
     // -----------------------------------------------------------------------
     RefVectorOf<ValueStore>*                 fValueStores;
-    RefHashTableOf<ValueStore>*              fGlobalICMap;
+    RefHashTableOf<ValueStore, PtrHasher>*   fGlobalICMap;
     RefHash2KeysTableOf<ValueStore>*         fIC2ValueStoreMap;
-    RefStackOf<RefHashTableOf<ValueStore> >* fGlobalMapStack;
+    RefStackOf<RefHashTableOf<ValueStore, PtrHasher> >* fGlobalMapStack;
     XMLScanner*                              fScanner;
     MemoryManager*                           fMemoryManager;
 };
@@ -170,4 +170,3 @@
 /**
   * End of file ValueStoreCache.hpp
   */
-



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to