1 #ifndef __bbtkPimpl_h_INCLUDED__
2 #define __bbtkPimpl_h_INCLUDED__
5 /** \brief Macro defining the members used to hide a class implementation details using the pimpl idom
6 * /// See http://c2.com/cgi/wiki?PimplIdiom
8 * - Defines the struct Pimpl to be implemented in cpp file
9 * - Declares a private member called p
10 * - Declares the methods PimplConstruct/PimplCopyConstruct/PimplDestruct
12 #define BBTK_DECLARE_PIMPL(CLASS) \
14 /* The Pimpl struct forward definition */ \
16 /* The Pimpl pointer */ \
18 /* Constructs the Pimpl (to be called in all Ctors) */ \
19 void PimplConstruct(); \
20 /* Copy constructs the Pimpl (to be called in copy Ctor) */ \
21 void PimplCopyConstruct(const CLASS&); \
22 /* Destructs the Pimpl (to be called in Dtor) */ \
27 /** \brief Macro implementing the PimplConstruct/PimplCopyConstruct/PimplDestruct method declared by BBTK_DECLARE_PIMPL: to be put in cpp **/
28 #define BBTK_IMPL_PIMPL(CLASS) \
29 void CLASS::PimplConstruct() \
33 void CLASS::PimplCopyConstruct(const CLASS& o) \
35 p = new Pimpl(*(o.p)); \
37 void CLASS::PimplDestruct() \