Public Types | Public Member Functions | Private Attributes

gui2::tnotifier< FUNCTOR > Class Template Reference

Helper class to implement callbacks with lifetime management. More...

#include <notifier.hpp>

Collaboration diagram for gui2::tnotifier< FUNCTOR >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef FUNCTOR tfunctor

Public Member Functions

 tnotifier ()
 ~tnotifier ()
void connect_notifiee (tnotifiee< tfunctor > &notifiee, tfunctor functor)
 Connects a callback.
void disconnect_notifiee (tnotifiee< tfunctor > &notifiee)
 Disonnects a callback.
const std::map< tnotifiee
< tfunctor > *, tfunctor > & 
notifiees () const

Private Attributes

std::map< tnotifiee< tfunctor >
*, tfunctor
notifiees_
 List of registered callbacks.

Detailed Description

template<class FUNCTOR>
class gui2::tnotifier< FUNCTOR >

Helper class to implement callbacks with lifetime management.

This part manages the connecting and disconnecting of the callbacks.

Subclasses should implement a way to call all callback.

Definition at line 32 of file notifier.hpp.


Member Typedef Documentation

template<class FUNCTOR>
typedef FUNCTOR gui2::tnotifier< FUNCTOR >::tfunctor

Definition at line 25 of file notifier.hpp.


Constructor & Destructor Documentation

template<class FUNCTOR>
gui2::tnotifier< FUNCTOR >::tnotifier (  )  [inline]

Definition at line 27 of file notifier.hpp.

Referenced by gui2::tnotifier< tfunctor >::~tnotifier().

Here is the caller graph for this function:

template<class FUNCTOR>
gui2::tnotifier< FUNCTOR >::~tnotifier (  )  [inline]

Definition at line 32 of file notifier.hpp.

Referenced by gui2::tnotifier< tfunctor >::~tnotifier().

Here is the caller graph for this function:


Member Function Documentation

template<class FUNCTOR>
void gui2::tnotifier< FUNCTOR >::connect_notifiee ( tnotifiee< tfunctor > &  notifiee,
tfunctor  functor 
) [inline]

Connects a callback.

Parameters:
notifiee The notifiee controlling the lifetime of the callback.
functor The callback to call.

Definition at line 50 of file notifier.hpp.

template<class FUNCTOR>
void gui2::tnotifier< FUNCTOR >::disconnect_notifiee ( tnotifiee< tfunctor > &  notifiee  )  [inline]

Disonnects a callback.

Parameters:
notifiee The notifiee controlling the lifetime of the callback. Uses since its address is an unique key.

Definition at line 68 of file notifier.hpp.

Referenced by gui2::tnotifiee< tfunctor >::~tnotifiee().

Here is the caller graph for this function:

template<class FUNCTOR>
const std::map<tnotifiee<tfunctor>*, tfunctor>& gui2::tnotifier< FUNCTOR >::notifiees (  )  const [inline]

Definition at line 85 of file notifier.hpp.


Member Data Documentation

template<class FUNCTOR>
std::map<tnotifiee<tfunctor>*, tfunctor> gui2::tnotifier< FUNCTOR >::notifiees_ [private]

List of registered callbacks.

Definition at line 93 of file notifier.hpp.

Referenced by gui2::tnotifier< tfunctor >::disconnect_notifiee(), and gui2::tnotifier< tfunctor >::~tnotifier().


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

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