Skip to content

Libs/Analyze/MeshCache.h

Namespaces

Name
shapeworks
User usage reporting (telemetry)

Classes

Name
class shapeworks::MeshCache
Thread safe cache for meshes index by shape.

Source code

```cpp

pragma once

include "MeshWorkQueue.h"

include "StudioMesh.h"

// qt

include

// std

include

include

namespace shapeworks {

// mesh cache type using CacheMap = std::map;

// LRU list using CacheList = std::list;

class MeshCache { public: MeshCache();

void set_cache_enabled(bool enabled) { cache_enabled_ = enabled; }

void set_memory_percent(int percent) { cache_memory_percent_ = percent; }

MeshHandle get_mesh(const MeshWorkItem& vector);

void insert_mesh(const MeshWorkItem& item, MeshHandle mesh);

void clear();

private: void freeSpaceForAmount(size_t allocation);

static long long get_total_physical_memory(); static long long get_total_addressable_memory(); static long long get_total_addressable_physical_memory();

// mesh cache CacheMap mesh_cache_;

// lrc list CacheList cache_list_;

// size of memory in use by the cache size_t current_memory_size_ = 0;

// maximum memory long long max_memory_ = 0;

// for concurrent access QMutex mutex_;

bool cache_enabled_ = true; int cache_memory_percent_ = 0; }; } // namespace shapeworks ```


Updated on 2026-03-31 at 16:02:10 +0000