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_ */