aboutsummaryrefslogtreecommitdiff
path: root/src/support/dom/document_cache.h
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-11 20:09:34 +0200
committerAdrian Kummerländer2014-05-11 20:09:34 +0200
commit20fca5978b55606062cdaf4c94dec82f5318a62a (patch)
tree3bd7752f8d914525620ff65a9f0235824f07f1da /src/support/dom/document_cache.h
parent0cd17b0afde7fc97584af31dfdfc376ef6906517 (diff)
downloadInputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.tar
InputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.tar.gz
InputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.tar.bz2
InputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.tar.lz
InputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.tar.xz
InputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.tar.zst
InputXSLT-20fca5978b55606062cdaf4c94dec82f5318a62a.zip
Switched internal DomDocumentCache structure to std::stack
* using std::unordered_map for named cache lookups was a nice idea but is not useful when one keeps in mind that: ** we don't want cached external function responses in a situation where we are able to execute transformations inside transformations ** cached responses mean that we can not read a xml file, overwrite it using another transformation and then read it again * the currently available InputXSLT frontend only processes a single transformation anyway, so increased memory requirements should not pose a problem ** if a future frontend should offer batch processing of transformation tasks, one could implement a cache reset method to free memory after a transformation has been processed
Diffstat (limited to 'src/support/dom/document_cache.h')
-rw-r--r--src/support/dom/document_cache.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/support/dom/document_cache.h b/src/support/dom/document_cache.h
index cbac5c7..1f9a9e3 100644
--- a/src/support/dom/document_cache.h
+++ b/src/support/dom/document_cache.h
@@ -5,9 +5,8 @@
#include <xercesc/dom/DOMDocument.hpp>
-#include <string>
#include <mutex>
-#include <unordered_map>
+#include <stack>
#include <memory>
#include "common.h"
@@ -16,18 +15,15 @@ namespace InputXSLT {
class DomDocumentCache {
public:
- typedef std::pair<bool, xalan::XalanDocument*> optional_item;
-
DomDocumentCache();
- optional_item get(const std::string&);
- optional_item create(const std::string&, xercesc::DOMDocument*);
+ xalan::XalanDocument* create(xercesc::DOMDocument*);
private:
class item;
std::mutex write_mutex_;
- std::unordered_map<std::string, std::unique_ptr<item>> map_;
+ std::stack<std::unique_ptr<item>> cache_;
};