21#ifndef __XN_MODULE_CPP_REGISTRATION_H__
22#define __XN_MODULE_CPP_REGISTRATION_H__
36#define _XN_MODULE_INST g_pTheModule
38#define _CONCAT(a,b) a##b
45#define __XN_EXPORT_NODE_COMMON(ExportedClass, ExportedName, Type) \
47 static ExportedClass* ExportedName = new ExportedClass(); \
49 void XN_CALLBACK_TYPE _CONCAT(ExportedClass,GetDescription)(XnProductionNodeDescription* pDescription) \
51 ExportedName->GetDescription(pDescription); \
54 XnStatus XN_CALLBACK_TYPE _CONCAT(ExportedClass,EnumerateProductionTrees) \
55 (XnContext* pContext, XnNodeInfoList* pTreesList, XnEnumerationErrors* pErrors) \
57 Context context(pContext); \
58 NodeInfoList list(pTreesList); \
59 EnumerationErrors errors(pErrors); \
60 return ExportedName->EnumerateProductionTrees(context, list, pErrors == NULL ? NULL : &errors); \
63 XnStatus XN_CALLBACK_TYPE _CONCAT(ExportedClass,Create)(XnContext* pContext, \
64 const XnChar* strInstanceName, \
65 const XnChar* strCreationInfo, \
66 XnNodeInfoList* pNeededTrees, \
67 const XnChar* strConfigurationDir, \
68 XnModuleNodeHandle* phInstance) \
70 xn::NodeInfoList* pNeeded = NULL; \
71 if (pNeededTrees != NULL) \
73 pNeeded = XN_NEW(xn::NodeInfoList, pNeededTrees); \
75 ModuleProductionNode* pNode; \
76 Context context(pContext); \
77 XnStatus nRetVal = ExportedName->Create(context, strInstanceName, strCreationInfo, \
78 pNeeded, strConfigurationDir, &pNode); \
79 if (nRetVal != XN_STATUS_OK) \
84 *phInstance = __ModuleNodeToHandle(pNode); \
86 return (XN_STATUS_OK); \
89 void XN_CALLBACK_TYPE _CONCAT(ExportedClass,Destroy)(XnModuleNodeHandle hInstance) \
91 ModuleProductionNode* pNode = (ModuleProductionNode*)hInstance; \
92 ExportedName->Destroy(pNode); \
95 void XN_CALLBACK_TYPE _CONCAT(ExportedClass,GetExportedInterface)( \
96 XnModuleExportedProductionNodeInterface* pInterface) \
98 pInterface->GetDescription = _CONCAT(ExportedClass,GetDescription); \
99 pInterface->EnumerateProductionTrees = _CONCAT(ExportedClass,EnumerateProductionTrees); \
100 pInterface->Create = _CONCAT(ExportedClass,Create); \
101 pInterface->Destroy = _CONCAT(ExportedClass,Destroy); \
102 pInterface->GetInterface.General = __ModuleGetGetInterfaceFunc(Type); \
105 static XnStatus _CONCAT(ExportedClass,RegisterResult) = \
106 _XN_MODULE_INST->AddExportedNode(_CONCAT(ExportedClass,GetExportedInterface));
108#define _XN_EXPORT_NODE_COMMON(ExportedClass, Type) \
109 __XN_EXPORT_NODE_COMMON(ExportedClass, _g_##ExportedClass, Type)
181#if XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS
182 #define XN_EXPORT_MODULE(ModuleClass) \
184 ModuleClass __moduleInstance; \
185 Module* _XN_MODULE_INST = &__moduleInstance;
187 #define XN_EXPORT_MODULE(ModuleClass) \
189 static ModuleClass __moduleInstance; \
190 static Module* _XN_MODULE_INST = &__moduleInstance;
194#define XN_EXPORT_NODE(ExportedClass, nodeType) \
195 _XN_EXPORT_NODE_COMMON(ExportedClass, nodeType)
198#define XN_EXPORT_DEVICE(ExportedClass) \
199 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_DEVICE)
202#define XN_EXPORT_DEPTH(ExportedClass) \
203 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_DEPTH)
206#define XN_EXPORT_IMAGE(ExportedClass) \
207 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_IMAGE)
210#define XN_EXPORT_IR(ExportedClass) \
211 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_IR)
213#define XN_EXPORT_USER(ExportedClass) \
214 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_USER)
216#define XN_EXPORT_HANDS(ExportedClass) \
217 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_HANDS)
219#define XN_EXPORT_GESTURE(ExportedClass) \
220 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_GESTURE)
222#define XN_EXPORT_SCENE(ExportedClass) \
223 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_SCENE)
226#define XN_EXPORT_AUDIO(ExportedClass) \
227 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_AUDIO)
230#define XN_EXPORT_RECORDER(ExportedClass) \
231 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_RECORDER)
234#define XN_EXPORT_PLAYER(ExportedClass) \
235 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_PLAYER)
237#define XN_EXPORT_CODEC(ExportedClass) \
238 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_CODEC)
240#define XN_EXPORT_SCRIPT(ExportedClass) \
241 _XN_EXPORT_NODE_COMMON(ExportedClass, XN_NODE_TYPE_SCRIPT)
246#if XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS
248 #define XN_MODULE_FUNC_TYPE XN_C_API_EXPORT
249 extern Module* _XN_MODULE_INST;
251 #define XN_MODULE_FUNC_TYPE static
252 static Module* _XN_MODULE_INST;
259 nRetVal = _XN_MODULE_INST->Load();
267 _XN_MODULE_INST->Unload();
272 return _XN_MODULE_INST->GetExportedNodesCount();
277 return _XN_MODULE_INST->GetExportedNodes(aEntryPoints, nCount);
288#if !XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS
#define XN_IS_STATUS_OK(x)
Definition: XnMacros.h:59
void(* GetInterfaceFuncPtr)(void *pInterface)
Definition: XnModuleCppRegistratration.h:136
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_UNLOAD()
Definition: XnModuleCppRegistratration.h:265
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_ENTRY_POINTS(XnModuleGetExportedInterfacePtr *aEntryPoints, XnUInt32 nCount)
Definition: XnModuleCppRegistratration.h:275
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_LOAD()
Definition: XnModuleCppRegistratration.h:255
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_GET_OPEN_NI_VERSION(XnVersion *pVersion)
Definition: XnModuleCppRegistratration.h:280
XN_MODULE_FUNC_TYPE XnUInt32 XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_COUNT()
Definition: XnModuleCppRegistratration.h:270
#define XN_MODULE_FUNC_TYPE
Definition: XnModuleCppRegistratration.h:251
void(* XnModuleGetExportedInterfacePtr)(XnModuleExportedProductionNodeInterface *pInterface)
Definition: XnModuleInterface.h:62
XnUInt32 XnStatus
Definition: XnStatus.h:33
#define XN_STATUS_OK
Definition: XnStatus.h:36
void * XnModuleNodeHandle
Definition: XnTypes.h:221
XnInt32 XnProductionNodeType
Definition: XnTypes.h:94
@ XN_NODE_TYPE_PLAYER
Definition: XnTypes.h:126
@ XN_NODE_TYPE_DEPTH
Definition: XnTypes.h:108
@ XN_NODE_TYPE_HANDS
Definition: XnTypes.h:135
@ XN_NODE_TYPE_MAP_GENERATOR
Definition: XnTypes.h:143
@ XN_NODE_TYPE_SCRIPT
Definition: XnTypes.h:144
@ XN_NODE_TYPE_DEVICE
Definition: XnTypes.h:105
@ XN_NODE_TYPE_IR
Definition: XnTypes.h:117
@ XN_NODE_TYPE_IMAGE
Definition: XnTypes.h:111
@ XN_NODE_TYPE_AUDIO
Definition: XnTypes.h:114
@ XN_NODE_TYPE_CODEC
Definition: XnTypes.h:138
@ XN_NODE_TYPE_PRODUCTION_NODE
Definition: XnTypes.h:141
@ XN_NODE_TYPE_GENERATOR
Definition: XnTypes.h:142
@ XN_NODE_TYPE_GESTURE
Definition: XnTypes.h:129
@ XN_NODE_TYPE_RECORDER
Definition: XnTypes.h:123
@ XN_NODE_TYPE_USER
Definition: XnTypes.h:120
@ XN_NODE_TYPE_SCENE
Definition: XnTypes.h:132
#define XN_BUILD_VERSION
Definition: XnVersion.h:39
#define XN_MAJOR_VERSION
Definition: XnVersion.h:33
#define XN_MINOR_VERSION
Definition: XnVersion.h:35
#define XN_MAINTENANCE_VERSION
Definition: XnVersion.h:37
Definition: XnModuleCppInterface.h:47
Definition: XnModuleCppInterface.h:151
XN_C_API XnStatus XN_C_DECL xnRegisterModuleWithOpenNI(XnOpenNIModuleInterface *pInterface, const XnChar *strConfigDir, const XnChar *strName)
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: XnCppWrapper.h:34
Definition: XnModuleInterface.h:1326
Definition: XnModuleInterface.h:1341
Definition: XnModuleInterface.h:1039
Definition: XnModuleInterface.h:412
Definition: XnModuleInterface.h:585
Definition: XnModuleInterface.h:1171
Definition: XnModuleInterface.h:1214
Definition: XnModuleInterface.h:1156
Definition: XnModuleInterface.h:1099
Definition: XnModuleInterface.h:897
Definition: XnModuleInterface.h:727
Definition: XnModuleInterface.h:325
Definition: XnModuleInterface.h:711
Definition: XnModuleInterface.h:1197
Definition: XnModuleInterface.h:1352
Definition: XnModuleInterface.h:1298
Definition: XnModuleInterface.h:70
Definition: XnTypes.h:154
XnUInt8 nMinor
Definition: XnTypes.h:156
XnUInt8 nMajor
Definition: XnTypes.h:155
XnUInt16 nMaintenance
Definition: XnTypes.h:157
XnUInt32 nBuild
Definition: XnTypes.h:158