You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by bo...@apache.org on 2008/07/24 12:29:05 UTC
svn commit: r679340 [1/2] - in /xerces/c/trunk: doc/
projects/MacOS/Xcode/XercesLib/XercesLib.xcode/
projects/Win32/BCB6/Xerces-all/XercesLib/
projects/Win32/BCC.551/Xerces-all/MemHandlerTest/
projects/Win32/BCC.551/Xerces-all/XercesLib/ projects/Win32...
Author: borisk
Date: Thu Jul 24 03:28:29 2008
New Revision: 679340
URL: http://svn.apache.org/viewvc?rev=679340&view=rev
Log:
Port other hash tables not to use HashBase interface.
Added:
xerces/c/trunk/src/xercesc/util/Hashers.hpp (with props)
Removed:
xerces/c/trunk/src/xercesc/util/HashBase.hpp
xerces/c/trunk/src/xercesc/util/HashCMStateSet.hpp
xerces/c/trunk/src/xercesc/util/HashPtr.cpp
xerces/c/trunk/src/xercesc/util/HashPtr.hpp
xerces/c/trunk/src/xercesc/util/HashXMLCh.cpp
xerces/c/trunk/src/xercesc/util/HashXMLCh.hpp
xerces/c/trunk/tests/src/MemHandlerTest/SimpleHashPtr.cpp
xerces/c/trunk/tests/src/MemHandlerTest/SimpleHashPtr.hpp
Modified:
xerces/c/trunk/doc/Doxyfile
xerces/c/trunk/projects/MacOS/Xcode/XercesLib/XercesLib.xcode/project.pbxproj
xerces/c/trunk/projects/Win32/BCB6/Xerces-all/XercesLib/XercesLib.bpr
xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/MemHandlerTest/MemHandlerTest.mak
xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/XercesLib/XercesLib.mak
xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.dsp
xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.mak
xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.mak
xerces/c/trunk/projects/Win32/VC7.1/xerces-all/MemHandlerTest/MemHandlerTest.vcproj
xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj
xerces/c/trunk/projects/Win32/VC8/xerces-all/MemHandlerTest/MemHandlerTest.vcproj
xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj
xerces/c/trunk/projects/Win32/VC9/xerces-all/MemHandlerTest/MemHandlerTest.vcproj
xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj
xerces/c/trunk/src/Makefile.am
xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c
xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp
xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.hpp
xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp
xerces/c/trunk/src/xercesc/internal/XSObjectFactory.cpp
xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp
xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp
xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.c
xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp
xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.c
xerces/c/trunk/src/xercesc/util/RefHash3KeysIdPool.hpp
xerces/c/trunk/src/xercesc/util/RefHashTableOf.hpp
xerces/c/trunk/src/xercesc/util/ValueHashTableOf.c
xerces/c/trunk/src/xercesc/util/ValueHashTableOf.hpp
xerces/c/trunk/src/xercesc/validators/common/DFAContentModel.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaGrammar.cpp
xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
xerces/c/trunk/src/xercesc/validators/schema/identity/FieldActivator.cpp
xerces/c/trunk/src/xercesc/validators/schema/identity/FieldActivator.hpp
xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.cpp
xerces/c/trunk/src/xercesc/validators/schema/identity/ValueStoreCache.hpp
xerces/c/trunk/tests/Makefile.am
xerces/c/trunk/tests/src/MemHandlerTest/MemoryMonitor.hpp
xerces/c/trunk/tests/src/MemHandlerTest/SimpleValueHashTableOf.hpp
Modified: xerces/c/trunk/doc/Doxyfile
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/Doxyfile?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/doc/Doxyfile (original)
+++ xerces/c/trunk/doc/Doxyfile Thu Jul 24 03:28:29 2008
@@ -428,10 +428,7 @@
TransENameMap.hpp \
EncodingValidator.hpp \
FlagJanitor.hpp \
- HashCMStateSet.hpp \
- HashBase.hpp \
- HashPtr.hpp \
- HashXMLCh.hpp \
+ Hashers.hpp \
KeyValuePair.hpp \
KeyRefPair.hpp \
KVStringPair.hpp \
Modified: xerces/c/trunk/projects/MacOS/Xcode/XercesLib/XercesLib.xcode/project.pbxproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/MacOS/Xcode/XercesLib/XercesLib.xcode/project.pbxproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/MacOS/Xcode/XercesLib/XercesLib.xcode/project.pbxproj (original)
+++ xerces/c/trunk/projects/MacOS/Xcode/XercesLib/XercesLib.xcode/project.pbxproj Thu Jul 24 03:28:29 2008
@@ -1168,39 +1168,7 @@
fileEncoding = 30;
isa = PBXFileReference;
lastKnownFileType = sourcecode.cpp.h;
- path = HashBase.hpp;
- refType = 4;
- sourceTree = "<group>";
- };
- 02058DE2FF8AF8CD7F000001 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.cpp;
- path = HashPtr.cpp;
- refType = 4;
- sourceTree = "<group>";
- };
- 02058DE3FF8AF8CD7F000001 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.h;
- path = HashPtr.hpp;
- refType = 4;
- sourceTree = "<group>";
- };
- 02058DE4FF8AF8CD7F000001 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.cpp;
- path = HashXMLCh.cpp;
- refType = 4;
- sourceTree = "<group>";
- };
- 02058DE5FF8AF8CD7F000001 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.h;
- path = HashXMLCh.hpp;
+ path = Hashers.hpp;
refType = 4;
sourceTree = "<group>";
};
@@ -14009,14 +13977,6 @@
refType = 4;
sourceTree = "<group>";
};
- F5A6C93701B968C801000102 = {
- fileEncoding = 30;
- isa = PBXFileReference;
- lastKnownFileType = sourcecode.cpp.h;
- path = HashCMStateSet.hpp;
- refType = 4;
- sourceTree = "<group>";
- };
F5A6C93801B968C801000102 = {
fileEncoding = 30;
isa = PBXFileReference;
Modified: xerces/c/trunk/projects/Win32/BCB6/Xerces-all/XercesLib/XercesLib.bpr
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/BCB6/Xerces-all/XercesLib/XercesLib.bpr?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/BCB6/Xerces-all/XercesLib/XercesLib.bpr (original)
+++ xerces/c/trunk/projects/Win32/BCB6/Xerces-all/XercesLib/XercesLib.bpr Thu Jul 24 03:28:29 2008
@@ -44,8 +44,6 @@
..\..\..\..\..\Build\Win32\BCB6\obj\BinMemInputStream.obj
..\..\..\..\..\Build\Win32\BCB6\obj\BitSet.obj
..\..\..\..\..\Build\Win32\BCB6\obj\EncodingValidator.obj
- ..\..\..\..\..\Build\Win32\BCB6\obj\HashPtr.obj
- ..\..\..\..\..\Build\Win32\BCB6\obj\HashXMLCh.obj
..\..\..\..\..\Build\Win32\BCB6\obj\HeaderDummy.obj
..\..\..\..\..\Build\Win32\BCB6\obj\HexBin.obj
..\..\..\..\..\Build\Win32\BCB6\obj\KVStringPair.obj
@@ -413,8 +411,6 @@
<FILE FILENAME="..\..\..\..\..\src\xercesc\util\BinMemInputStream.cpp" FORMNAME="" UNITNAME="BinMemInputStream" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="..\..\..\..\..\src\xercesc\util\BitSet.cpp" FORMNAME="" UNITNAME="BitSet" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="..\..\..\..\..\src\xercesc\util\EncodingValidator.cpp" FORMNAME="" UNITNAME="EncodingValidator" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
- <FILE FILENAME="..\..\..\..\..\src\xercesc\util\HashPtr.cpp" FORMNAME="" UNITNAME="HashPtr" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
- <FILE FILENAME="..\..\..\..\..\src\xercesc\util\HashXMLCh.cpp" FORMNAME="" UNITNAME="HashXMLCh" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="..\..\..\..\..\src\xercesc\util\HeaderDummy.cpp" FORMNAME="" UNITNAME="HeaderDummy" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="..\..\..\..\..\src\xercesc\util\HexBin.cpp" FORMNAME="" UNITNAME="HexBin" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
<FILE FILENAME="..\..\..\..\..\src\xercesc\util\KVStringPair.cpp" FORMNAME="" UNITNAME="KVStringPair" CONTAINERID="CCompiler" DESIGNCLASS="" LOCALCOMMAND=""/>
Modified: xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/MemHandlerTest/MemHandlerTest.mak
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/MemHandlerTest/MemHandlerTest.mak?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/MemHandlerTest/MemHandlerTest.mak (original)
+++ xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/MemHandlerTest/MemHandlerTest.mak Thu Jul 24 03:28:29 2008
@@ -5,7 +5,7 @@
# ---------------------------------------------------------------------------
TARGETPATH=..\..\..\..\..\Build\Win32\BCC.551
PROJECT = $(TARGETPATH)\MemHandlerTest.exe
-OBJFILES = $(TARGETPATH)\obj\MemoryMonitor.obj $(TARGETPATH)\obj\SimpleHashPtr.obj $(TARGETPATH)\obj\MemHandlerTest.obj
+OBJFILES = $(TARGETPATH)\obj\MemoryMonitor.obj $(TARGETPATH)\obj\MemHandlerTest.obj
RESFILES =
MAINSOURCE = MemHandlerTest.cpp
RESDEPEN = $(RESFILES)
Modified: xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/XercesLib/XercesLib.mak
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/XercesLib/XercesLib.mak?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/XercesLib/XercesLib.mak (original)
+++ xerces/c/trunk/projects/Win32/BCC.551/Xerces-all/XercesLib/XercesLib.mak Thu Jul 24 03:28:29 2008
@@ -41,8 +41,6 @@
$(TARGETPATH)\obj\BinInputStream.obj \
$(TARGETPATH)\obj\BinMemInputStream.obj \
$(TARGETPATH)\obj\BitSet.obj \
- $(TARGETPATH)\obj\HashPtr.obj \
- $(TARGETPATH)\obj\HashXMLCh.obj \
$(TARGETPATH)\obj\HeaderDummy.obj \
$(TARGETPATH)\obj\HexBin.obj \
$(TARGETPATH)\obj\KVStringPair.obj \
Modified: xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.dsp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.dsp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.dsp (original)
+++ xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.dsp Thu Jul 24 03:28:29 2008
@@ -141,10 +141,6 @@
SOURCE=..\..\..\..\..\tests\src\MemHandlerTest\MemoryMonitor.cpp
# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.cpp
-# End Source File
# End Group
# Begin Group "Header Files"
@@ -155,10 +151,6 @@
# End Source File
# Begin Source File
-SOURCE=..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.hpp
-# End Source File
-# Begin Source File
-
SOURCE=..\..\..\..\..\tests\src\MemHandlerTest\SimpleValueHashTableOf.hpp
# End Source File
# End Group
Modified: xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.mak
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.mak?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.mak (original)
+++ xerces/c/trunk/projects/Win32/VC6/xerces-all/MemHandlerTest/MemHandlerTest.mak Thu Jul 24 03:28:29 2008
@@ -54,7 +54,6 @@
CLEAN :
!ENDIF
-@erase "$(INTDIR)\MemoryMonitor.obj"
- -@erase "$(INTDIR)\SimpleHashPtr.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\MemHandlerTest.exe"
@@ -73,7 +72,6 @@
LINK32_FLAGS=kernel32.lib user32.lib xerces-c_3.lib /version:1.0 /subsystem:console /incremental:no /pdb:"$(OUTDIR)\MemHandlerTest.pdb" /machine:I386 /out:"$(OUTDIR)\MemHandlerTest.exe" /libpath:"..\..\..\..\..\Build\Win32\VC6\Release"
LINK32_OBJS= \
"$(INTDIR)\MemoryMonitor.obj" \
- "$(INTDIR)\SimpleHashPtr.obj" \
"$(OUTDIR)\xerces-c_3.lib"
"$(OUTDIR)\MemHandlerTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@@ -105,7 +103,6 @@
CLEAN :
!ENDIF
-@erase "$(INTDIR)\MemoryMonitor.obj"
- -@erase "$(INTDIR)\SimpleHashPtr.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\MemHandlerTest.exe"
@@ -127,7 +124,6 @@
LINK32_FLAGS=kernel32.lib user32.lib xerces-c_3D.lib /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\MemHandlerTest.pdb" /debug /machine:I386 /out:"$(OUTDIR)\MemHandlerTest.exe" /pdbtype:sept /libpath:"..\..\..\..\..\Build\Win32\VC6\Debug"
LINK32_OBJS= \
"$(INTDIR)\MemoryMonitor.obj" \
- "$(INTDIR)\SimpleHashPtr.obj" \
"$(OUTDIR)\xerces-c_3D.lib"
"$(OUTDIR)\MemHandlerTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@@ -159,7 +155,6 @@
CLEAN :
!ENDIF
-@erase "$(INTDIR)\MemoryMonitor.obj"
- -@erase "$(INTDIR)\SimpleHashPtr.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\MemHandlerTest.exe"
@@ -181,7 +176,6 @@
LINK32_FLAGS=kernel32.lib user32.lib xerces-c_3D.lib /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\MemHandlerTest.pdb" /debug /machine:IX86 /out:"$(OUTDIR)\MemHandlerTest.exe" /pdbtype:sept /libpath:"..\..\..\..\..\Build\Win64\VC6\Debug" /machine:IA64
LINK32_OBJS= \
"$(INTDIR)\MemoryMonitor.obj" \
- "$(INTDIR)\SimpleHashPtr.obj" \
"$(OUTDIR)\xerces-c_3D.lib"
"$(OUTDIR)\MemHandlerTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@@ -213,7 +207,6 @@
CLEAN :
!ENDIF
-@erase "$(INTDIR)\MemoryMonitor.obj"
- -@erase "$(INTDIR)\SimpleHashPtr.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\MemHandlerTest.exe"
-@erase "$(OUTDIR)\MemHandlerTest.ilk"
@@ -233,7 +226,6 @@
LINK32_FLAGS=kernel32.lib user32.lib xerces-c_3.lib /version:1.0 /subsystem:console /incremental:yes /pdb:"$(OUTDIR)\MemHandlerTest.pdb" /machine:IX86 /out:"$(OUTDIR)\MemHandlerTest.exe" /libpath:"..\..\..\..\..\Build\Win64\VC6\Release" /machine:IA64
LINK32_OBJS= \
"$(INTDIR)\MemoryMonitor.obj" \
- "$(INTDIR)\SimpleHashPtr.obj" \
"$(OUTDIR)\xerces-c_3.lib"
"$(OUTDIR)\MemHandlerTest.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@@ -289,13 +281,6 @@
"$(INTDIR)\MemoryMonitor.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
-
-SOURCE=..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.cpp
-
-"$(INTDIR)\SimpleHashPtr.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
!IF "$(CFG)" == "MemHandlerTest - Win32 Release"
"XercesLib - Win32 Release" :
Modified: xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp (original)
+++ xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp Thu Jul 24 03:28:29 2008
@@ -545,27 +545,7 @@
# End Source File
# Begin Source File
-SOURCE=..\..\..\..\..\src\xercesc\util\HashBase.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\src\xercesc\util\HashCMStateSet.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\src\xercesc\util\HashPtr.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\src\xercesc\util\HashPtr.hpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\src\xercesc\util\HashXMLCh.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\..\..\..\src\xercesc\util\HashXMLCh.hpp
+SOURCE=..\..\..\..\..\src\xercesc\util\Hashers.hpp
# End Source File
# Begin Source File
Modified: xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.mak
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.mak?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.mak (original)
+++ xerces/c/trunk/projects/Win32/VC6/xerces-all/XercesLib/XercesLib.mak Thu Jul 24 03:28:29 2008
@@ -150,8 +150,6 @@
-@erase "$(INTDIR)\GeneralAttributeCheck.obj"
-@erase "$(INTDIR)\Grammar.obj"
-@erase "$(INTDIR)\GrammarResolver.obj"
- -@erase "$(INTDIR)\HashPtr.obj"
- -@erase "$(INTDIR)\HashXMLCh.obj"
-@erase "$(INTDIR)\HexBin.obj"
-@erase "$(INTDIR)\HexBinaryDatatypeValidator.obj"
-@erase "$(INTDIR)\IC_Field.obj"
@@ -405,8 +403,6 @@
"$(INTDIR)\BitSet.obj" \
"$(INTDIR)\DefaultPanicHandler.obj" \
"$(INTDIR)\EncodingValidator.obj" \
- "$(INTDIR)\HashPtr.obj" \
- "$(INTDIR)\HashXMLCh.obj" \
"$(INTDIR)\HexBin.obj" \
"$(INTDIR)\KVStringPair.obj" \
"$(INTDIR)\Mutexes.obj" \
@@ -793,8 +789,6 @@
-@erase "$(INTDIR)\GeneralAttributeCheck.obj"
-@erase "$(INTDIR)\Grammar.obj"
-@erase "$(INTDIR)\GrammarResolver.obj"
- -@erase "$(INTDIR)\HashPtr.obj"
- -@erase "$(INTDIR)\HashXMLCh.obj"
-@erase "$(INTDIR)\HexBin.obj"
-@erase "$(INTDIR)\HexBinaryDatatypeValidator.obj"
-@erase "$(INTDIR)\IC_Field.obj"
@@ -1049,8 +1043,6 @@
"$(INTDIR)\BitSet.obj" \
"$(INTDIR)\DefaultPanicHandler.obj" \
"$(INTDIR)\EncodingValidator.obj" \
- "$(INTDIR)\HashPtr.obj" \
- "$(INTDIR)\HashXMLCh.obj" \
"$(INTDIR)\HexBin.obj" \
"$(INTDIR)\KVStringPair.obj" \
"$(INTDIR)\Mutexes.obj" \
@@ -1437,8 +1429,6 @@
-@erase "$(INTDIR)\GeneralAttributeCheck.obj"
-@erase "$(INTDIR)\Grammar.obj"
-@erase "$(INTDIR)\GrammarResolver.obj"
- -@erase "$(INTDIR)\HashPtr.obj"
- -@erase "$(INTDIR)\HashXMLCh.obj"
-@erase "$(INTDIR)\HexBin.obj"
-@erase "$(INTDIR)\HexBinaryDatatypeValidator.obj"
-@erase "$(INTDIR)\IC_Field.obj"
@@ -1694,8 +1684,6 @@
"$(INTDIR)\BitSet.obj" \
"$(INTDIR)\DefaultPanicHandler.obj" \
"$(INTDIR)\EncodingValidator.obj" \
- "$(INTDIR)\HashPtr.obj" \
- "$(INTDIR)\HashXMLCh.obj" \
"$(INTDIR)\HexBin.obj" \
"$(INTDIR)\KVStringPair.obj" \
"$(INTDIR)\Mutexes.obj" \
@@ -2082,8 +2070,6 @@
-@erase "$(INTDIR)\GeneralAttributeCheck.obj"
-@erase "$(INTDIR)\Grammar.obj"
-@erase "$(INTDIR)\GrammarResolver.obj"
- -@erase "$(INTDIR)\HashPtr.obj"
- -@erase "$(INTDIR)\HashXMLCh.obj"
-@erase "$(INTDIR)\HexBin.obj"
-@erase "$(INTDIR)\HexBinaryDatatypeValidator.obj"
-@erase "$(INTDIR)\IC_Field.obj"
@@ -2338,8 +2324,6 @@
"$(INTDIR)\BitSet.obj" \
"$(INTDIR)\DefaultPanicHandler.obj" \
"$(INTDIR)\EncodingValidator.obj" \
- "$(INTDIR)\HashPtr.obj" \
- "$(INTDIR)\HashXMLCh.obj" \
"$(INTDIR)\HexBin.obj" \
"$(INTDIR)\KVStringPair.obj" \
"$(INTDIR)\Mutexes.obj" \
@@ -2910,18 +2894,6 @@
SOURCE=..\..\..\..\..\src\xercesc\util\FlagJanitor.c
-SOURCE=..\..\..\..\..\src\xercesc\util\HashPtr.cpp
-
-"$(INTDIR)\HashPtr.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
-SOURCE=..\..\..\..\..\src\xercesc\util\HashXMLCh.cpp
-
-"$(INTDIR)\HashXMLCh.obj" : $(SOURCE) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
-
-
SOURCE=..\..\..\..\..\src\xercesc\util\HexBin.cpp
"$(INTDIR)\HexBin.obj" : $(SOURCE) "$(INTDIR)"
Modified: xerces/c/trunk/projects/Win32/VC7.1/xerces-all/MemHandlerTest/MemHandlerTest.vcproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC7.1/xerces-all/MemHandlerTest/MemHandlerTest.vcproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC7.1/xerces-all/MemHandlerTest/MemHandlerTest.vcproj (original)
+++ xerces/c/trunk/projects/Win32/VC7.1/xerces-all/MemHandlerTest/MemHandlerTest.vcproj Thu Jul 24 03:28:29 2008
@@ -380,9 +380,6 @@
<File
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\MemoryMonitor.cpp">
</File>
- <File
- RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.cpp">
- </File>
</Filter>
<Filter
Name="Header Files"
@@ -391,9 +388,6 @@
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\MemoryMonitor.hpp">
</File>
<File
- RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.hpp">
- </File>
- <File
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleValueHashTableOf.hpp">
</File>
</Filter>
Modified: xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj (original)
+++ xerces/c/trunk/projects/Win32/VC7.1/xerces-all/XercesLib/XercesLib.vcproj Thu Jul 24 03:28:29 2008
@@ -463,22 +463,7 @@
RelativePath="..\..\..\..\..\src\xercesc\util\FlagJanitor.hpp">
</File>
<File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashBase.hpp">
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashCMStateSet.hpp">
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashPtr.cpp">
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashPtr.hpp">
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashXMLCh.cpp">
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashXMLCh.hpp">
+ RelativePath="..\..\..\..\..\src\xercesc\util\Hashers.hpp">
</File>
<File
RelativePath="..\..\..\..\..\src\xercesc\util\HeaderDummy.cpp">
Modified: xerces/c/trunk/projects/Win32/VC8/xerces-all/MemHandlerTest/MemHandlerTest.vcproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC8/xerces-all/MemHandlerTest/MemHandlerTest.vcproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC8/xerces-all/MemHandlerTest/MemHandlerTest.vcproj (original)
+++ xerces/c/trunk/projects/Win32/VC8/xerces-all/MemHandlerTest/MemHandlerTest.vcproj Thu Jul 24 03:28:29 2008
@@ -1084,10 +1084,6 @@
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\MemoryMonitor.cpp"
>
</File>
- <File
- RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.cpp"
- >
- </File>
</Filter>
<Filter
Name="Header Files"
@@ -1098,10 +1094,6 @@
>
</File>
<File
- RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.hpp"
- >
- </File>
- <File
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleValueHashTableOf.hpp"
>
</File>
Modified: xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj (original)
+++ xerces/c/trunk/projects/Win32/VC8/xerces-all/XercesLib/XercesLib.vcproj Thu Jul 24 03:28:29 2008
@@ -1182,27 +1182,7 @@
>
</File>
<File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashBase.hpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashCMStateSet.hpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashPtr.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashPtr.hpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashXMLCh.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashXMLCh.hpp"
+ RelativePath="..\..\..\..\..\src\xercesc\util\Hashers.hpp"
>
</File>
<File
Modified: xerces/c/trunk/projects/Win32/VC9/xerces-all/MemHandlerTest/MemHandlerTest.vcproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC9/xerces-all/MemHandlerTest/MemHandlerTest.vcproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC9/xerces-all/MemHandlerTest/MemHandlerTest.vcproj (original)
+++ xerces/c/trunk/projects/Win32/VC9/xerces-all/MemHandlerTest/MemHandlerTest.vcproj Thu Jul 24 03:28:29 2008
@@ -1083,10 +1083,6 @@
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\MemoryMonitor.cpp"
>
</File>
- <File
- RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.cpp"
- >
- </File>
</Filter>
<Filter
Name="Header Files"
@@ -1097,10 +1093,6 @@
>
</File>
<File
- RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleHashPtr.hpp"
- >
- </File>
- <File
RelativePath="..\..\..\..\..\tests\src\MemHandlerTest\SimpleValueHashTableOf.hpp"
>
</File>
Modified: xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj
URL: http://svn.apache.org/viewvc/xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj (original)
+++ xerces/c/trunk/projects/Win32/VC9/xerces-all/XercesLib/XercesLib.vcproj Thu Jul 24 03:28:29 2008
@@ -1181,27 +1181,7 @@
>
</File>
<File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashBase.hpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashCMStateSet.hpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashPtr.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashPtr.hpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashXMLCh.cpp"
- >
- </File>
- <File
- RelativePath="..\..\..\..\..\src\xercesc\util\HashXMLCh.hpp"
+ RelativePath="..\..\..\..\..\src\xercesc\util\Hashers.hpp"
>
</File>
<File
Modified: xerces/c/trunk/src/Makefile.am
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/Makefile.am?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/Makefile.am (original)
+++ xerces/c/trunk/src/Makefile.am Thu Jul 24 03:28:29 2008
@@ -577,10 +577,7 @@
xercesc/util/EncodingValidator.hpp \
xercesc/util/FlagJanitor.hpp \
xercesc/util/FlagJanitor.c \
- xercesc/util/HashBase.hpp \
- xercesc/util/HashCMStateSet.hpp \
- xercesc/util/HashPtr.hpp \
- xercesc/util/HashXMLCh.hpp \
+ xercesc/util/Hashers.hpp \
xercesc/util/HexBin.hpp \
xercesc/util/IllegalArgumentException.hpp \
xercesc/util/InvalidCastException.hpp \
@@ -715,8 +712,6 @@
xercesc/util/BitSet.cpp \
xercesc/util/DefaultPanicHandler.cpp \
xercesc/util/EncodingValidator.cpp \
- xercesc/util/HashPtr.cpp \
- xercesc/util/HashXMLCh.cpp \
xercesc/util/HeaderDummy.cpp \
xercesc/util/HexBin.cpp \
xercesc/util/KVStringPair.cpp \
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.c Thu Jul 24 03:28:29 2008
@@ -37,14 +37,13 @@
// ---------------------------------------------------------------------------
// DOMDeepNodeListPool: Constructors and Destructor
// ---------------------------------------------------------------------------
-template <class TVal>
-DOMDeepNodeListPool<TVal>::DOMDeepNodeListPool( const XMLSize_t modulus
+template <class TVal, class THasher>
+DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus
, const bool adoptElems
, const XMLSize_t initSize) :
- fAdoptedElems(adoptElems)
+ fAdoptedElems(adoptElems)
, fBucketList(0)
, fHashModulus(modulus)
- , fHash(0)
, fIdPtrs(0)
, fIdPtrsCount(initSize)
, fIdCounter(0)
@@ -52,12 +51,6 @@
{
initialize(modulus);
- // create default hasher
-#if defined (XML_GCC_VERSION) && (XML_GCC_VERSION < 29600)
- fHash = new HashPtr();
-#else
- fHash = new (fMemoryManager) HashPtr();
-#endif
//
// 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
@@ -70,23 +63,21 @@
fIdPtrs[0] = 0;
}
-template <class TVal>
-DOMDeepNodeListPool<TVal>::DOMDeepNodeListPool( const XMLSize_t modulus
+template <class TVal, class THasher>
+DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus
, const bool adoptElems
- , HashBase* hashBase
+ , const THasher& hasher
, const XMLSize_t initSize) :
- fAdoptedElems(adoptElems)
+ fAdoptedElems(adoptElems)
, fBucketList(0)
, fHashModulus(modulus)
- , fHash(0)
+ , fHasher(hasher)
, fIdPtrs(0)
, fIdPtrsCount(initSize)
, fIdCounter(0)
, fMemoryManager(XMLPlatformUtils::fgMemoryManager)
{
initialize(modulus);
- // set hasher
- fHash = hashBase;
//
// Allocate the initial id pointers array. We don't have to zero them
@@ -100,13 +91,12 @@
fIdPtrs[0] = 0;
}
-template <class TVal>
-DOMDeepNodeListPool<TVal>::DOMDeepNodeListPool( const XMLSize_t modulus
+template <class TVal, class THasher>
+DOMDeepNodeListPool<TVal, THasher>::DOMDeepNodeListPool( const XMLSize_t modulus
, const XMLSize_t initSize) :
- fAdoptedElems(true)
+ fAdoptedElems(true)
, fBucketList(0)
, fHashModulus(modulus)
- , fHash(0)
, fIdPtrs(0)
, fIdPtrsCount(initSize)
, fIdCounter(0)
@@ -114,13 +104,6 @@
{
initialize(modulus);
- // create default hasher
-#if defined (XML_GCC_VERSION) && (XML_GCC_VERSION < 29600)
- fHash = new HashPtr();
-#else
- fHash = new (fMemoryManager) HashPtr();
-#endif
-
//
// 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
@@ -133,8 +116,8 @@
fIdPtrs[0] = 0;
}
-template <class TVal>
-void DOMDeepNodeListPool<TVal>::initialize(const XMLSize_t modulus)
+template <class TVal, class THasher>
+void DOMDeepNodeListPool<TVal, THasher>::initialize(const XMLSize_t modulus)
{
if (modulus == 0)
ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
@@ -149,22 +132,22 @@
fBucketList[index] = 0;
}
-template <class TVal> DOMDeepNodeListPool<TVal>::~DOMDeepNodeListPool()
+template <class TVal, class THasher>
+DOMDeepNodeListPool<TVal, THasher>::~DOMDeepNodeListPool()
{
removeAll();
// Then delete the bucket list & hasher & id pointers list
fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs;
fMemoryManager->deallocate(fBucketList);//delete [] fBucketList;
- delete fHash;
}
// ---------------------------------------------------------------------------
// DOMDeepNodeListPool: Element management
// ---------------------------------------------------------------------------
-template <class TVal>
-bool DOMDeepNodeListPool<TVal>::isEmpty() const
+template <class TVal, class THasher>
+bool DOMDeepNodeListPool<TVal, THasher>::isEmpty() const
{
// Just check the bucket list for non-empty elements
for (XMLSize_t buckInd = 0; buckInd < fHashModulus; buckInd++)
@@ -175,8 +158,8 @@
return true;
}
-template <class TVal>
-bool DOMDeepNodeListPool<TVal>::containsKey( const void* const key1
+template <class TVal, class THasher>
+bool DOMDeepNodeListPool<TVal, THasher>::containsKey( const void* const key1
, const XMLCh* const key2
, const XMLCh* const key3) const
{
@@ -185,8 +168,8 @@
return (findIt != 0);
}
-template <class TVal>
-void DOMDeepNodeListPool<TVal>::removeAll()
+template <class TVal, class THasher>
+void DOMDeepNodeListPool<TVal, THasher>::removeAll()
{
if (fIdCounter == 0) return;
@@ -224,14 +207,14 @@
fIdCounter = 0;
}
-template <class TVal> void DOMDeepNodeListPool<TVal>::cleanup()
+template <class TVal, class THasher>
+void DOMDeepNodeListPool<TVal, THasher>::cleanup()
{
removeAll();
// Then delete the bucket list & hasher & id pointers list
fMemoryManager->deallocate(fIdPtrs);//delete [] fIdPtrs;
fMemoryManager->deallocate(fBucketList);//delete [] fBucketList;
- delete fHash;
}
@@ -239,8 +222,9 @@
// ---------------------------------------------------------------------------
// DOMDeepNodeListPool: Getters
// ---------------------------------------------------------------------------
-template <class TVal> TVal*
-DOMDeepNodeListPool<TVal>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3)
+template <class TVal, class THasher>
+TVal*
+DOMDeepNodeListPool<TVal, THasher>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3)
{
XMLSize_t hashVal;
DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
@@ -249,8 +233,9 @@
return findIt->fData;
}
-template <class TVal> const TVal*
-DOMDeepNodeListPool<TVal>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const
+template <class TVal, class THasher>
+const TVal*
+DOMDeepNodeListPool<TVal, THasher>::getByKey(const void* const key1, const XMLCh* const key2, const XMLCh* const key3) const
{
XMLSize_t hashVal;
const DOMDeepNodeListPoolTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, key3, hashVal);
@@ -259,8 +244,9 @@
return findIt->fData;
}
-template <class TVal> TVal*
-DOMDeepNodeListPool<TVal>::getById(const unsigned int elemId)
+template <class TVal, class THasher>
+TVal*
+DOMDeepNodeListPool<TVal, THasher>::getById(const unsigned int elemId)
{
// If its either zero or beyond our current id, its an error
if (!elemId || (elemId > fIdCounter))
@@ -269,8 +255,9 @@
return fIdPtrs[elemId];
}
-template <class TVal> const TVal*
-DOMDeepNodeListPool<TVal>::getById(const unsigned int elemId) const
+template <class TVal, class THasher>
+const TVal*
+DOMDeepNodeListPool<TVal, THasher>::getById(const unsigned int elemId) const
{
// If its either zero or beyond our current id, its an error
if (!elemId || (elemId > fIdCounter))
@@ -282,8 +269,9 @@
// ---------------------------------------------------------------------------
// DOMDeepNodeListPool: Putters
// ---------------------------------------------------------------------------
-template <class TVal> unsigned int
-DOMDeepNodeListPool<TVal>::put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt)
+template <class TVal, class THasher>
+unsigned int
+DOMDeepNodeListPool<TVal, THasher>::put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt)
{
// First see if the key exists already
XMLSize_t hashVal;
@@ -366,11 +354,12 @@
// ---------------------------------------------------------------------------
// DOMDeepNodeListPool: Private methods
// ---------------------------------------------------------------------------
-template <class TVal> DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal>::
+template <class TVal, class THasher>
+DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal, THasher>::
findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal)
{
// Hash the key
- hashVal = fHash->getHashVal(key1, fHashModulus);
+ hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
// Search that bucket for the key
@@ -379,7 +368,7 @@
{
//key2 and key3 are XMLCh*, compareString takes null pointer vs zero len string the same
//but we need them to be treated as different keys in this case
- if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
+ if (fHasher.equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
if (!key2 || !curElem->fKey2) {
if (key2 || curElem->fKey2) {
curElem = curElem->fNext;
@@ -401,11 +390,12 @@
return 0;
}
-template <class TVal> const DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal>::
+template <class TVal, class THasher>
+const DOMDeepNodeListPoolTableBucketElem<TVal>* DOMDeepNodeListPool<TVal, THasher>::
findBucketElem(const void* const key1, const XMLCh* const key2, const XMLCh* const key3, XMLSize_t& hashVal) const
{
// Hash the key
- hashVal = fHash->getHashVal(key1, fHashModulus);
+ hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
// Search that bucket for the key
@@ -414,7 +404,7 @@
{
//key2 and key3 are XMLCh*, compareString takes null pointer vs zero len string the same
//but we need them to be treated as different keys in this case
- if (fHash->equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
+ if (fHasher.equals(key1, curElem->fKey1) && (XMLString::equals(key2, curElem->fKey2)) && (XMLString::equals(key3, curElem->fKey3))) {
if (!key2 || !curElem->fKey2) {
if (key2 || curElem->fKey2) {
curElem = curElem->fNext;
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDeepNodeListPool.hpp Thu Jul 24 03:28:29 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.
@@ -32,25 +32,15 @@
#define XERCESC_INCLUDE_GUARD_DOMDEEPNODELISTPOOL_HPP
-#include <xercesc/util/HashBase.hpp>
+#include <xercesc/util/Hashers.hpp>
#include <xercesc/util/IllegalArgumentException.hpp>
#include <xercesc/util/NoSuchElementException.hpp>
#include <xercesc/util/RuntimeException.hpp>
#include <xercesc/util/XMLExceptMsgs.hpp>
#include <xercesc/util/XMLEnumerator.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/HashXMLCh.hpp>
-#include <xercesc/util/HashPtr.hpp>
XERCES_CPP_NAMESPACE_BEGIN
-
-// This hash table is modified from RefHash3KeysIdPool with first key as object ptr (DOMNode),
-// second and third keys are both XMLCh* string
-
-template <class TVal> struct DOMDeepNodeListPoolTableBucketElem;
-
-
//
// This should really be a nested class, but some of the compilers we
// have to support cannot deal with that!
@@ -90,20 +80,19 @@
};
-template <class TVal> class DOMDeepNodeListPool
+template <class TVal, class THasher = PtrHasher>
+class DOMDeepNodeListPool
{
public:
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
- // backwards compatability - default hasher is HashXMLCh
DOMDeepNodeListPool
(
const XMLSize_t modulus
, const XMLSize_t initSize = 128
);
- // backwards compatability - default hasher is HashXMLCh
DOMDeepNodeListPool
(
const XMLSize_t modulus
@@ -111,14 +100,11 @@
, const XMLSize_t initSize = 128
);
- // 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.
DOMDeepNodeListPool
(
const XMLSize_t modulus
, const bool adoptElems
- , HashBase* hashBase
+ , const THasher& hasher
, const XMLSize_t initSize = 128
);
@@ -145,7 +131,7 @@
// -----------------------------------------------------------------------
// Putters
// -----------------------------------------------------------------------
- unsigned int put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt);
+ unsigned int put(void* key1, XMLCh* key2, XMLCh* key3, TVal* const valueToAdopt);
private:
@@ -159,8 +145,8 @@
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
- DOMDeepNodeListPool(const DOMDeepNodeListPool<TVal> &);
- DOMDeepNodeListPool<TVal> & operator = (const DOMDeepNodeListPool<TVal> &);
+ DOMDeepNodeListPool(const DOMDeepNodeListPool<TVal, THasher> &);
+ DOMDeepNodeListPool<TVal, THasher> & operator = (const DOMDeepNodeListPool<TVal, THasher> &);
// -----------------------------------------------------------------------
// Data members
@@ -198,7 +184,7 @@
bool fAdoptedElems;
DOMDeepNodeListPoolTableBucketElem<TVal>** fBucketList;
XMLSize_t fHashModulus;
- HashBase* fHash;
+ THasher fHasher;
TVal** fIdPtrs;
XMLSize_t fIdPtrsCount;
unsigned int fIdCounter;
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.cpp Thu Jul 24 03:28:29 2008
@@ -1266,11 +1266,10 @@
if (!fUserDataTable) {
// create the table on heap so that it can be cleaned in destructor
- fUserDataTable = new (fMemoryManager) RefHash2KeysTableOf<DOMUserDataRecord>
+ fUserDataTable = new (fMemoryManager) RefHash2KeysTableOf<DOMUserDataRecord, PtrHasher>
(
109
, true
- , new (fMemoryManager) HashPtr()
, fMemoryManager
);
}
@@ -1290,7 +1289,7 @@
fUserDataTable->put((void*)n, keyId, new (fMemoryManager) DOMUserDataRecord(data, handler));
}
else {
- RefHash2KeysTableOfEnumerator<DOMUserDataRecord> enumKeys(fUserDataTable, false, fMemoryManager);
+ RefHash2KeysTableOfEnumerator<DOMUserDataRecord, PtrHasher> enumKeys(fUserDataTable, false, fMemoryManager);
enumKeys.setPrimaryKey(n);
if (!enumKeys.hasMoreElements())
n->hasUserData(false);
@@ -1316,7 +1315,7 @@
void DOMDocumentImpl::callUserDataHandlers(const DOMNodeImpl* n, DOMUserDataHandler::DOMOperationType operation, const DOMNode* src, DOMNode* dst) const
{
if (fUserDataTable) {
- RefHash2KeysTableOfEnumerator<DOMUserDataRecord> userDataEnum(fUserDataTable, false, fMemoryManager);
+ RefHash2KeysTableOfEnumerator<DOMUserDataRecord, PtrHasher> userDataEnum(fUserDataTable, false, fMemoryManager);
userDataEnum.setPrimaryKey(n);
// Create a snapshot of the handlers to be called, as the "handle" callback could be invalidating the enumerator by calling
// setUserData on the dst node
Modified: xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.hpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/impl/DOMDocumentImpl.hpp Thu Jul 24 03:28:29 2008
@@ -300,7 +300,7 @@
DOMConfiguration* fDOMConfiguration;
XMLStringPool fUserDataTableKeys;
- RefHash2KeysTableOf<DOMUserDataRecord>* fUserDataTable;
+ RefHash2KeysTableOf<DOMUserDataRecord, PtrHasher>* fUserDataTable;
// Per-Document heap Variables.
Modified: xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp Thu Jul 24 03:28:29 2008
@@ -42,7 +42,6 @@
#include <xercesc/validators/DTD/DTDValidator.hpp>
#include <xercesc/util/OutOfMemoryException.hpp>
#include <xercesc/util/XMLResourceIdentifier.hpp>
-#include <xercesc/util/HashPtr.hpp>
XERCES_CPP_NAMESPACE_BEGIN
Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Thu Jul 24 03:28:29 2008
@@ -25,7 +25,6 @@
// ---------------------------------------------------------------------------
#include <xercesc/internal/IGXMLScanner.hpp>
#include <xercesc/util/RuntimeException.hpp>
-#include <xercesc/util/HashPtr.hpp>
#include <xercesc/util/UnexpectedEOFException.hpp>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/framework/XMLDocumentHandler.hpp>
Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Thu Jul 24 03:28:29 2008
@@ -49,7 +49,6 @@
#include <xercesc/validators/schema/identity/IC_Selector.hpp>
#include <xercesc/validators/schema/identity/ValueStore.hpp>
#include <xercesc/util/OutOfMemoryException.hpp>
-#include <xercesc/util/HashPtr.hpp>
#include <xercesc/util/XMLStringTokenizer.hpp>
XERCES_CPP_NAMESPACE_BEGIN
Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp Thu Jul 24 03:28:29 2008
@@ -1367,7 +1367,7 @@
{
fAttrDupChkRegistry = new (fMemoryManager) RefHash2KeysTableOf<XMLAttr>
(
- 2*attrNumber+1, false, new (fMemoryManager)HashXMLCh(), fMemoryManager
+ 2*attrNumber+1, false, fMemoryManager
);
}
else
Modified: xerces/c/trunk/src/xercesc/internal/XSObjectFactory.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XSObjectFactory.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XSObjectFactory.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XSObjectFactory.cpp Thu Jul 24 03:28:29 2008
@@ -50,7 +50,6 @@
#include <xercesc/validators/schema/identity/IdentityConstraint.hpp>
#include <xercesc/validators/schema/identity/IC_KeyRef.hpp>
#include <xercesc/validators/schema/identity/XercesXPath.hpp>
-#include <xercesc/util/HashPtr.hpp>
#include <xercesc/util/XMLStringTokenizer.hpp>
XERCES_CPP_NAMESPACE_BEGIN
Modified: xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XSerializeEngine.cpp Thu Jul 24 03:28:29 2008
@@ -27,8 +27,6 @@
#include <xercesc/internal/XSerializable.hpp>
#include <xercesc/internal/XProtoType.hpp>
-#include <xercesc/util/HashPtr.hpp>
-
#include <xercesc/framework/XMLGrammarPool.hpp>
#include <xercesc/framework/BinOutputStream.hpp>
#include <xercesc/util/BinInputStream.hpp>
Modified: xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XTemplateSerializer.cpp Thu Jul 24 03:28:29 2008
@@ -23,7 +23,6 @@
#include <xercesc/internal/XTemplateSerializer.hpp>
#include <xercesc/framework/XMLGrammarPool.hpp>
#include <xercesc/validators/common/Grammar.hpp>
-#include <xercesc/util/HashPtr.hpp>
#include <stdio.h>
#include <stdlib.h>
Added: xerces/c/trunk/src/xercesc/util/Hashers.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/Hashers.hpp?rev=679340&view=auto
==============================================================================
--- xerces/c/trunk/src/xercesc/util/Hashers.hpp (added)
+++ xerces/c/trunk/src/xercesc/util/Hashers.hpp Thu Jul 24 03:28:29 2008
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * $Id: HashBase.hpp 678144 2008-07-19 12:08:55Z borisk $
+ */
+
+#if !defined(XERCESC_INCLUDE_GUARD_HASHERS_HPP)
+#define XERCESC_INCLUDE_GUARD_HASHERS_HPP
+
+#include <xercesc/util/XMLString.hpp>
+
+XERCES_CPP_NAMESPACE_BEGIN
+
+//
+// Common hashers. Only widely-used hashers should be placed here.
+//
+
+/**
+ * Hasher for keys that are const XMLCh*.
+ */
+struct StringHasher
+{
+ /**
+ * Returns a hash value based on the key
+ *
+ * @param key the key to be hashed
+ * @param mod the modulus the hasher should use
+ */
+ XMLSize_t getHashVal(const void* key, XMLSize_t mod) const
+ {
+ return XMLString::hash ((const XMLCh*)key, mod);
+ }
+
+ /**
+ * Compares two keys and determines if they are semantically equal
+ *
+ * @param key1 the first key to be compared
+ * @param key2 the second key to be compared
+ *
+ * @return true if they are equal
+ */
+ bool equals(const void *const key1, const void *const key2) const
+ {
+ return XMLString::equals ((const XMLCh*)key1, (const XMLCh*)key2);
+ }
+};
+
+/**
+ * Hasher for keys that are pointers.
+ */
+struct PtrHasher
+{
+ /**
+ * Returns a hash value based on the key
+ *
+ * @param key the key to be hashed
+ * @param mod the modulus the hasher should use
+ */
+ XMLSize_t getHashVal(const void* key, XMLSize_t mod) const
+ {
+ return ((XMLSize_t)key) % mod;
+ }
+
+ /**
+ * Compares two keys and determines if they are semantically equal
+ *
+ * @param key1 the first key to be compared
+ * @param key2 the second key to be compared
+ *
+ * @return true if they are equal
+ */
+ bool equals(const void *const key1, const void *const key2) const
+ {
+ return key1 == key2;
+ }
+};
+
+XERCES_CPP_NAMESPACE_END
+
+#endif
Propchange: xerces/c/trunk/src/xercesc/util/Hashers.hpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xerces/c/trunk/src/xercesc/util/Hashers.hpp
------------------------------------------------------------------------------
svn:keywords =
Modified: xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.c
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.c?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.c (original)
+++ xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.c Thu Jul 24 03:28:29 2008
@@ -37,52 +37,72 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Constructors and Destructor
// ---------------------------------------------------------------------------
-template <class TVal>
-RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf( const XMLSize_t modulus
- , const bool adoptElems
- , MemoryManager* const manager)
+
+template <class TVal, class THasher>
+RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ MemoryManager* const manager)
+
: fMemoryManager(manager)
- , fAdoptedElems(adoptElems)
+ , fAdoptedElems(true)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
- , fHash(0)
{
initialize(modulus);
}
-template <class TVal>
-RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf( const XMLSize_t modulus
- , const bool adoptElems
- , HashBase* hashBase
- , MemoryManager* const manager)
+template <class TVal, class THasher>
+RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ const THasher& hasher,
+ MemoryManager* const manager)
+
+ : fMemoryManager(manager)
+ , fAdoptedElems(true)
+ , fBucketList(0)
+ , fHashModulus(modulus)
+ , fCount(0)
+ , fHasher (hasher)
+{
+ initialize(modulus);
+}
+
+template <class TVal, class THasher>
+RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ const bool adoptElems,
+ MemoryManager* const manager)
+
: fMemoryManager(manager)
, fAdoptedElems(adoptElems)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
- , fHash(0)
+
{
initialize(modulus);
- // set hasher
- fHash = hashBase;
}
-template <class TVal>
-RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf(const XMLSize_t modulus,
- MemoryManager* const manager)
+template <class TVal, class THasher>
+RefHash2KeysTableOf<TVal, THasher>::RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ const bool adoptElems,
+ const THasher& hasher,
+ MemoryManager* const manager)
+
: fMemoryManager(manager)
- , fAdoptedElems(true)
+ , fAdoptedElems(adoptElems)
, fBucketList(0)
, fHashModulus(modulus)
, fCount(0)
- , fHash(0)
+ , fHasher (hasher)
{
initialize(modulus);
}
-template <class TVal>
-void RefHash2KeysTableOf<TVal>::initialize(const XMLSize_t modulus)
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::initialize(const XMLSize_t modulus)
{
if (modulus == 0)
ThrowXMLwithMemMgr(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus, fMemoryManager);
@@ -95,27 +115,28 @@
memset(fBucketList, 0, sizeof(fBucketList[0]) * fHashModulus);
}
-template <class TVal> RefHash2KeysTableOf<TVal>::~RefHash2KeysTableOf()
+template <class TVal, class THasher>
+RefHash2KeysTableOf<TVal, THasher>::~RefHash2KeysTableOf()
{
removeAll();
// Then delete the bucket list & hasher
fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
fBucketList = 0;
- delete fHash;
- fHash = 0;
}
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Element management
// ---------------------------------------------------------------------------
-template <class TVal> bool RefHash2KeysTableOf<TVal>::isEmpty() const
+template <class TVal, class THasher>
+bool RefHash2KeysTableOf<TVal, THasher>::isEmpty() const
{
return (fCount==0);
}
-template <class TVal> bool RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+bool RefHash2KeysTableOf<TVal, THasher>::
containsKey(const void* const key1, const int key2) const
{
XMLSize_t hashVal;
@@ -123,11 +144,12 @@
return (findIt != 0);
}
-template <class TVal> void RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::
removeKey(const void* const key1, const int key2)
{
// Hash the key
- XMLSize_t hashVal = fHash==0?XMLString::hash((const XMLCh*)key1, fHashModulus) : fHash->getHashVal(key1, fHashModulus);
+ XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
//
@@ -139,7 +161,7 @@
while (curElem)
{
- if((key2==curElem->fKey2) && (fHash==0?XMLString::equals((const XMLCh*)key1, (const XMLCh*)curElem->fKey1) : fHash->equals(key1, curElem->fKey1)))
+ if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1)))
{
if (!lastElem)
{
@@ -174,11 +196,12 @@
ThrowXMLwithMemMgr(NoSuchElementException, XMLExcepts::HshTbl_NoSuchKeyExists, fMemoryManager);
}
-template <class TVal> void RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::
removeKey(const void* const key1)
{
// Hash the key
- XMLSize_t hashVal = fHash==0?XMLString::hash((const XMLCh*)key1, fHashModulus) : fHash->getHashVal(key1, fHashModulus);
+ XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
//
@@ -190,7 +213,7 @@
while (curElem)
{
- if(fHash==0?XMLString::equals((const XMLCh*)key1, (const XMLCh*)curElem->fKey1) : fHash->equals(key1, curElem->fKey1))
+ if(fHasher.equals(key1, curElem->fKey1))
{
if (!lastElem)
{
@@ -226,7 +249,8 @@
}
}
-template <class TVal> void RefHash2KeysTableOf<TVal>::removeAll()
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::removeAll()
{
if(isEmpty())
return;
@@ -263,10 +287,11 @@
}
// this function transfer the data from key1 to key2
-template <class TVal> void RefHash2KeysTableOf<TVal>::transferElement(const void* const key1, void* key2)
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::transferElement(const void* const key1, void* key2)
{
// Hash the key
- XMLSize_t hashVal = fHash==0?XMLString::hash((const XMLCh*)key1, fHashModulus) : fHash->getHashVal(key1, fHashModulus);
+ XMLSize_t hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
//
@@ -279,7 +304,7 @@
while (curElem)
{
// if this element has the same primary key, remove it and add it using the new primary key
- if(fHash==0?XMLString::equals((const XMLCh*)key1, (const XMLCh*)curElem->fKey1) : fHash->equals(key1, curElem->fKey1))
+ if(fHasher.equals(key1, curElem->fKey1))
{
if (!lastElem)
{
@@ -336,7 +361,8 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Getters
// ---------------------------------------------------------------------------
-template <class TVal> TVal* RefHash2KeysTableOf<TVal>::get(const void* const key1, const int key2)
+template <class TVal, class THasher>
+TVal* RefHash2KeysTableOf<TVal, THasher>::get(const void* const key1, const int key2)
{
XMLSize_t hashVal;
RefHash2KeysTableBucketElem<TVal>* findIt = findBucketElem(key1, key2, hashVal);
@@ -345,7 +371,8 @@
return findIt->fData;
}
-template <class TVal> const TVal* RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+const TVal* RefHash2KeysTableOf<TVal, THasher>::
get(const void* const key1, const int key2) const
{
XMLSize_t hashVal;
@@ -355,14 +382,14 @@
return findIt->fData;
}
-template <class TVal>
-MemoryManager* RefHash2KeysTableOf<TVal>::getMemoryManager() const
+template <class TVal, class THasher>
+MemoryManager* RefHash2KeysTableOf<TVal, THasher>::getMemoryManager() const
{
return fMemoryManager;
}
-template <class TVal>
-XMLSize_t RefHash2KeysTableOf<TVal>::getHashModulus() const
+template <class TVal, class THasher>
+XMLSize_t RefHash2KeysTableOf<TVal, THasher>::getHashModulus() const
{
return fHashModulus;
}
@@ -370,7 +397,8 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Putters
// ---------------------------------------------------------------------------
-template <class TVal> void RefHash2KeysTableOf<TVal>::put(void* key1, int key2, TVal* const valueToAdopt)
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::put(void* key1, int key2, TVal* const valueToAdopt)
{
// Apply 4 load factor to find threshold.
XMLSize_t threshold = fHashModulus * 4;
@@ -410,18 +438,19 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOf: Private methods
// ---------------------------------------------------------------------------
-template <class TVal> RefHash2KeysTableBucketElem<TVal>* RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+inline RefHash2KeysTableBucketElem<TVal>* RefHash2KeysTableOf<TVal, THasher>::
findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal)
{
// Hash the key
- hashVal = fHash==0?XMLString::hash((const XMLCh*)key1, fHashModulus) : fHash->getHashVal(key1, fHashModulus);
+ hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
// Search that bucket for the key
RefHash2KeysTableBucketElem<TVal>* curElem = fBucketList[hashVal];
while (curElem)
{
- if((key2==curElem->fKey2) && (fHash==0?XMLString::equals((const XMLCh*)key1, (const XMLCh*)curElem->fKey1) : fHash->equals(key1, curElem->fKey1)))
+ if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1)))
return curElem;
curElem = curElem->fNext;
@@ -429,18 +458,19 @@
return 0;
}
-template <class TVal> const RefHash2KeysTableBucketElem<TVal>* RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+inline const RefHash2KeysTableBucketElem<TVal>* RefHash2KeysTableOf<TVal, THasher>::
findBucketElem(const void* const key1, const int key2, XMLSize_t& hashVal) const
{
// Hash the key
- hashVal = fHash==0?XMLString::hash((const XMLCh*)key1, fHashModulus) : fHash->getHashVal(key1, fHashModulus);
+ hashVal = fHasher.getHashVal(key1, fHashModulus);
assert(hashVal < fHashModulus);
// Search that bucket for the key
const RefHash2KeysTableBucketElem<TVal>* curElem = fBucketList[hashVal];
while (curElem)
{
- if((key2==curElem->fKey2) && (fHash==0?XMLString::equals((const XMLCh*)key1, (const XMLCh*)curElem->fKey1) : fHash->equals(key1, curElem->fKey1)))
+ if((key2==curElem->fKey2) && (fHasher.equals(key1, curElem->fKey1)))
return curElem;
curElem = curElem->fNext;
@@ -449,7 +479,8 @@
}
-template <class TVal> void RefHash2KeysTableOf<TVal>::
+template <class TVal, class THasher>
+void RefHash2KeysTableOf<TVal, THasher>::
rehash()
{
const XMLSize_t newMod = (fHashModulus * 8)+1;
@@ -476,7 +507,7 @@
// Save the next element before we detach this one
RefHash2KeysTableBucketElem<TVal>* nextElem = curElem->fNext;
- const XMLSize_t hashVal = fHash==0?XMLString::hash((const XMLCh*)curElem->fKey1, newMod) : fHash->getHashVal(curElem->fKey1, newMod);
+ const XMLSize_t hashVal = fHasher.getHashVal(curElem->fKey1, newMod);
assert(hashVal < newMod);
RefHash2KeysTableBucketElem<TVal>* newHeadElem = newBucketList[hashVal];
@@ -506,8 +537,9 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOfEnumerator: Constructors and Destructor
// ---------------------------------------------------------------------------
-template <class TVal> RefHash2KeysTableOfEnumerator<TVal>::
-RefHash2KeysTableOfEnumerator(RefHash2KeysTableOf<TVal>* const toEnum
+template <class TVal, class THasher>
+RefHash2KeysTableOfEnumerator<TVal, THasher>::
+RefHash2KeysTableOfEnumerator(RefHash2KeysTableOf<TVal, THasher>* const toEnum
, const bool adopt
, MemoryManager* const manager)
: fAdopted(adopt), fCurElem(0), fCurHash((XMLSize_t)-1), fToEnum(toEnum)
@@ -527,7 +559,8 @@
findNext();
}
-template <class TVal> RefHash2KeysTableOfEnumerator<TVal>::~RefHash2KeysTableOfEnumerator()
+template <class TVal, class THasher>
+RefHash2KeysTableOfEnumerator<TVal, THasher>::~RefHash2KeysTableOfEnumerator()
{
if (fAdopted)
delete fToEnum;
@@ -537,7 +570,8 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOfEnumerator: Enum interface
// ---------------------------------------------------------------------------
-template <class TVal> bool RefHash2KeysTableOfEnumerator<TVal>::hasMoreElements() const
+template <class TVal, class THasher>
+bool RefHash2KeysTableOfEnumerator<TVal, THasher>::hasMoreElements() const
{
//
// If our current has is at the max and there are no more elements
@@ -548,7 +582,8 @@
return true;
}
-template <class TVal> TVal& RefHash2KeysTableOfEnumerator<TVal>::nextElement()
+template <class TVal, class THasher>
+TVal& RefHash2KeysTableOfEnumerator<TVal, THasher>::nextElement()
{
// Make sure we have an element to return
if (!hasMoreElements())
@@ -564,7 +599,8 @@
return *saveElem->fData;
}
-template <class TVal> void RefHash2KeysTableOfEnumerator<TVal>::nextElementKey(void*& retKey1, int& retKey2)
+template <class TVal, class THasher>
+void RefHash2KeysTableOfEnumerator<TVal, THasher>::nextElementKey(void*& retKey1, int& retKey2)
{
// Make sure we have an element to return
if (!hasMoreElements())
@@ -583,10 +619,11 @@
return;
}
-template <class TVal> void RefHash2KeysTableOfEnumerator<TVal>::Reset()
+template <class TVal, class THasher>
+void RefHash2KeysTableOfEnumerator<TVal, THasher>::Reset()
{
if(fLockPrimaryKey)
- fCurHash=fToEnum->fHash==0?XMLString::hash((const XMLCh*)fLockPrimaryKey, fToEnum->fHashModulus) : fToEnum->fHash->getHashVal(fLockPrimaryKey, fToEnum->fHashModulus);
+ fCurHash=fToEnum->fHasher.getHashVal(fLockPrimaryKey, fToEnum->fHashModulus);
else
fCurHash = (XMLSize_t)-1;
@@ -595,7 +632,8 @@
}
-template <class TVal> void RefHash2KeysTableOfEnumerator<TVal>::setPrimaryKey(const void* key)
+template <class TVal, class THasher>
+void RefHash2KeysTableOfEnumerator<TVal, THasher>::setPrimaryKey(const void* key)
{
fLockPrimaryKey=key;
Reset();
@@ -604,7 +642,8 @@
// ---------------------------------------------------------------------------
// RefHash2KeysTableOfEnumerator: Private helper methods
// ---------------------------------------------------------------------------
-template <class TVal> void RefHash2KeysTableOfEnumerator<TVal>::findNext()
+template <class TVal, class THasher>
+void RefHash2KeysTableOfEnumerator<TVal, THasher>::findNext()
{
// Code to execute if we have to return only values with the primary key
if(fLockPrimaryKey)
@@ -613,8 +652,7 @@
fCurElem = fToEnum->fBucketList[fCurHash];
else
fCurElem = fCurElem->fNext;
- while (fCurElem &&
- (fToEnum->fHash==0?!XMLString::equals((const XMLCh*)fLockPrimaryKey, (const XMLCh*)fCurElem->fKey1) : !fToEnum->fHash->equals(fLockPrimaryKey, fCurElem->fKey1)))
+ while (fCurElem && (!fToEnum->fHasher.equals(fLockPrimaryKey, fCurElem->fKey1)))
fCurElem = fCurElem->fNext;
// if we didn't found it, make so hasMoreElements() returns false
if(!fCurElem)
Modified: xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp?rev=679340&r1=679339&r2=679340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/RefHash2KeysTableOf.hpp Thu Jul 24 03:28:29 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.
@@ -23,31 +23,27 @@
#define XERCESC_INCLUDE_GUARD_REFHASH2KEYSTABLEOF_HPP
-#include <xercesc/util/HashBase.hpp>
+#include <xercesc/util/Hashers.hpp>
#include <xercesc/util/IllegalArgumentException.hpp>
#include <xercesc/util/NoSuchElementException.hpp>
#include <xercesc/util/RuntimeException.hpp>
-#include <xercesc/util/XMLString.hpp>
-#include <xercesc/util/HashXMLCh.hpp>
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// This hash table is similar to RefHashTableOf with an additional integer as key2
+// Forward declare the enumerator so it can be our friend.
//
-// Forward declare the enumerator so he can be our friend. Can you say
-// friend? Sure...
-//
-template <class TVal> class RefHash2KeysTableOfEnumerator;
-template <class TVal> struct RefHash2KeysTableBucketElem;
-
+template <class TVal, class THasher = StringHasher>
+class RefHash2KeysTableOfEnumerator;
//
// This should really be a nested class, but some of the compilers we
// have to support cannot deal with that!
//
-template <class TVal> struct RefHash2KeysTableBucketElem
+template <class TVal>
+struct RefHash2KeysTableBucketElem
{
RefHash2KeysTableBucketElem(void* key1, int key2, TVal* const value, RefHash2KeysTableBucketElem<TVal>* next)
: fData(value), fNext(next), fKey1(key1), fKey2(key2)
@@ -55,10 +51,10 @@
}
~RefHash2KeysTableBucketElem() {};
- TVal* fData;
+ TVal* fData;
RefHash2KeysTableBucketElem<TVal>* fNext;
- void* fKey1;
- int fKey2;
+ void* fKey1;
+ int fKey2;
private:
// -----------------------------------------------------------------------
@@ -69,35 +65,34 @@
};
-template <class TVal> class RefHash2KeysTableOf : public XMemory
+template <class TVal, class THasher = StringHasher>
+class RefHash2KeysTableOf : public XMemory
{
public:
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
- // backwards compatability - default hasher is HashXMLCh
- RefHash2KeysTableOf
- (
- const XMLSize_t modulus
- , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
- );
- // backwards compatability - default hasher is HashXMLCh
- RefHash2KeysTableOf
- (
- 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.
- RefHash2KeysTableOf
- (
- const XMLSize_t modulus
- , const bool adoptElems
- , HashBase* hashBase
- , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
- );
+
+ RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+ RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ const THasher& hasher,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+ RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ const bool adoptElems,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
+ RefHash2KeysTableOf(
+ const XMLSize_t modulus,
+ const bool adoptElems,
+ const THasher& hasher,
+ MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+
~RefHash2KeysTableOf();
@@ -129,15 +124,15 @@
// -----------------------------------------------------------------------
// Declare our friends
// -----------------------------------------------------------------------
- friend class RefHash2KeysTableOfEnumerator<TVal>;
+ friend class RefHash2KeysTableOfEnumerator<TVal, THasher>;
+
-
private:
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
- RefHash2KeysTableOf(const RefHash2KeysTableOf<TVal>&);
- RefHash2KeysTableOf<TVal>& operator=(const RefHash2KeysTableOf<TVal>&);
+ RefHash2KeysTableOf(const RefHash2KeysTableOf<TVal, THasher>&);
+ RefHash2KeysTableOf<TVal>& operator=(const RefHash2KeysTableOf<TVal, THasher>&);
// -----------------------------------------------------------------------
// Private methods
@@ -175,7 +170,7 @@
RefHash2KeysTableBucketElem<TVal>** fBucketList;
XMLSize_t fHashModulus;
XMLSize_t fCount;
- HashBase* fHash;
+ THasher fHasher;
};
@@ -184,15 +179,16 @@
// 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 RefHash2KeysTableOfEnumerator : public XMLEnumerator<TVal>, public XMemory
+template <class TVal, class THasher>
+class RefHash2KeysTableOfEnumerator : public XMLEnumerator<TVal>, public XMemory
{
public :
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
- RefHash2KeysTableOfEnumerator(RefHash2KeysTableOf<TVal>* const toEnum
- , const bool adopt = false
- , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
+ RefHash2KeysTableOfEnumerator(RefHash2KeysTableOf<TVal, THasher>* const toEnum
+ , const bool adopt = false
+ , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
virtual ~RefHash2KeysTableOfEnumerator();
@@ -204,7 +200,7 @@
void Reset();
// -----------------------------------------------------------------------
- // New interface
+ // New interface
// -----------------------------------------------------------------------
void nextElementKey(void*&, int&);
void setPrimaryKey(const void* key);
@@ -213,8 +209,8 @@
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
- RefHash2KeysTableOfEnumerator(const RefHash2KeysTableOfEnumerator<TVal>&);
- RefHash2KeysTableOfEnumerator<TVal>& operator=(const RefHash2KeysTableOfEnumerator<TVal>&);
+ RefHash2KeysTableOfEnumerator(const RefHash2KeysTableOfEnumerator<TVal, THasher>&);
+ RefHash2KeysTableOfEnumerator<TVal, THasher>& operator=(const RefHash2KeysTableOfEnumerator<TVal, THasher>&);
// -----------------------------------------------------------------------
// Private methods
@@ -248,7 +244,7 @@
bool fAdopted;
RefHash2KeysTableBucketElem<TVal>* fCurElem;
XMLSize_t fCurHash;
- RefHash2KeysTableOf<TVal>* fToEnum;
+ RefHash2KeysTableOf<TVal, THasher>* fToEnum;
MemoryManager* const fMemoryManager;
const void* fLockPrimaryKey;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org