21#ifndef mia_core_productcache_hh
22#define mia_core_productcache_hh
66 virtual void do_clear() = 0;
68 mutable CMutex m_enable_mutex;
78template <
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;
140 std::map<std::string, CProductCache *> m_caches;
141 static CMutex m_creation_mutex;
147template <
typename ProductPtr>
153template <
typename ProductPtr>
157 auto i = m_cache.find(name);
159 if (i != m_cache.end())
165template <
typename ProductPtr>
173 m_cache[name] = product;
177template <
typename ProductPtr>
The singleton that handles all product caches.
void register_cache(const std::string &name, CProductCache *cache)
static CProductCacheHandler & instance()
void clear_all()
clears all registered product caches
base class for the product cache
void enable_write(bool enable)
CProductCache(const std::string &name)
void clear()
clear the cache
The type specific product cache.
TProductCache(const std::string &descriptor)
ProductPtr get(const std::string &name) const
void add(const std::string &name, ProductPtr product)
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
#define NS_MIA_END
conveniance define to end the mia namespace
std::recursive_mutex CRecursiveMutex