#include <generic_shared.hpp>
template<typename K, typename T>
class casadi::WeakCache< K, T >
Definition at line 240 of file generic_shared.hpp.
|
void | tocache (const K &key, const T &f, bool needs_lock=true) |
|
void | tocache_if_missing (const K &key, T &f) |
|
bool | incache (const K &key, T &f, bool needs_lock=true) const |
|
void | cache (std::vector< K > &keys, std::vector< T > &entries) const |
|
◆ cache()
template<typename K , typename T >
void casadi::WeakCache< K, T >::cache |
( |
std::vector< K > & |
keys, |
|
|
std::vector< T > & |
entries |
|
) |
| const |
|
inline |
Definition at line 288 of file generic_shared.hpp.
289 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
291 std::lock_guard<std::mutex> lock(mtx_);
296 for (
auto&& cf : cache_) {
297 typename T::base_type temp;
298 if (cf.second.shared_if_alive(temp)) {
299 keys.push_back(cf.first);
300 entries.push_back(shared_cast<T>(temp));
◆ incache()
template<typename K , typename T >
bool casadi::WeakCache< K, T >::incache |
( |
const K & |
key, |
|
|
T & |
f, |
|
|
bool |
needs_lock = true |
|
) |
| const |
|
inline |
Definition at line 274 of file generic_shared.hpp.
275 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
279 auto it = cache_.find(key);
280 typename T::base_type temp;
281 if (it!=cache_.end() && it->second.shared_if_alive(temp)) {
282 f = shared_cast<T>(temp);
Referenced by casadi::CallSX::get_output().
◆ tocache()
template<typename K , typename T >
void casadi::WeakCache< K, T >::tocache |
( |
const K & |
key, |
|
|
const T & |
f, |
|
|
bool |
needs_lock = true |
|
) |
| |
|
inline |
Definition at line 242 of file generic_shared.hpp.
243 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
248 cache_.insert(std::make_pair(key, f));
250 for (
auto it = cache_.begin(); it!=cache_.end(); ++it) {
251 if (!it->second.alive()) {
◆ tocache_if_missing()
template<typename K , typename T >
Definition at line 265 of file generic_shared.hpp.
266 #ifdef CASADI_WITH_THREADSAFE_SYMBOLICS
268 std::lock_guard<std::mutex> lock(mtx_);
void tocache(const K &key, const T &f, bool needs_lock=true)
bool incache(const K &key, T &f, bool needs_lock=true) const
Referenced by casadi::CallSX::get_output().
The documentation for this class was generated from the following file: