Cantera 2.6.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 https://cantera.org/license.txt for license and copyright information.
7
9#include <mutex>
10
11namespace
12{
13std::mutex id_mutex;
14}
15
16namespace Cantera
17{
18
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
std::map< int, CachedValue< double > > m_scalarCache
Cached scalar values.
Definition: ValueCache.h:183
std::map< int, CachedValue< vector_fp > > m_arrayCache
Cached array values.
Definition: ValueCache.h:186
void clear()
Clear all cached values.
Definition: ValueCache.cpp:27
static int m_last_id
The last assigned id. Automatically incremented by the getId() method.
Definition: ValueCache.h:189
Namespace for the Cantera kernel.
Definition: AnyMap.h:29