Chester
 All Classes Files Functions Variables Macros Pages
Classes | Macros
dptr_shared.h File Reference
#include "dptr_base.h"

Go to the source code of this file.

Classes

class  SharedDPtr
 Base class of shared d-pointers. More...
 

Macros

#define DEFINE_SHARED_DPTR(Class)
 Defines the methods of the shared d-pointer wrapper. More...
 

Macro Definition Documentation

#define DEFINE_SHARED_DPTR (   Class)
Value:
Class::DPrivate::DPrivate(){d=new Class::Private;}\
Class::DPrivate::DPrivate(const DPrivate&dp){d=dp.d;d->attach();}\
Class::DPrivate::~DPrivate(){d->detach();}\
Class::DPrivate Class::DPrivate::clone()const{DPrivate r;*(r.d)=*d;return r;}\
Class::DPrivate& Class::DPrivate::operator=(const DPrivate&dp)\
{if(d!=dp.d){d->detach();d=dp.d;d->attach();}return *this;}\
void Class::DPrivate::decouple()\
{if(d->currentRefCount()>1){Private *p=new Class::Private(*d);d->detach();d=p;}}

Defines the methods of the shared d-pointer wrapper.

This implements the shared version of the d-pointer wrapper. To be used in implementation where the actual d-pointer class is implemented.

Parameters
Classthe base class within which the d-pointer was declared