summaryrefslogtreecommitdiff
path: root/src/PolySetCache.cc
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/PolySetCache.cc
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/PolySetCache.cc')
-rw-r--r--src/PolySetCache.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/PolySetCache.cc b/src/PolySetCache.cc
new file mode 100644
index 0000000..0a93642
--- /dev/null
+++ b/src/PolySetCache.cc
@@ -0,0 +1,21 @@
+#include "PolySetCache.h"
+#include "printutils.h"
+#include "polyset.h"
+
+PolySetCache *PolySetCache::inst = NULL;
+
+void PolySetCache::insert(const std::string &id, const shared_ptr<PolySet> &ps)
+{
+ this->cache.insert(id, new cache_entry(ps), ps ? ps->polygons.size() : 0);
+}
+
+void PolySetCache::print()
+{
+ PRINTF("PolySets in cache: %d", this->cache.size());
+ PRINTF("Polygons in cache: %d", this->cache.totalCost());
+}
+
+PolySetCache::cache_entry::cache_entry(const shared_ptr<PolySet> &ps) : ps(ps)
+{
+ if (print_messages_stack.size() > 0) this->msg = print_messages_stack.last();
+}
contact: Jan Huwald // Impressum