The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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_ = 0
 

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

Enumerator
FREE 
NEW 
ACTIVE 
LOCKED 

Definition at line 216 of file config_cache.hpp.

Constructor & Destructor Documentation

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

Definition at line 401 of file config_cache.cpp.

References active_, FREE, NEW, and state_.

game_config::config_cache_transaction::~config_cache_transaction ( )

Definition at line 410 of file config_cache.cpp.

References active_, FREE, and state_.

Member Function Documentation

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

Definition at line 426 of file config_cache.cpp.

References define_filenames_.

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

void game_config::config_cache_transaction::add_defines_map_diff ( preproc_map defines_map)
private
preproc_map & game_config::config_cache_transaction::get_active_map ( const preproc_map defines_map)
private
const std::vector< std::string > & game_config::config_cache_transaction::get_define_files ( ) const
private

Definition at line 421 of file config_cache.cpp.

References define_filenames_.

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

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().

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 486 of file config_cache.cpp.

References active_map_.

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

static config_cache_transaction& game_config::config_cache_transaction::instance ( )
inlinestaticprivate
static bool game_config::config_cache_transaction::is_active ( )
inlinestaticprivate
void game_config::config_cache_transaction::lock ( )

Lock the transaction so no more macros are added.

Definition at line 416 of file config_cache.cpp.

References LOCKED, and state_.

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

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

Friends And Related Function Documentation

friend class config_cache
friend

Definition at line 225 of file config_cache.hpp.

friend class fake_transaction
friend

Definition at line 226 of file config_cache.hpp.

Member Data Documentation

config_cache_transaction * game_config::config_cache_transaction::active_ = 0
staticprivate

Definition at line 229 of file config_cache.hpp.

Referenced by config_cache_transaction(), instance(), and ~config_cache_transaction().

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().

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().

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

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