summaryrefslogtreecommitdiff
path: root/src/CGALCache.h
diff options
context:
space:
mode:
authorDon Bright <hugh.m.bright@gmail.com>2011-09-12 22:40:51 (GMT)
committerDon Bright <hugh.m.bright@gmail.com>2011-09-12 22:40:51 (GMT)
commitf5f06c8e976ca45aebea42fe8c04bf7404357ac8 (patch)
tree8d0cdd2698e7806c1b12cc49e743b561e1082961 /src/CGALCache.h
parent007c40848db9efd704694f2e7596cabed80da50f (diff)
parent5ac9162f1c67fd21737ead11d7ebc638bf4eef5f (diff)
merge
Merge remote branch 'upstream/visitor' into visitortests Conflicts: src/export.cc src/openscad.cc src/polyset.cc src/transform.cc tests/CMakeLists.txt tests/FindGLEW.cmake tests/csgtermtest.cc
Diffstat (limited to 'src/CGALCache.h')
-rw-r--r--src/CGALCache.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/CGALCache.h b/src/CGALCache.h
new file mode 100644
index 0000000..7d3a2d9
--- /dev/null
+++ b/src/CGALCache.h
@@ -0,0 +1,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