 |
OpenNI 1.5.7
|
Go to the documentation of this file.
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
302 #endif // __XN_MODULE_CPP_REGISTRATION_H__
Definition: XnModuleInterface.h:1097
Definition: XnModuleInterface.h:1350
Definition: XnModuleCppInterface.h:63
Definition: XnTypes.h:140
Definition: XnTypes.h:119
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_ENTRY_POINTS(XnModuleGetExportedInterfacePtr *aEntryPoints, XnUInt32 nCount)
Definition: XnModuleCppRegistratration.h:274
#define XN_IS_STATUS_OK(x)
Definition: XnMacros.h:58
#define XN_STATUS_OK
Definition: XnStatus.h:35
Definition: XnTypes.h:131
Definition: XnModuleInterface.h:68
XN_MODULE_FUNC_TYPE XnUInt32 XN_C_DECL XN_MODULE_GET_EXPORTED_NODES_COUNT()
Definition: XnModuleCppRegistratration.h:269
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_UNLOAD()
Definition: XnModuleCppRegistratration.h:264
XnUInt16 nMaintenance
Definition: XnTypes.h:156
Definition: XnTypes.h:143
void * XnModuleNodeHandle
Definition: XnTypes.h:220
XnUInt8 nMajor
Definition: XnTypes.h:154
Definition: XnTypes.h:137
XnUInt32 XnStatus
Definition: XnStatus.h:32
#define XN_MAINTENANCE_VERSION
Definition: XnVersion.h:36
Definition: XnModuleInterface.h:1169
void(* GetInterfaceFuncPtr)(void *pInterface)
Definition: XnModuleCppRegistratration.h:135
#define XN_MAJOR_VERSION
Definition: XnVersion.h:32
Definition: XnModuleInterface.h:1195
Definition: XnTypes.h:107
Definition: XnTypes.h:152
Definition: XnModuleInterface.h:1324
Definition: XnCppWrapper.h:32
Definition: XnModuleInterface.h:1037
Definition: XnModuleInterface.h:1212
Definition: XnModuleCppInterface.h:167
XN_MODULE_FUNC_TYPE XnStatus XN_C_DECL XN_MODULE_LOAD()
Definition: XnModuleCppRegistratration.h:254
Definition: XnTypes.h:116
Definition: XnModuleInterface.h:1296
XN_MODULE_FUNC_TYPE void XN_C_DECL XN_MODULE_GET_OPEN_NI_VERSION(XnVersion *pVersion)
Definition: XnModuleCppRegistratration.h:279
Definition: XnModuleInterface.h:1339
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.
#define XN_BUILD_VERSION
Definition: XnVersion.h:38
XnInt32 XnProductionNodeType
Definition: XnTypes.h:93
Definition: XnTypes.h:122
#define XN_MINOR_VERSION
Definition: XnVersion.h:34
Definition: XnTypes.h:142
#define XN_MODULE_FUNC_TYPE
Definition: XnModuleCppRegistratration.h:250
Definition: XnTypes.h:104
Definition: XnTypes.h:128
Definition: XnModuleInterface.h:709
XnUInt8 nMinor
Definition: XnTypes.h:155
Definition: XnTypes.h:110
Definition: XnModuleInterface.h:323
void(* XnModuleGetExportedInterfacePtr)(XnModuleExportedProductionNodeInterface *pInterface)
Definition: XnModuleInterface.h:61
XN_C_API XnStatus XN_C_DECL xnRegisterModuleWithOpenNI(XnOpenNIModuleInterface *pInterface, const XnChar *strConfigDir, const XnChar *strName)
XnUInt32 nBuild
Definition: XnTypes.h:157
Definition: XnModuleInterface.h:725
Definition: XnTypes.h:113
Definition: XnTypes.h:134
Definition: XnModuleInterface.h:1154
Definition: XnModuleInterface.h:895
Definition: XnTypes.h:141
Definition: XnModuleInterface.h:583
Definition: XnModuleInterface.h:410
Definition: XnTypes.h:125