22 #ifndef __XN_MODULE_CPP_REGISTRATION_H__ 23 #define __XN_MODULE_CPP_REGISTRATION_H__ 37 #define _XN_MODULE_INST g_pTheModule 39 #define _CONCAT(a,b) a##b 46 #define __XN_EXPORT_NODE_COMMON(ExportedClass, ExportedName, Type) \ 48 static ExportedClass* ExportedName = new ExportedClass(); \ 50 void XN_CALLBACK_TYPE _CONCAT(ExportedClass,GetDescription)(XnProductionNodeDescription* pDescription) \ 52 ExportedName->GetDescription(pDescription); \ 55 XnStatus XN_CALLBACK_TYPE _CONCAT(ExportedClass,EnumerateProductionTrees) \ 56 (XnContext* pContext, XnNodeInfoList* pTreesList, XnEnumerationErrors* pErrors) \ 58 Context context(pContext); \ 59 NodeInfoList list(pTreesList); \ 60 EnumerationErrors errors(pErrors); \ 61 return ExportedName->EnumerateProductionTrees(context, list, pErrors == NULL ? NULL : &errors); \ 64 XnStatus XN_CALLBACK_TYPE _CONCAT(ExportedClass,Create)(XnContext* pContext, \ 65 const XnChar* strInstanceName, \ 66 const XnChar* strCreationInfo, \ 67 XnNodeInfoList* pNeededTrees, \ 68 const XnChar* strConfigurationDir, \ 69 XnModuleNodeHandle* phInstance) \ 71 xn::NodeInfoList* pNeeded = NULL; \ 72 if (pNeededTrees != NULL) \ 74 pNeeded = XN_NEW(xn::NodeInfoList, pNeededTrees); \ 76 ModuleProductionNode* pNode; \ 77 Context context(pContext); \ 78 XnStatus nRetVal = ExportedName->Create(context, strInstanceName, strCreationInfo, \ 79 pNeeded, strConfigurationDir, &pNode); \ 80 if (nRetVal != XN_STATUS_OK) \ 85 *phInstance = __ModuleNodeToHandle(pNode); \ 87 return (XN_STATUS_OK); \ 90 void XN_CALLBACK_TYPE _CONCAT(ExportedClass,Destroy)(XnModuleNodeHandle hInstance) \ 92 ModuleProductionNode* pNode = (ModuleProductionNode*)hInstance; \ 93 ExportedName->Destroy(pNode); \ 96 void XN_CALLBACK_TYPE _CONCAT(ExportedClass,GetExportedInterface)( \ 97 XnModuleExportedProductionNodeInterface* pInterface) \ 99 pInterface->GetDescription = _CONCAT(ExportedClass,GetDescription); \ 100 pInterface->EnumerateProductionTrees = _CONCAT(ExportedClass,EnumerateProductionTrees); \ 101 pInterface->Create = _CONCAT(ExportedClass,Create); \ 102 pInterface->Destroy = _CONCAT(ExportedClass,Destroy); \ 103 pInterface->GetInterface.General = __ModuleGetGetInterfaceFunc(Type); \ 106 static XnStatus _CONCAT(ExportedClass,RegisterResult) = \ 107 _XN_MODULE_INST->AddExportedNode(_CONCAT(ExportedClass,GetExportedInterface)); 109 #define _XN_EXPORT_NODE_COMMON(ExportedClass, Type) \ 110 __XN_EXPORT_NODE_COMMON(ExportedClass, _g_##ExportedClass, Type) 182 #if XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS 183 #define XN_EXPORT_MODULE(ModuleClass) \ 185 ModuleClass __moduleInstance; \ 186 Module* _XN_MODULE_INST = &__moduleInstance; 188 #define XN_EXPORT_MODULE(ModuleClass) \ 190 static ModuleClass __moduleInstance; \ 191 static Module* _XN_MODULE_INST = &__moduleInstance; 195 #define XN_EXPORT_NODE(ExportedClass, nodeType) \ 196 _XN_EXPORT_NODE_COMMON(ExportedClass, nodeType) 199 #define XN_EXPORT_DEVICE(ExportedClass) \ 200 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_DEVICE) 203 #define XN_EXPORT_DEPTH(ExportedClass) \ 204 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_DEPTH) 207 #define XN_EXPORT_IMAGE(ExportedClass) \ 208 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_IMAGE) 211 #define XN_EXPORT_IR(ExportedClass) \ 212 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_IR) 214 #define XN_EXPORT_USER(ExportedClass) \ 215 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_USER) 217 #define XN_EXPORT_HANDS(ExportedClass) \ 218 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_HANDS) 220 #define XN_EXPORT_GESTURE(ExportedClass) \ 221 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_GESTURE) 223 #define XN_EXPORT_SCENE(ExportedClass) \ 224 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_SCENE) 227 #define XN_EXPORT_AUDIO(ExportedClass) \ 228 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_AUDIO) 231 #define XN_EXPORT_RECORDER(ExportedClass) \ 232 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_RECORDER) 235 #define XN_EXPORT_PLAYER(ExportedClass) \ 236 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_PLAYER) 238 #define XN_EXPORT_CODEC(ExportedClass) \ 239 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_CODEC) 241 #define XN_EXPORT_SCRIPT(ExportedClass) \ 242 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_SCRIPT) 247 #if XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS 249 #define XN_MODULE_FUNC_TYPE XN_C_API_EXPORT 250 extern Module* _XN_MODULE_INST;
252 #define XN_MODULE_FUNC_TYPE static 253 static Module* _XN_MODULE_INST;
260 nRetVal = _XN_MODULE_INST->
Load();
268 _XN_MODULE_INST->
Unload();
289 #if !XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS 303 #endif // __XN_MODULE_CPP_REGISTRATION_H__ XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_LOAD()
Definition: XnModuleCppRegistratration.h:256
void(* XnModuleGetExportedInterfacePtr)(XnModuleExportedProductionNodeInterface *pInterface)
Definition: XnModuleInterface.h:63
Definition: XnTypes.h:112
Definition: XnTypes.h:136
#define XN_IS_STATUS_OK(x)
Definition: XnMacros.h:60
Definition: XnTypes.h:127
virtual XnStatus Load()
Definition: XnModuleCppInterface.h:53
void * XnModuleNodeHandle
Definition: XnTypes.h:219
#define XN_MAINTENANCE_VERSION
Definition: XnVersion.h:38
Definition: XnModuleInterface.h:325
Definition: XnTypes.h:115
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_GET_OPEN_NI_VERSION(XnVersion *pVersion)
Definition: XnModuleCppRegistratration.h:281
Definition: XnTypes.h:133
Definition: XnModuleCppInterface.h:151
#define XN_STATUS_OK
Definition: XnStatus.h:37
Definition: XnTypes.h:151
Definition: XnTypes.h:121
Definition: XnModuleCppInterface.h:47
Definition: XnTypes.h:141
Definition: XnModuleInterface.h:70
Definition: XnModuleInterface.h:699
Definition: XnModuleInterface.h:1329
Definition: XnTypes.h:103
XnUInt32 XnStatus
Definition: XnStatus.h:34
#define XN_MODULE_FUNC_TYPE
Definition: XnModuleCppRegistratration.h:252
XnUInt32 GetExportedNodesCount()
Definition: XnModuleCppInterface.h:58
Definition: XnTypes.h:142
XnStatus GetExportedNodes(XnModuleGetExportedInterfacePtr *aEntryPoints, XnUInt32 nCount)
Definition: XnModuleCppInterface.h:60
Definition: XnModuleInterface.h:1314
XnInt32 XnProductionNodeType
Definition: XnTypes.h:92
Definition: XnModuleInterface.h:1087
XnUInt8 nMinor
Definition: XnTypes.h:154
Definition: XnTypes.h:118
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_ENTRY_POINTS(XnModuleGetExportedInterfacePtr *aEntryPoints, XnUInt32 nCount)
Definition: XnModuleCppRegistratration.h:276
Definition: XnModuleInterface.h:1202
Definition: XnTypes.h:109
Definition: XnModuleInterface.h:715
Definition: XnModuleInterface.h:885
Definition: XnTypes.h:139
XN_C_API XnBool XN_C_DECL xnIsTypeDerivedFrom(XnProductionNodeType type, XnProductionNodeType base)
Checks if a certain production node type is a derived of another type.
Definition: XnModuleInterface.h:1144
Definition: XnModuleInterface.h:1286
Definition: XnTypes.h:124
XN_MODULE_FUNC_TYPE XnUInt32 XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_COUNT()
Definition: XnModuleCppRegistratration.h:271
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_UNLOAD()
Definition: XnModuleCppRegistratration.h:266
Definition: XnModuleInterface.h:1027
Definition: XnTypes.h:140
Definition: XnModuleInterface.h:1185
XnUInt32 nBuild
Definition: XnTypes.h:156
XnUInt8 nMajor
Definition: XnTypes.h:153
XnUInt16 nMaintenance
Definition: XnTypes.h:155
Definition: XnModuleInterface.h:1159
void(* GetInterfaceFuncPtr)(void *pInterface)
Definition: XnModuleCppRegistratration.h:137
Definition: XnModuleInterface.h:573
Definition: XnTypes.h:130
Definition: XnModuleInterface.h:1340
#define XN_BUILD_VERSION
Definition: XnVersion.h:40
#define XN_MINOR_VERSION
Definition: XnVersion.h:36
XN_C_API XnStatus XN_C_DECL xnRegisterModuleWithOpenNI(XnOpenNIModuleInterface *pInterface, const XnChar *strConfigDir, const XnChar *strName)
#define XN_MAJOR_VERSION
Definition: XnVersion.h:34
Definition: XnTypes.h:106
virtual void Unload()
Definition: XnModuleCppInterface.h:54
Definition: XnCppWrapper.h:34
Definition: XnModuleInterface.h:412