aboutsummaryrefslogtreecommitdiff
path: root/src/support/dom/document_cache.h
blob: af991021e583b5455d5353617701d71a8abf6f6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef INPUTXSLT_SRC_SUPPORT_DOM_DOCUMENT_CACHE_H_
#define INPUTXSLT_SRC_SUPPORT_DOM_DOCUMENT_CACHE_H_

#include <xercesc/dom/DOMDocument.hpp>

#include <string>
#include <mutex>
#include <unordered_map>
#include <memory>

namespace InputXSLT {

class DomDocumentCache {
	public:
		class item;
		typedef std::pair<bool, item*> optional_item;

		DomDocumentCache();

		optional_item get(const std::string&);
		optional_item create(const std::string&, xercesc::DOMDocument*);

	private:
		std::mutex write_mutex_;
		std::unordered_map<std::string, std::unique_ptr<item>> map_;

};

}

#include "document_cache_item.h"

#endif  // INPUTXSLT_SRC_SUPPORT_DOM_DOCUMENT_CACHE_H_