diff options
author | Marius Kintel <marius@kintel.net> | 2012-01-06 18:10:33 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2012-01-09 23:01:50 (GMT) |
commit | fe3362faf825016606a8bcd60669c16965b0599c (patch) | |
tree | 1cfccc34acf462d9faefdfb8662c48cde878cbf9 /src/CGALCache.cc | |
parent | c4695872392a6d1415752934be55c81de57de87e (diff) |
Started on cache size management: Let cache sizes be read from Preferences, measure cache sizes in bytes
Diffstat (limited to 'src/CGALCache.cc')
-rw-r--r-- | src/CGALCache.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/CGALCache.cc b/src/CGALCache.cc index 84de722..7d1baf8 100644 --- a/src/CGALCache.cc +++ b/src/CGALCache.cc @@ -8,12 +8,27 @@ void CGALCache::insert(const std::string &id, const CGAL_Nef_polyhedron &N) { this->cache.insert(id, new CGAL_Nef_polyhedron(N), N.weight()); #ifdef DEBUG - PRINTF("CGAL Cache insert: %s (%d verts)", id.substr(0, 40).c_str(), N.weight()); + PRINTF("CGAL Cache insert: %s (%d bytes)", id.substr(0, 40).c_str(), N.weight()); #endif } +size_t CGALCache::maxSize() const +{ + return this->cache.maxCost(); +} + +void CGALCache::setMaxSize(size_t limit) +{ + this->cache.setMaxCost(limit); +} + +void CGALCache::clear() +{ + cache.clear(); +} + void CGALCache::print() { PRINTF("CGAL Polyhedrons in cache: %d", this->cache.size()); - PRINTF("Vertices in cache: %d", this->cache.totalCost()); + PRINTF("CGAL cache size in bytes: %d", this->cache.totalCost()); } |