Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
N21-03-03
NovaDAQUtilities
cxx
src
CacheManager.cpp
Go to the documentation of this file.
1
#include <NovaDAQUtilities/CacheManager.h>
2
3
namespace
novadaq
{
4
5
/**
6
* Returns the single instance of the CacheManager.
7
*
8
* @returns CacheManager instance.
9
*/
10
CacheManager
&
CacheManager::getInstance
() {
11
static
CacheManager
singletonInstance;
12
return
singletonInstance;
13
}
14
15
/**
16
* Registers the specified cache with the CacheManager. Registered
17
* caches will be flushed when the CacheManager receives a flush
18
* request.
19
*
20
* @param cache a pointer to the cache that should be registered.
21
*/
22
void
CacheManager::registerCache
(
Cache
* cache) {
23
boost::mutex::scoped_lock lock(
_registryMutex
);
24
_registry
.push_back(cache);
25
}
26
27
/**
28
* Removes the specified cache from the CacheManager.
29
*
30
* @param cache a pointer to the cache that should be removed.
31
*/
32
void
CacheManager::removeCache
(
Cache
* cache) {
33
boost::mutex::scoped_lock lock(
_registryMutex
);
34
_registry
.erase(
remove
(
_registry
.begin(),
_registry
.end(), cache),
35
_registry
.end());
36
}
37
38
/**
39
* Flushes the caches that have been registered.
40
*/
41
void
CacheManager::flushCaches
() {
42
boost::mutex::scoped_lock lock(
_registryMutex
);
43
for
(uint32_t
idx
= 0;
idx
<
_registry
.size(); ++
idx
) {
44
_registry
[
idx
]->flush();
45
}
46
}
47
48
}
// end of namespace novadaq
novadaq::Cache
Definition:
Cache.h:19
novadaq::CacheManager::removeCache
void removeCache(Cache *cache)
Definition:
CacheManager.cpp:32
novadaq::CacheManager::getInstance
static CacheManager & getInstance()
Definition:
CacheManager.cpp:10
novadaq::CacheManager::flushCaches
void flushCaches()
Definition:
CacheManager.cpp:41
novadaq::CacheManager::_registry
std::vector< Cache * > _registry
Definition:
CacheManager.h:43
novadaq
Definition:
RawDAQData.h:46
novadaq::CacheManager
Definition:
CacheManager.h:17
compare_h5_caf.idx
int idx
Definition:
compare_h5_caf.py:69
novadaq::CacheManager::_registryMutex
boost::mutex _registryMutex
Definition:
CacheManager.h:48
novadaq::CacheManager::registerCache
void registerCache(Cache *cache)
Definition:
CacheManager.cpp:22
Generated on Wed Mar 3 2021 14:12:27 for NOvA by
1.8.11