Cantera  2.3.0
ValueCache.cpp
Go to the documentation of this file.
1 /**
2  * @file ValueCache.cpp
3  */
4 
5 // This file is part of Cantera. See License.txt in the top-level directory or
6 // at http://www.cantera.org/license.txt for license and copyright information.
7 
9 #include <mutex>
10 
11 namespace
12 {
13 std::mutex id_mutex;
14 }
15 
16 namespace Cantera
17 {
18 
19 int ValueCache::m_last_id = 0;
20 
22 {
23  std::unique_lock<std::mutex> lock(id_mutex);
24  return ++m_last_id;
25 }
26 
28 {
29  m_scalarCache.clear();
30  m_arrayCache.clear();
31 }
32 
33 }
int getId()
Get a unique id for a cached value.
Definition: ValueCache.cpp:21
static int m_last_id
The last assigned id. Automatically incremented by the getId() method.
Definition: ValueCache.h:189
std::map< int, CachedValue< vector_fp > > m_arrayCache
Cached array values.
Definition: ValueCache.h:186
std::map< int, CachedValue< double > > m_scalarCache
Cached scalar values.
Definition: ValueCache.h:183
void clear()
Clear all cached values.
Definition: ValueCache.cpp:27
Namespace for the Cantera kernel.
Definition: application.cpp:29