nnl::ActiveBackup< T > Class Template Reference

ActiveBackup class. More...

#include <activebackup.hh>

List of all members.

Public Member Functions

 ActiveBackup ()
T * Active ()
T * Backup ()
void Switch ()
T * operator-> ()
T & operator * ()

Public Attributes

T * mpActive
 pointer to active object
T * mpBackup
 pointer to backup object

Private Attributes

mObject1
 object 1
mObject2
 object 2


Detailed Description

template<typename T>
class nnl::ActiveBackup< T >

ActiveBackup class.

Implements Active/Backup object switcher. The class holds 2 instances of T, one of them being active, other one backup. It is possible to switch between those two. This class can be used in situations where two copies of an object are necessary, one being used, other one being prepared and vice versa.

Maybe this pattern has a name, but I don't know that.


Constructor & Destructor Documentation

template<typename T>
nnl::ActiveBackup< T >::ActiveBackup (  )  [inline]

Constructor.


Member Function Documentation

template<typename T>
T* nnl::ActiveBackup< T >::Active (  )  [inline]

Get active object.

template<typename T>
T* nnl::ActiveBackup< T >::Backup (  )  [inline]

Get backup object.

template<typename T>
T& nnl::ActiveBackup< T >::operator * (  )  [inline]

Get active object and dereference it.

template<typename T>
T* nnl::ActiveBackup< T >::operator-> (  )  [inline]

Get active object.

template<typename T>
void nnl::ActiveBackup< T >::Switch (  )  [inline]

Switch active to backup and vv.


The documentation for this class was generated from the following file:
Generated on Tue Jun 19 10:31:48 2012 for nnl by  doxygen 1.4.7