CacheManager.h
Go to the documentation of this file.
1 #ifndef _NOVADAQ_CACHE_MANAGER_H
2 #define _NOVADAQ_CACHE_MANAGER_H
3 
4 #include <NovaDAQUtilities/Cache.h>
5 #include <boost/thread/mutex.hpp>
6 #include <vector>
7 
8 namespace novadaq {
9 
10 /**
11  * A singleton class to manage flushing of caches.
12  *
13  * @author Kurt Biery
14  * @version $Revision: 1.1.34.1 $ $Date: 2019/09/27 00:07:20 $
15  */
16 
17 class CacheManager {
18 
19  public:
20 
21  static CacheManager& getInstance();
22 
23  void registerCache(Cache* cache);
24 
25  void removeCache(Cache* cache);
26 
27  void flushCaches();
28 
29  private:
30 
31  /**
32  * Default constructor.
33  */
34  explicit CacheManager() {};
35 
36  // disallow any copying
37  CacheManager(CacheManager const&); // not implemented
38  void operator= (CacheManager const&); // not implemented
39 
40  /**
41  * The list of registered caches.
42  */
43  std::vector<Cache*> _registry;
44 
45  /**
46  * A mutex to protect against concurrent use of the registry.
47  */
49 
50 };
51 
52 } // end of namespace novadaq
53 
54 #endif
void removeCache(Cache *cache)
static CacheManager & getInstance()
std::vector< Cache * > _registry
Definition: CacheManager.h:43
boost::mutex _registryMutex
Definition: CacheManager.h:48
void operator=(CacheManager const &)
void registerCache(Cache *cache)