Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
#define P6_REFCOUNTED_CREATEINSTANCE (   classname)
Value:
static P6R::P6ERR createInstance(classname **ppNewComponent) \
{ \
classname *pObj = NULL; \
if(NULL == ppNewComponent) \
return P6R::eAccessFault; \
*ppNewComponent = NULL; \
if(NULL == (pObj = new (std::nothrow) classname())) { \
*ppNewComponent = NULL; \
return P6R::eNoMemory; \
} \
pObj->addref(); \
if(1 == pObj->m_cRef.value) { \
(*ppNewComponent) = pObj; \
(*ppNewComponent)->addref(); \
err = P6R::eOk; \
} \
else { \
err = P6R::eInvalidRefcount; \
} \
pObj->release(); \
return err; \
}
P6UINT32 P6ERR
COM err return type see P6ERR.h.
Definition: p6types.h:141


| _ \ ___ / _|/ ___|___ _ _ _ __ | |_ ___ __| | | | | | ___| |_ __ ___ _ __ ___ | |_) / _ \ |_| | / _ | | | | '_ | __/ _ \/ _` | | |_| |/ _ \ | '_ \ / _ \ '__/ __| | _ < __/ _| |__| (_) | |_| | | | | || __/ (_| | | _ | __/ | |_) | __/ | __ \ |_| ____|_| _______/ __,_|_| |_|_____|__,_| |_| |_|___|_| .__/ ___|_| |___/

This helper macro implements a type-safe static createInstance() method for use with classes that derrive from the p6IRefCounted interface. The P6_REFCOUNTED macro calls this macro.

Parameters
classnameThe name of the class in which the createInstance() method is being declared/implemented.

Definition at line 520 of file p6comhlpr.h.