21 #ifndef mia_core_productcache_hh
22 #define mia_core_productcache_hh
57 void enable_write(
bool enable);
63 bool is_enabled()
const;
65 virtual void do_clear() = 0;
67 mutable CMutex m_enable_mutex;
77 template <
typename ProductPtr>
93 ProductPtr get(
const std::string& name)
const;
101 void add(
const std::string& name, ProductPtr product);
104 virtual void do_clear();
106 typedef std::map<std::string, ProductPtr> CMap;
130 void register_cache(
const std::string& name,
CProductCache* cache);
137 std::map<std::string, CProductCache*> m_caches;
138 static CMutex m_creation_mutex;
144 template <
typename ProductPtr>
150 template <
typename ProductPtr>
154 auto i = m_cache.find(name);
155 if (i != m_cache.end())
160 template <
typename ProductPtr>
167 m_cache[name] = product;
171 template <
typename ProductPtr>