Classes | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Static Private Attributes | Friends

save_blocker Class Reference

While any instance of this class exists, attempts to save the game via any call to play_controller will be temporarily postponed: the call will return immediately without performing the save, but the save method will then be reinvoked from this class's destructor. More...

#include <save_blocker.hpp>

Collaboration diagram for save_blocker:
Collaboration graph
[legend]

List of all members.

Classes

class  save_unblocker
 An exception-safe means of making sure that unblock() gets called after try_block(). More...

Public Member Functions

 save_blocker ()
 ~save_blocker ()

Static Public Member Functions

static bool saves_are_blocked ()
static void on_unblock (play_controller *controller, void(play_controller::*callback)())

Static Protected Member Functions

static void block ()
static bool try_block ()
static void unblock ()

Static Private Attributes

static play_controllercontroller_ = NULL
static void(play_controller::* callback_ )() = NULL
static SDL_sem * sem_ = SDL_CreateSemaphore(1)

Friends

class play_controller

Detailed Description

While any instance of this class exists, attempts to save the game via any call to play_controller will be temporarily postponed: the call will return immediately without performing the save, but the save method will then be reinvoked from this class's destructor.

If multiple save attempts are performed, only the last will be carried out.

Definition at line 31 of file save_blocker.hpp.


Constructor & Destructor Documentation

save_blocker::save_blocker (  ) 

Definition at line 22 of file save_blocker.cpp.

References block().

Here is the call graph for this function:

save_blocker::~save_blocker (  ) 

Definition at line 26 of file save_blocker.cpp.

References callback_, controller_, and unblock().

Here is the call graph for this function:


Member Function Documentation

void save_blocker::block (  )  [static, protected]

Definition at line 49 of file save_blocker.cpp.

References sem_.

Referenced by save_blocker().

Here is the caller graph for this function:

void save_blocker::on_unblock ( play_controller controller,
void(play_controller::*)()  callback 
) [static]

Definition at line 35 of file save_blocker.cpp.

References callback_, controller_, try_block(), and unblock().

Referenced by play_controller::save_game(), play_controller::save_map(), and play_controller::save_replay().

Here is the call graph for this function:

Here is the caller graph for this function:

bool save_blocker::saves_are_blocked (  )  [static]

Definition at line 45 of file save_blocker.cpp.

References sem_.

bool save_blocker::try_block (  )  [static, protected]

Definition at line 53 of file save_blocker.cpp.

References sem_.

Referenced by on_unblock(), play_controller::save_game(), play_controller::save_map(), and play_controller::save_replay().

Here is the caller graph for this function:

void save_blocker::unblock (  )  [static, protected]

Definition at line 57 of file save_blocker.cpp.

References sem_.

Referenced by on_unblock(), ~save_blocker(), and save_blocker::save_unblocker::~save_unblocker().

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class play_controller [friend]

Definition at line 39 of file save_blocker.hpp.


Member Data Documentation

void(play_controller::* save_blocker::callback_)() = NULL [static, private]

Definition at line 55 of file save_blocker.hpp.

Referenced by on_unblock(), and ~save_blocker().

play_controller * save_blocker::controller_ = NULL [static, private]

Definition at line 54 of file save_blocker.hpp.

Referenced by on_unblock(), and ~save_blocker().

SDL_sem * save_blocker::sem_ = SDL_CreateSemaphore(1) [static, private]

Definition at line 56 of file save_blocker.hpp.

Referenced by block(), saves_are_blocked(), try_block(), and unblock().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Thu May 24 2012 01:15:53 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs