CWeakPtrFacade.h
Go to the documentation of this file.
// -*- c++ -*-
//*****************************************************************************
//*****************************************************************************
#ifndef polybori_CWeakPtrFacade_h_
#define polybori_CWeakPtrFacade_h_
// include basic definitions
#include <polybori/pbori_defs.h>
#include <boost/shared_ptr.hpp>
BEGIN_NAMESPACE_PBORI
template <class ValueType>
class CWeakPtr;
template <class ValueType>
class CWeakPtrFacade {
typedef CWeakPtrFacade self;
public:
typedef ValueType value_type;
typedef value_type* data_type;
typedef boost::shared_ptr<data_type> ptr_type;
friend class CWeakPtr<value_type>;
CWeakPtrFacade():
m_data(new data_type(static_cast<data_type>(this))) {}
CWeakPtrFacade(const self& rhs):
m_data(new data_type(static_cast<data_type>(this))) {}
~CWeakPtrFacade() { (*m_data) = NULL; }
protected:
ptr_type m_data;
};
END_NAMESPACE_PBORI
#endif /* polybori_CWeakPtrFacade_h_ */
END_NAMESPACE_PBORI
#define END_NAMESPACE_PBORI
Finish project's namespace.
Definition: pbori_defs.h:77
BEGIN_NAMESPACE_PBORI
#define BEGIN_NAMESPACE_PBORI
Start project's namespace.
Definition: pbori_defs.h:74
polybori::CWeakPtrFacade::~CWeakPtrFacade
~CWeakPtrFacade()
Destructor (invalidates pointer to here)
Definition: CWeakPtrFacade.h:56
polybori::CWeakPtrFacade::m_data
ptr_type m_data
Definition: CWeakPtrFacade.h:59
polybori::CWeakPtrFacade::CWeakPtrFacade
CWeakPtrFacade(const self &rhs)
Copy constructor (constructs new facade)
Definition: CWeakPtrFacade.h:52
pbori_defs.h
polybori::CWeakPtrFacade::value_type
ValueType value_type
Definition: CWeakPtrFacade.h:41
polybori::CWeakPtrFacade
This class defines CWeakPtrFacade.
Definition: CWeakPtrFacade.h:36
polybori::CWeakPtr
Forward declaration of friend.
Definition: CWeakPtr.h:31
polybori::CWeakPtrFacade::ptr_type
boost::shared_ptr< data_type > ptr_type
Definition: CWeakPtrFacade.h:43
polybori::CWeakPtrFacade::CWeakPtrFacade
CWeakPtrFacade()
Default constructor (only data is the pointer to here)
Definition: CWeakPtrFacade.h:48
polybori::CWeakPtrFacade::data_type
value_type * data_type
Definition: CWeakPtrFacade.h:42