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>
The type specific product cache.
The singleton that handles all product caches.
void add(const std::string &name, ProductPtr product)
base class for the product cache
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
ProductPtr get(const std::string &name) const
std::recursive_mutex CRecursiveMutex
#define EXPORT_CORE
Macro to manage Visual C++ style dllimport/dllexport.
TProductCache(const std::string &descriptor)
#define NS_MIA_END
conveniance define to end the mia namespace