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/05/10 19:58:14 UTC
cvs commit: xml-xalan/c/src/XSLT ElemTemplateElement.cpp ElemTemplateElement.hpp
dbertoni 01/05/10 10:58:14
Modified: c/src/XSLT ElemTemplateElement.cpp ElemTemplateElement.hpp
Log:
Changes for caching NodeSorters.
Revision Changes Path
1.55 +31 -25 xml-xalan/c/src/XSLT/ElemTemplateElement.cpp
Index: ElemTemplateElement.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- ElemTemplateElement.cpp 2001/04/13 02:01:27 1.54
+++ ElemTemplateElement.cpp 2001/05/10 17:58:07 1.55
@@ -99,6 +99,7 @@
#include "ElemSort.hpp"
#include "ElemTemplate.hpp"
#include "NamespacesHandler.hpp"
+#include "NodeSorter.hpp"
#include "Stylesheet.hpp"
#include "StylesheetExecutionContext.hpp"
#include "StylesheetRoot.hpp"
@@ -108,7 +109,6 @@
const XalanDOMString ElemTemplateElement::s_emptyString;
-const NodeSorter::NodeSortKeyVectorType ElemTemplateElement::s_dummyKeys;
@@ -602,13 +602,21 @@
theTemplate,
sourceNodeContext,
selectPattern,
- s_dummyKeys,
+ 0,
selectStackFrameIndex);
}
else
{
- NodeSorter::NodeSortKeyVectorType keys;
+ typedef NodeSorter::NodeSortKeyVectorType NodeSortKeyVectorType;
+ typedef StylesheetExecutionContext::BorrowReturnNodeSorter BorrowReturnNodeSorter;
+ BorrowReturnNodeSorter sorter(executionContext);
+
+ NodeSortKeyVectorType& keys = sorter->getSortKeys();
+ assert(keys.size() == 0);
+
+ CollectionClearGuard<NodeSortKeyVectorType> guard(keys);
+
// Reserve the space now...
keys.reserve(nChildren);
@@ -677,7 +685,7 @@
theTemplate,
sourceNodeContext,
selectPattern,
- keys,
+ sorter.get(),
selectStackFrameIndex);
}
}
@@ -689,7 +697,7 @@
theTemplate,
sourceNodeContext,
selectPattern,
- s_dummyKeys,
+ 0,
selectStackFrameIndex);
}
}
@@ -698,13 +706,13 @@
void
ElemTemplateElement::doTransformSelectedChildren(
- StylesheetExecutionContext& executionContext,
- const ElemTemplateElement& xslInstruction,
- const ElemTemplateElement* theTemplate,
- XalanNode* sourceNodeContext,
- const XPath& selectPattern,
- const NodeSorter::NodeSortKeyVectorType& keys,
- int selectStackFrameIndex) const
+ StylesheetExecutionContext& executionContext,
+ const ElemTemplateElement& xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceNodeContext,
+ const XPath& selectPattern,
+ NodeSorter* sorter,
+ int selectStackFrameIndex) const
{
typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex SetAndRestoreCurrentStackFrameIndex;
@@ -748,7 +756,7 @@
theTemplate,
sourceNodeContext,
selectStackFrameIndex,
- keys,
+ sorter,
sourceNodes,
nNodes);
}
@@ -759,16 +767,16 @@
void
ElemTemplateElement::doTransformSelectedChildren(
- StylesheetExecutionContext& executionContext,
- const ElemTemplateElement& xslInstruction,
- const ElemTemplateElement* theTemplate,
- XalanNode* sourceNodeContext,
- int selectStackFrameIndex,
- const NodeSorter::NodeSortKeyVectorType& keys,
- const NodeRefListBase& sourceNodes,
- unsigned int sourceNodesCount) const
+ StylesheetExecutionContext& executionContext,
+ const ElemTemplateElement& xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceNodeContext,
+ int selectStackFrameIndex,
+ NodeSorter* sorter,
+ const NodeRefListBase& sourceNodes,
+ unsigned int sourceNodesCount) const
{
- if (keys.size() > 0)
+ if (sorter != 0)
{
typedef StylesheetExecutionContext::SetAndRestoreCurrentStackFrameIndex SetAndRestoreCurrentStackFrameIndex;
typedef StylesheetExecutionContext::ContextNodeListSetAndRestore ContextNodeListSetAndRestore;
@@ -779,8 +787,6 @@
*sortedSourceNodes = sourceNodes;
{
- NodeSorter sorter;
-
SetAndRestoreCurrentStackFrameIndex theStackFrameSetAndRestore(
executionContext,
selectStackFrameIndex);
@@ -789,7 +795,7 @@
executionContext,
sourceNodes);
- sorter.sort(executionContext, *sortedSourceNodes, keys);
+ sorter->sort(executionContext, *sortedSourceNodes);
}
doTransformSelectedChildren(
1.28 +17 -19 xml-xalan/c/src/XSLT/ElemTemplateElement.hpp
Index: ElemTemplateElement.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XSLT/ElemTemplateElement.hpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- ElemTemplateElement.hpp 2001/03/29 22:24:26 1.27
+++ ElemTemplateElement.hpp 2001/05/10 17:58:09 1.28
@@ -85,13 +85,13 @@
#include <XSLT/NamespacesHandler.hpp>
-#include <XSLT/NodeSorter.hpp>
class AttributeList;
class NamespacesHandler;
class NodeRefListBase;
+class NodeSorter;
class QName;
class Stylesheet;
class StylesheetConstructionContext;
@@ -684,13 +684,13 @@
*/
void
doTransformSelectedChildren(
- StylesheetExecutionContext& executionContext,
- const ElemTemplateElement& xslInstruction,
- const ElemTemplateElement* theTemplate,
- XalanNode* sourceNodeContext,
- const XPath& selectPattern,
- const NodeSorter::NodeSortKeyVectorType& keys,
- int selectStackFrameIndex) const;
+ StylesheetExecutionContext& executionContext,
+ const ElemTemplateElement& xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceNodeContext,
+ const XPath& selectPattern,
+ NodeSorter* sorter,
+ int selectStackFrameIndex) const;
/**
* Perform a query if needed, and call transformChild for each child.
@@ -705,19 +705,19 @@
* think we want this).
* @param selectStackFrameIndex stack frame context for executing the
* select statement
- * @param keys Any sort keys that should be applied
+ * @param sorter If non-null, use the sorter to sort the nodes.
* @param sourceNodesCount The number of source nodes.
*/
void
doTransformSelectedChildren(
- StylesheetExecutionContext& executionContext,
- const ElemTemplateElement& xslInstruction,
- const ElemTemplateElement* theTemplate,
- XalanNode* sourceNodeContext,
- int selectStackFrameIndex,
- const NodeSorter::NodeSortKeyVectorType& keys,
- const NodeRefListBase& sourceNodes,
- unsigned int sourceNodesCount) const;
+ StylesheetExecutionContext& executionContext,
+ const ElemTemplateElement& xslInstruction,
+ const ElemTemplateElement* theTemplate,
+ XalanNode* sourceNodeContext,
+ int selectStackFrameIndex,
+ NodeSorter* sorter,
+ const NodeRefListBase& sourceNodes,
+ unsigned int sourceNodesCount) const;
/**
* Perform a query if needed, and call transformChild for each child.
@@ -804,8 +804,6 @@
XalanEmptyNamedNodeMap m_fakeAttributes;
const XalanDOMString m_baseIndentifier;
-
- static const NodeSorter::NodeSortKeyVectorType s_dummyKeys;
};
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org