You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/04/30 20:11:12 UTC
cvs commit: xml-xalan/c/src/XPath QName.cpp XPath.cpp XPathEnvSupportDefault.cpp XPathExecutionContextDefault.cpp XPathExecutionContextDefault.hpp XPathFunctionTable.hpp
dbertoni 01/04/30 11:11:12
Modified: c/src/XPath QName.cpp XPath.cpp XPathEnvSupportDefault.cpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp
XPathFunctionTable.hpp
Log:
Changes required to move STLHelper.hpp to Include. Use new cache template.
Revision Changes Path
1.15 +4 -1 xml-xalan/c/src/XPath/QName.cpp
Index: QName.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/QName.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- QName.cpp 2001/04/23 14:19:05 1.14
+++ QName.cpp 2001/04/30 18:10:58 1.15
@@ -59,8 +59,11 @@
+#include <Include/STLHelper.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <PlatformSupport/STLHelper.hpp>
#include <PlatformSupport/XalanUnicode.hpp>
1.51 +4 -1 xml-xalan/c/src/XPath/XPath.cpp
Index: XPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- XPath.cpp 2001/04/18 14:46:10 1.50
+++ XPath.cpp 2001/04/30 18:10:59 1.51
@@ -67,8 +67,11 @@
+#include <Include/STLHelper.hpp>
+
+
+
#include <PlatformSupport/DoubleSupport.hpp>
-#include <PlatformSupport/STLHelper.hpp>
1.25 +4 -1 xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp
Index: XPathEnvSupportDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathEnvSupportDefault.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- XPathEnvSupportDefault.cpp 2001/03/29 22:18:12 1.24
+++ XPathEnvSupportDefault.cpp 2001/04/30 18:11:01 1.25
@@ -73,8 +73,11 @@
+#include <Include/STLHelper.hpp>
+
+
+
#include <PlatformSupport/DOMStringHelper.hpp>
-#include <PlatformSupport/STLHelper.hpp>
1.35 +11 -103 xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp
Index: XPathExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- XPathExecutionContextDefault.cpp 2001/03/29 22:19:08 1.34
+++ XPathExecutionContextDefault.cpp 2001/04/30 18:11:02 1.35
@@ -62,7 +62,7 @@
-#include <PlatformSupport/STLHelper.hpp>
+#include <Include/STLHelper.hpp>
@@ -98,15 +98,10 @@
m_contextNodeList(theContextNodeList == 0 ? &s_dummyList : theContextNodeList),
m_prefixResolver(thePrefixResolver),
m_throwFoundIndex(false),
- m_availableCachedNodeLists(),
- m_busyCachedNodeLists(),
- m_availableCachedResultTreeFrags(),
- m_busyCachedResultTreeFrags(),
+ m_nodeListCache(),
+ m_resultTreeFragCache(),
m_stringCache()
{
- m_availableCachedNodeLists.reserve(eMutableNodeRefListCacheMax);
-
- m_busyCachedNodeLists.reserve(eMutableNodeRefListCacheMax);
}
@@ -123,15 +118,10 @@
m_contextNodeList(theContextNodeList == 0 ? &s_dummyList : theContextNodeList),
m_prefixResolver(thePrefixResolver),
m_throwFoundIndex(false),
- m_availableCachedNodeLists(),
- m_busyCachedNodeLists(),
- m_availableCachedResultTreeFrags(),
- m_busyCachedResultTreeFrags(),
+ m_nodeListCache(),
+ m_resultTreeFragCache(),
m_stringCache()
{
- m_availableCachedNodeLists.reserve(eMutableNodeRefListCacheMax);
-
- m_busyCachedNodeLists.reserve(eMutableNodeRefListCacheMax);
}
@@ -139,21 +129,7 @@
XPathExecutionContextDefault::~XPathExecutionContextDefault()
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::for_each;
-#endif
-
reset();
-
- for_each(
- m_availableCachedNodeLists.begin(),
- m_availableCachedNodeLists.end(),
- DeleteFunctor<MutableNodeRefList>());
-
- for_each(
- m_availableCachedResultTreeFrags.begin(),
- m_availableCachedResultTreeFrags.end(),
- DeleteFunctor<ResultTreeFragBase>());
}
@@ -180,20 +156,9 @@
m_contextNodeList = &s_dummyList;
m_prefixResolver = 0;
m_throwFoundIndex = false;
-
- while (m_busyCachedNodeLists.size() != 0)
- {
- m_availableCachedNodeLists.push_back(m_busyCachedNodeLists.back());
- m_busyCachedNodeLists.pop_back();
- }
-
- while (m_busyCachedResultTreeFrags.size() != 0)
- {
- m_availableCachedResultTreeFrags.push_back(m_busyCachedResultTreeFrags.back());
-
- m_busyCachedResultTreeFrags.pop_back();
- }
+ m_nodeListCache.reset(),
+ m_resultTreeFragCache.reset(),
m_stringCache.reset();
}
@@ -350,20 +315,7 @@
MutableNodeRefList*
XPathExecutionContextDefault::borrowMutableNodeRefList()
{
- // We'll always return the back of the free list, since
- // that's the cheapest thing.
- if (m_availableCachedNodeLists.size() == 0)
- {
- m_busyCachedNodeLists.push_back(new MutableNodeRefList);
- }
- else
- {
- m_busyCachedNodeLists.push_back(m_availableCachedNodeLists.back());
-
- m_availableCachedNodeLists.pop_back();
- }
-
- return m_busyCachedNodeLists.back();
+ return m_nodeListCache.get();
}
@@ -371,14 +323,7 @@
bool
XPathExecutionContextDefault::returnMutableNodeRefList(MutableNodeRefList* theList)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::find;
-#endif
-
- const NodeRefListCacheType::iterator i =
- find(m_busyCachedNodeLists.begin(), m_busyCachedNodeLists.end(), theList);
-
- if (i == m_busyCachedNodeLists.end())
+ if (m_nodeListCache.release(theList) == false)
{
return false;
}
@@ -386,10 +331,6 @@
{
theList->clear();
- m_availableCachedNodeLists.push_back(theList);
-
- m_busyCachedNodeLists.erase(i);
-
return true;
}
}
@@ -399,20 +340,7 @@
ResultTreeFragBase*
XPathExecutionContextDefault::borrowResultTreeFrag()
{
- // We'll always return the back of the free list, since
- // that's the cheapest thing.
- if (m_availableCachedResultTreeFrags.size() == 0)
- {
- m_busyCachedResultTreeFrags.push_back(new ResultTreeFrag);
- }
- else
- {
- m_busyCachedResultTreeFrags.push_back(m_availableCachedResultTreeFrags.back());
-
- m_availableCachedResultTreeFrags.pop_back();
- }
-
- return m_busyCachedResultTreeFrags.back();
+ return m_resultTreeFragCache.get();
}
@@ -420,27 +348,7 @@
bool
XPathExecutionContextDefault::returnResultTreeFrag(ResultTreeFragBase* theResultTreeFragBase)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::find;
-#endif
-
- const ResultTreeFragCacheType::iterator i =
- find(m_busyCachedResultTreeFrags.begin(), m_busyCachedResultTreeFrags.end(), theResultTreeFragBase);
-
- if (i == m_busyCachedResultTreeFrags.end())
- {
- return false;
- }
- else
- {
- theResultTreeFragBase->clear();
-
- m_availableCachedResultTreeFrags.push_back(theResultTreeFragBase);
-
- m_busyCachedResultTreeFrags.erase(i);
-
- return true;
- }
+ return m_resultTreeFragCache.release(theResultTreeFragBase);
}
1.33 +20 -18 xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp
Index: XPathExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- XPathExecutionContextDefault.hpp 2001/03/29 22:19:08 1.32
+++ XPathExecutionContextDefault.hpp 2001/04/30 18:11:02 1.33
@@ -73,6 +73,10 @@
+#include <Include/XalanObjectCache.hpp>
+
+
+
#include <XalanDOM/XalanDOMString.hpp>
@@ -86,7 +90,8 @@
-#include <XPath/NodeRefList.hpp>
+#include <XPath/MutableNodeRefList.hpp>
+#include <XPath/ResultTreeFrag.hpp>
@@ -340,20 +345,21 @@
const XalanNode* sourceNode = 0,
const XalanNode* styleNode = 0) const;
-#if defined(XALAN_NO_NAMESPACES)
- typedef vector<MutableNodeRefList*> NodeRefListCacheType;
- typedef vector<ResultTreeFragBase*> ResultTreeFragCacheType;
-#else
- typedef std::vector<MutableNodeRefList*> NodeRefListCacheType;
- typedef std::vector<ResultTreeFragBase*> ResultTreeFragCacheType;
-#endif
-
protected:
- enum { eMutableNodeRefListCacheMax = 50,
- eResultTreeFragListCacheMax = 50,
- eCachedArgVectorDefaultSize = 10 };
+ class XalanResultTreeFragCache : public XalanObjectCache<ResultTreeFragBase>
+ {
+ protected:
+ virtual ResultTreeFragBase*
+ create()
+ {
+ return new ResultTreeFrag;
+ }
+ };
+
+ enum { eCachedArgVectorDefaultSize = 10 };
+
XPathEnvSupport* m_xpathEnvSupport;
DOMSupport* m_domSupport;
@@ -369,14 +375,10 @@
bool m_throwFoundIndex;
XalanDOMString m_currentPattern;
-
- NodeRefListCacheType m_availableCachedNodeLists;
-
- NodeRefListCacheType m_busyCachedNodeLists;
- ResultTreeFragCacheType m_availableCachedResultTreeFrags;
+ XalanObjectCacheDefault<MutableNodeRefList> m_nodeListCache;
- ResultTreeFragCacheType m_busyCachedResultTreeFrags;
+ XalanResultTreeFragCache m_resultTreeFragCache;
XalanDOMStringCache m_stringCache;
1.12 +1 -1 xml-xalan/c/src/XPath/XPathFunctionTable.hpp
Index: XPathFunctionTable.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFunctionTable.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XPathFunctionTable.hpp 2001/01/31 18:14:11 1.11
+++ XPathFunctionTable.hpp 2001/04/30 18:11:03 1.12
@@ -73,7 +73,7 @@
-#include <PlatformSupport/STLHelper.hpp>
+#include <Include/STLHelper.hpp>
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org