3 // (c) Konrad Rosenbaum, 2010-2011
4 // Copying and distribution of this file, with or without modification,
5 // are permitted in any medium without royalty provided the copyright
6 // notice and this notice are preserved. This file is offered as-is,
7 // without any warranty.
12 #ifndef DPTR_NONCOPY_CLASS_0_1_H
13 #define DPTR_NONCOPY_CLASS_0_1_H
16 namespace Chester_0_1{
19 /** \brief Base class of non-shared d-pointers.
21 Use in conjunction with DECLARE_NONCOPY_DPTR and DEFINE_NONCOPY_DPTR */
25 ///instantiates a non-shared d-pointer
27 ///deletes a non-shared d-pointer
28 virtual ~NonCopyDPtr(){}
30 ///hides the copy constructor
31 NonCopyDPtr(const NonCopyDPtr&){}
32 ///hides the assignment operator
33 NonCopyDPtr& operator=(const NonCopyDPtr&){return *this;}
39 using namespace Chester_0_1;
43 #ifdef DEFINE_NONCOPY_DPTR
44 #undef DEFINE_NONCOPY_DPTR
47 /** \brief Creates definitions for methods of the non-shared, non-copy d-pointer wrapper.
49 This variant is not shared between instances of the containing class.
51 To be used in implementation where the actual d-pointer class is implemented.
53 \param Class the base class within which the d-pointer was declared*/
54 #define DEFINE_NONCOPY_DPTR(Class) \
55 Class::DPrivate::DPrivate(){d=new Class::Private;}\
56 Class::DPrivate::DPrivate(const Class::DPrivate&){}\
57 Class::DPrivate::~DPrivate(){delete d;}\
58 Class::DPrivate& Class::DPrivate::operator=(const Class::DPrivate&)\