Go to the documentation of this file.
21 #ifndef mia_core_productcache_hh
22 #define mia_core_productcache_hh
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;
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>
base class for the product cache
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
The type specific product cache.
CProductCache(const std::string &name)
ProductPtr get(const std::string &name) const
void register_cache(const std::string &name, CProductCache *cache)
#define NS_MIA_END
conveniance define to end the mia namespace
static CProductCacheHandler & instance()
std::recursive_mutex CRecursiveMutex
TProductCache(const std::string &descriptor)
The singleton that handles all product caches.
void clear()
clear the cache
void clear_all()
clears all registered product caches
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
void enable_write(bool enable)
void add(const std::string &name, ProductPtr product)