CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::DB::Cache Class Reference

#include <Cache.hh>

+ Inheritance diagram for CASM::DB::Cache:

Detailed Description

Store data in JSON.

Definition at line 13 of file Cache.hh.

Public Member Functions

 Cache ()
 
template<typename T >
void cache_insert (std::string name, const T &data) const
 
void set_initial_cache (jsonParser const &_cache)
 Set the configuration cache as read from the database. More...
 
void update_cache (jsonParser const &_cache)
 Upate the configuration cache. More...
 
const jsonParsercache () const
 Access the configuration cache, which will be saved in the database. More...
 
bool cache_updated () const
 Check if cache updated. More...
 
void cache_clear () const
 

Protected Member Functions

jsonParsercache ()
 

Private Attributes

jsonParser m_cache
 
bool m_cache_updated
 

Constructor & Destructor Documentation

◆ Cache()

CASM::DB::Cache::Cache ( )
inline

Definition at line 15 of file Cache.hh.

Member Function Documentation

◆ cache() [1/2]

jsonParser& CASM::DB::Cache::cache ( )
inlineprotected

Access the configuration cache, which will be saved in the database

Definition at line 65 of file Cache.hh.

◆ cache() [2/2]

const jsonParser& CASM::DB::Cache::cache ( ) const
inline

Access the configuration cache, which will be saved in the database.

Definition at line 47 of file Cache.hh.

◆ cache_clear()

void CASM::DB::Cache::cache_clear ( ) const
inline

Clear the cache

  • Clearing cache is modeled as const, but a flag is set so the updated data can be obtained
  • Sets 'cache_updated()' to true

Definition at line 56 of file Cache.hh.

◆ cache_insert()

template<typename T >
void CASM::DB::Cache::cache_insert ( std::string  name,
const T &  data 
) const
inline

Insert data in the configuration cache, which will be saved in the database

  • For data that depends on DoF only, not calculated properties or composition axes
  • Adding to cache is modeled as const, but a flag is set so the updated data can be obtained
  • Data only written if 'name' does not already exist in cache
  • Sets 'cache_updated()' to true

Definition at line 27 of file Cache.hh.

◆ cache_updated()

bool CASM::DB::Cache::cache_updated ( ) const
inline

Check if cache updated.

Definition at line 50 of file Cache.hh.

◆ set_initial_cache()

void CASM::DB::Cache::set_initial_cache ( jsonParser const &  _cache)
inline

Set the configuration cache as read from the database.

Definition at line 35 of file Cache.hh.

◆ update_cache()

void CASM::DB::Cache::update_cache ( jsonParser const &  _cache)
inline

Upate the configuration cache.

Definition at line 41 of file Cache.hh.

Member Data Documentation

◆ m_cache

jsonParser CASM::DB::Cache::m_cache
mutableprivate

Definition at line 68 of file Cache.hh.

◆ m_cache_updated

bool CASM::DB::Cache::m_cache_updated
mutableprivate

Definition at line 69 of file Cache.hh.


The documentation for this class was generated from the following file: