#define INSTANCE(type) \
private: \
static type *m_pInstance; \
public: \
static type * instance(); \
static void destroySelf(); \
private:
#define INSTANCE_CPP(type) \
type *type::m_pInstance = NULL ; \
\
type *type::instance() \
{ \
if(!m_pInstance) \
m_pInstance = new type(); \
return m_pInstance; \
} \
\
void type::destroySelf() \
{ \
if(m_pInstance) \
delete m_pInstance; \
m_pInstance = NULL; \
}