summaryrefslogtreecommitdiff
path: root/src/PolySetCache.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-09-11 07:10:31 (GMT)
committerMarius Kintel <marius@kintel.net>2011-09-11 07:10:31 (GMT)
commit18e97e0bd3f6bda4fdcd17de2a85173ba59b6b00 (patch)
tree327ec7c648e0f01a2673672ebe83c3524c971e19 /src/PolySetCache.cc
parent9afeded46c0e9023002dc04ba6131adcb39762b1 (diff)
Fixed bug introduced by the new PolySet cache; string filtering done in the wrong place, refactored cache into separate class
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..89c511e
--- /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