summaryrefslogtreecommitdiff
path: root/src/CGALCache.h
blob: 7d3a2d90731af2ac49f2a0f7f463c7eb0f61c849 (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
#ifndef CGALCACHE_H_
#define CGALCACHE_H_

#include "myqhash.h"
#include <QCache>

/*!
*/
class CGALCache
{
public:	
	CGALCache(size_t limit = 100000) : cache(limit) {}

	static CGALCache *instance() { if (!inst) inst = new CGALCache; return inst; }

	bool contains(const std::string &id) const { return this->cache.contains(id); }
	const class CGAL_Nef_polyhedron &get(const std::string &id) const { return *this->cache[id]; }
	void insert(const std::string &id, const CGAL_Nef_polyhedron &N);
	void clear() { cache.clear(); }
	void print();

private:
	static CGALCache *inst;

	QCache<std::string, CGAL_Nef_polyhedron> cache;
};

#endif
contact: Jan Huwald // Impressum