21 #ifndef mia_core_productcache_hh
22 #define mia_core_productcache_hh
58 void enable_write(
bool enable);
64 bool is_enabled()
const;
66 virtual void do_clear() = 0;
68 mutable CMutex m_enable_mutex;
78 template <
typename ProductPtr>
95 ProductPtr get(
const std::string& name)
const;
103 void add(
const std::string& name, ProductPtr product);
106 virtual void do_clear();
108 typedef std::map<std::string, ProductPtr> CMap;
133 void register_cache(
const std::string& name,
CProductCache *cache);
140 std::map<std::string, CProductCache *> m_caches;
141 static CMutex m_creation_mutex;
147 template <
typename ProductPtr>
153 template <
typename ProductPtr>
157 auto i = m_cache.find(name);
159 if (i != m_cache.end())
165 template <
typename ProductPtr>
173 m_cache[name] = product;
177 template <
typename ProductPtr>