diff options
Diffstat (limited to 'src/PolySetCache.cc')
-rw-r--r-- | src/PolySetCache.cc | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/PolySetCache.cc b/src/PolySetCache.cc index 2a2da9c..cff4e88 100644 --- a/src/PolySetCache.cc +++ b/src/PolySetCache.cc @@ -6,13 +6,23 @@ 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); + this->cache.insert(id, new cache_entry(ps), ps ? ps->memsize() : 0); +} + +size_t PolySetCache::maxSize() const +{ + return this->cache.maxCost(); +} + +void PolySetCache::setMaxSize(size_t limit) +{ + this->cache.setMaxCost(limit); } void PolySetCache::print() { PRINTF("PolySets in cache: %d", this->cache.size()); - PRINTF("Polygons in cache: %d", this->cache.totalCost()); + PRINTF("PolySet cache size in bytes: %d", this->cache.totalCost()); } PolySetCache::cache_entry::cache_entry(const shared_ptr<PolySet> &ps) : ps(ps) |