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();
273 return _XN_MODULE_INST->GetExportedNodesCount();
278 return _XN_MODULE_INST->GetExportedNodes(aEntryPoints, nCount);
289#if !XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS
#define XN_IS_STATUS_OK(x)
Definition: XnMacros.h:60
void(* GetInterfaceFuncPtr)(void *pInterface)
Definition: XnModuleCppRegistratration.h:137
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_UNLOAD()
Definition: XnModuleCppRegistratration.h:266
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_ENTRY_POINTS(XnModuleGetExportedInterfacePtr *aEntryPoints, XnUInt32 nCount)
Definition: XnModuleCppRegistratration.h:276
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_LOAD()
Definition: XnModuleCppRegistratration.h:256
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_GET_OPEN_NI_VERSION(XnVersion *pVersion)
Definition: XnModuleCppRegistratration.h:281
XN_MODULE_FUNC_TYPE XnUInt32 XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_COUNT()
Definition: XnModuleCppRegistratration.h:271
#define XN_MODULE_FUNC_TYPE
Definition: XnModuleCppRegistratration.h:252
void(* XnModuleGetExportedInterfacePtr)(XnModuleExportedProductionNodeInterface *pInterface)
Definition: XnModuleInterface.h:63
XnUInt32 XnStatus
Definition: XnStatus.h:34
#define XN_STATUS_OK
Definition: XnStatus.h:37
void * XnModuleNodeHandle
Definition: XnTypes.h:219
XnInt32 XnProductionNodeType
Definition: XnTypes.h:92
@ XN_NODE_TYPE_PLAYER
Definition: XnTypes.h:124
@ XN_NODE_TYPE_DEPTH
Definition: XnTypes.h:106
@ XN_NODE_TYPE_HANDS
Definition: XnTypes.h:133
@ XN_NODE_TYPE_MAP_GENERATOR
Definition: XnTypes.h:141
@ XN_NODE_TYPE_SCRIPT
Definition: XnTypes.h:142
@ XN_NODE_TYPE_DEVICE
Definition: XnTypes.h:103
@ XN_NODE_TYPE_IR
Definition: XnTypes.h:115
@ XN_NODE_TYPE_IMAGE
Definition: XnTypes.h:109
@ XN_NODE_TYPE_AUDIO
Definition: XnTypes.h:112
@ XN_NODE_TYPE_CODEC
Definition: XnTypes.h:136
@ XN_NODE_TYPE_PRODUCTION_NODE
Definition: XnTypes.h:139
@ XN_NODE_TYPE_GENERATOR
Definition: XnTypes.h:140
@ XN_NODE_TYPE_GESTURE
Definition: XnTypes.h:127
@ XN_NODE_TYPE_RECORDER
Definition: XnTypes.h:121
@ XN_NODE_TYPE_USER
Definition: XnTypes.h:118
@ XN_NODE_TYPE_SCENE
Definition: XnTypes.h:130
#define XN_BUILD_VERSION
Definition: XnVersion.h:40
#define XN_MAJOR_VERSION
Definition: XnVersion.h:34
#define XN_MINOR_VERSION
Definition: XnVersion.h:36
#define XN_MAINTENANCE_VERSION
Definition: XnVersion.h:38
Definition: XnModuleCppInterface.h:48
Definition: XnModuleCppInterface.h:152
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:35
Definition: XnModuleInterface.h:1315
Definition: XnModuleInterface.h:1330
Definition: XnModuleInterface.h:1028
Definition: XnModuleInterface.h:413
Definition: XnModuleInterface.h:574
Definition: XnModuleInterface.h:1160
Definition: XnModuleInterface.h:1203
Definition: XnModuleInterface.h:1145
Definition: XnModuleInterface.h:1088
Definition: XnModuleInterface.h:886
Definition: XnModuleInterface.h:716
Definition: XnModuleInterface.h:326
Definition: XnModuleInterface.h:700
Definition: XnModuleInterface.h:1186
Definition: XnModuleInterface.h:1341
Definition: XnModuleInterface.h:1287
Definition: XnModuleInterface.h:71
Definition: XnTypes.h:152
XnUInt8 nMinor
Definition: XnTypes.h:154
XnUInt8 nMajor
Definition: XnTypes.h:153
XnUInt16 nMaintenance
Definition: XnTypes.h:155
XnUInt32 nBuild
Definition: XnTypes.h:156