The Battle for Wesnoth  1.19.7+dev
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
game_config::config_cache_transaction Class Reference

Used to share macros between cache objects You have to create transaction object to load all macros to memory and share them subsequent cache loads. More...

#include <config_cache.hpp>

Public Types

enum  state { FREE , NEW , ACTIVE , LOCKED }
 

Public Member Functions

 config_cache_transaction (const config_cache_transaction &)=delete
 
config_cache_transactionoperator= (const config_cache_transaction &)=delete
 
 config_cache_transaction ()
 
 ~config_cache_transaction ()
 
void lock ()
 Lock the transaction so no more macros are added. More...
 
void insert_to_active (const preproc_map::value_type &def)
 Used to let std::for_each insert new defines to active_map map to active. More...
 

Private Member Functions

const std::vector< std::string > & get_define_files () const
 
void add_define_file (const std::string &file)
 
preproc_mapget_active_map (const preproc_map &defines_map)
 
void add_defines_map_diff (preproc_map &defines_map)
 

Static Private Member Functions

static state get_state ()
 
static bool is_active ()
 
static config_cache_transactioninstance ()
 

Private Attributes

std::vector< std::string > define_filenames_
 
preproc_map active_map_
 

Static Private Attributes

static state state_ = FREE
 
static config_cache_transactionactive_ = nullptr
 

Friends

class config_cache
 
class fake_transaction
 

Detailed Description

Used to share macros between cache objects You have to create transaction object to load all macros to memory and share them subsequent cache loads.

If transaction is locked all stored macros are still available but new macros aren't added.

Definition at line 196 of file config_cache.hpp.

Member Enumeration Documentation

◆ state

Enumerator
FREE 
NEW 
ACTIVE 
LOCKED 

Definition at line 216 of file config_cache.hpp.

Constructor & Destructor Documentation

◆ config_cache_transaction() [1/2]

game_config::config_cache_transaction::config_cache_transaction ( const config_cache_transaction )
delete

◆ config_cache_transaction() [2/2]

game_config::config_cache_transaction::config_cache_transaction ( )

Definition at line 413 of file config_cache.cpp.

References active_, FREE, NEW, and state_.

◆ ~config_cache_transaction()

game_config::config_cache_transaction::~config_cache_transaction ( )

Definition at line 422 of file config_cache.cpp.

References active_, FREE, and state_.

Member Function Documentation

◆ add_define_file()

void game_config::config_cache_transaction::add_define_file ( const std::string &  file)
private

Definition at line 438 of file config_cache.cpp.

References define_filenames_.

Referenced by game_config::config_cache::read_cache().

◆ add_defines_map_diff()

void game_config::config_cache_transaction::add_defines_map_diff ( preproc_map defines_map)
private

◆ get_active_map()

preproc_map & game_config::config_cache_transaction::get_active_map ( const preproc_map defines_map)
private

◆ get_define_files()

const std::vector< std::string > & game_config::config_cache_transaction::get_define_files ( ) const
private

Definition at line 433 of file config_cache.cpp.

References define_filenames_.

Referenced by game_config::config_cache::read_defines_queue().

◆ get_state()

static state game_config::config_cache_transaction::get_state ( )
inlinestaticprivate

Definition at line 234 of file config_cache.hpp.

References state_.

Referenced by add_defines_map_diff(), and get_active_map().

◆ insert_to_active()

void game_config::config_cache_transaction::insert_to_active ( const preproc_map::value_type &  def)

Used to let std::for_each insert new defines to active_map map to active.

Definition at line 498 of file config_cache.cpp.

References active_map_.

Referenced by add_defines_map_diff(), and game_config::config_cache::read_defines_file().

◆ instance()

static config_cache_transaction& game_config::config_cache_transaction::instance ( )
inlinestaticprivate

◆ is_active()

static bool game_config::config_cache_transaction::is_active ( )
inlinestaticprivate

◆ lock()

void game_config::config_cache_transaction::lock ( )

Lock the transaction so no more macros are added.

Definition at line 428 of file config_cache.cpp.

References LOCKED, and state_.

Referenced by BOOST_AUTO_TEST_CASE(), and game_config_manager::load_game_config().

◆ operator=()

config_cache_transaction& game_config::config_cache_transaction::operator= ( const config_cache_transaction )
delete

Friends And Related Function Documentation

◆ config_cache

friend class config_cache
friend

Definition at line 225 of file config_cache.hpp.

◆ fake_transaction

friend class fake_transaction
friend

Definition at line 226 of file config_cache.hpp.

Member Data Documentation

◆ active_

config_cache_transaction * game_config::config_cache_transaction::active_ = nullptr
staticprivate

◆ active_map_

preproc_map game_config::config_cache_transaction::active_map_
private

Definition at line 232 of file config_cache.hpp.

Referenced by add_defines_map_diff(), get_active_map(), and insert_to_active().

◆ define_filenames_

std::vector<std::string> game_config::config_cache_transaction::define_filenames_
private

Definition at line 231 of file config_cache.hpp.

Referenced by add_define_file(), and get_define_files().

◆ state_

config_cache_transaction::state game_config::config_cache_transaction::state_ = FREE
staticprivate

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