OpenNI 1.5.4
XnContext.h
Go to the documentation of this file.
1/****************************************************************************
2* *
3* OpenNI 1.x Alpha *
4* Copyright (C) 2011 PrimeSense Ltd. *
5* *
6* This file is part of OpenNI. *
7* *
8* OpenNI is free software: you can redistribute it and/or modify *
9* it under the terms of the GNU Lesser General Public License as published *
10* by the Free Software Foundation, either version 3 of the License, or *
11* (at your option) any later version. *
12* *
13* OpenNI is distributed in the hope that it will be useful, *
14* but WITHOUT ANY WARRANTY; without even the implied warranty of *
15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16* GNU Lesser General Public License for more details. *
17* *
18* You should have received a copy of the GNU Lesser General Public License *
19* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
20* *
21****************************************************************************/
22#ifndef __XN_CONTEXT_H__
23#define __XN_CONTEXT_H__
24
78//---------------------------------------------------------------------------
79// Includes
80//---------------------------------------------------------------------------
81#include <XnTypes.h>
82#include <XnQueries.h>
83#include <XnPrdNodeInfoList.h>
84
85//---------------------------------------------------------------------------
86// Functions
87//---------------------------------------------------------------------------
88
101XN_C_API XnStatus XN_C_DECL xnInit(XnContext** ppContext);
102
112XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptFromFileEx(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
113
125XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptFromFileEx() instead") xnContextRunXmlScriptFromFile(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors);
126
136XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptEx(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
137
149XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptEx() instead") XN_C_DECL xnContextRunXmlScript(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors);
150
160XN_C_API XnStatus XN_C_DECL xnInitFromXmlFileEx(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
161
173XN_C_API XnStatus XN_API_DEPRECATED("Please use xnInitFromXmlFileEx() instead") XN_C_DECL xnInitFromXmlFile(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors);
174
182XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecordingEx(XnContext* pContext, const XnChar* strFileName, XnNodeHandle* phPlayerNode);
183
194XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextOpenFileRecordingEx() instead") XN_C_DECL xnContextOpenFileRecording(XnContext* pContext, const XnChar* strFileName);
195
202
209XN_C_API void XN_C_DECL xnContextRelease(XnContext* pContext);
210
219XN_C_API void XN_API_DEPRECATED("Use xnContextRelease() instead") XN_C_DECL xnShutdown(XnContext* pContext);
220
227XN_C_API void XN_C_DECL xnForceShutdown(XnContext* pContext);
228
234
240
241// @}
242
259 XnContext* pContext,
261 const XnNodeQuery* pQuery,
262 XnNodeInfoList** ppTreesList,
263 XnEnumerationErrors* pErrors
264 );
265
275 XnContext* pContext,
276 XnNodeInfo* pTree,
277 XnNodeHandle* phNode
278 );
279
292 XnContext* pContext,
294 XnNodeQuery* pQuery,
295 XnNodeHandle* phNode,
296 XnEnumerationErrors* pErrors
297 );
298
311 XnContext* pContext,
313 const XnChar* strName,
314 XnNodeHandle* phNode
315 );
316
329 XnContext* pContext,
330 XnNodeHandle hOriginalNode,
331 const XnChar* strName,
332 XnNodeHandle* phMockNode
333 );
334
341
348XN_C_API XnStatus XN_API_DEPRECATED("Please use xnProductionNodeAddRef() instead.") XN_C_DECL xnRefProductionNode(XnNodeHandle hNode);
349
357
365XN_C_API void XN_API_DEPRECATED("Please use xnProductionNodeRelease() instead.") XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode);
366
375
385
394 XnContext* pContext,
396 XnNodeHandle* phNode
397 );
398
399XN_C_API XnStatus XN_API_DEPRECATED("Please use xnFindExistingRefNodeByType() instead") XN_C_DECL xnFindExistingNodeByType(
400 XnContext* pContext,
402 XnNodeHandle* phNode
403 );
404
415 XnContext* pContext,
416 const XnChar* strInstanceName,
417 XnNodeHandle* phNode
418 );
419
420XN_C_API XnStatus XN_API_DEPRECATED("Please use xnGetRefNodeHandleByName() instead") XN_C_DECL xnGetNodeHandleByName(
421 XnContext* pContext,
422 const XnChar* strInstanceName,
423 XnNodeHandle* phNode
424 );
425
426// @}
427
439
447
454
462
469
476
484XN_C_API XnStatus XN_C_DECL xnSetGlobalMirror(XnContext* pContext, XnBool bMirror);
485
491XN_C_API XnBool XN_C_DECL xnGetGlobalMirror(XnContext* pContext);
492
501
511 (XnContext* pContext, XnErrorStateChangedHandler handler,
512 void* pCookie, XnCallbackHandle* phCallback);
513
521 (XnContext* pContext, XnCallbackHandle hCallback);
522
532 (XnContext* pContext, XnNodeCreationHandler handler,
533 void* pCookie, XnCallbackHandle* phCallback);
534
542 (XnContext* pContext, XnCallbackHandle hCallback);
543
553 (XnContext* pContext, XnNodeDestructionHandler handler,
554 void* pCookie, XnCallbackHandle* phCallback);
555
563 (XnContext* pContext, XnCallbackHandle hCallback);
564
566
569#endif // __XN_CONTEXT_H__
#define XN_C_API
Definition XnPlatform.h:132
XnUInt32 XnStatus
Definition XnStatus.h:34
void(* XnNodeCreationHandler)(XnContext *pContext, XnNodeHandle hCreatedNode, void *pCookie)
Definition XnTypes.h:256
void * XnCallbackHandle
Definition XnTypes.h:268
struct XnNodeInfoList XnNodeInfoList
Definition XnTypes.h:187
void(* XnContextShuttingDownHandler)(XnContext *pContext, void *pCookie)
Definition XnTypes.h:244
void(* XnErrorStateChangedHandler)(XnStatus errorState, void *pCookie)
Definition XnTypes.h:235
struct XnNodeInfo XnNodeInfo
Definition XnTypes.h:177
XnInt32 XnProductionNodeType
Definition XnTypes.h:92
struct XnNodeQuery XnNodeQuery
Definition XnTypes.h:197
struct XnInternalNodeData * XnNodeHandle
Definition XnTypes.h:82
void(* XnNodeDestructionHandler)(XnContext *pContext, const XnChar *strDestroyedNodeName, void *pCookie)
Definition XnTypes.h:265
struct XnContext XnContext
Definition XnTypes.h:77
XN_C_API void XN_C_DECL xnUnregisterFromNodeCreation(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToNodeCreation().
XN_C_API XnStatus XN_C_DECL xnRegisterToNodeCreation(XnContext *pContext, XnNodeCreationHandler handler, void *pCookie, XnCallbackHandle *phCallback)
Registers a callback function to 'Node Creation' event. This event is raised whenever node are create...
XN_C_API XnStatus XN_C_DECL xnCreateMockNodeBasedOn(XnContext *pContext, XnNodeHandle hOriginalNode, const XnChar *strName, XnNodeHandle *phMockNode)
Creates a production node which is only a mock, base on the type and properties of another node....
XN_C_API XnStatus XN_C_DECL xnWaitAndUpdateAll(XnContext *pContext)
Updates all generators nodes in the context, waiting for all to have new data.
XN_C_API XnStatus XN_C_DECL xnFindExistingNodeByType(XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL xnContextRunXmlScript(XnContext *pContext, const XnChar *xmlScript, XnEnumerationErrors *pErrors)
Runs an XML script in the given context. NOTE: when using this function, the context will be the owne...
XN_C_API XnStatus XN_C_DECL xnInit(XnContext **ppContext)
Initializes the OpenNI library.
XN_C_API XnStatus XN_C_DECL xnWaitAnyUpdateAll(XnContext *pContext)
Updates all generators nodes in the context, once any of them have new data.
XN_C_API XnStatus XN_C_DECL xnFindExistingRefNodeByType(XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
Returns the first found existing node of the specified type.
XN_C_API void XN_C_DECL xnUnregisterFromGlobalErrorStateChange(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToGlobalErrorStateChange().
XN_C_API void XN_C_DECL xnContextRelease(XnContext *pContext)
Releases a context object, decreasing its ref count by 1. If reference count has reached 0,...
XN_C_API XnStatus XN_C_DECL xnGetNodeHandleByName(XnContext *pContext, const XnChar *strInstanceName, XnNodeHandle *phNode)
XN_C_API XnStatus XN_C_DECL xnWaitNoneUpdateAll(XnContext *pContext)
Updates all generator nodes in the context, without any waiting. If a node has new data,...
XN_C_API void XN_C_DECL xnProductionNodeRelease(XnNodeHandle hNode)
Unreference a production node, decreasing its reference count by 1. If the reference count reaches ze...
XN_C_API XnStatus XN_C_DECL xnStartGeneratingAll(XnContext *pContext)
Make sure all generators are generating data.
XN_C_API XnStatus XN_C_DECL xnInitFromXmlFile(const XnChar *strFileName, XnContext **ppContext, XnEnumerationErrors *pErrors)
Initializes OpenNI context, and then configures it using the given file. NOTE: when using this functi...
XN_C_API XnStatus XN_C_DECL xnRefProductionNode(XnNodeHandle hNode)
XN_C_API XnStatus XN_C_DECL xnCreateMockNode(XnContext *pContext, XnProductionNodeType type, const XnChar *strName, XnNodeHandle *phNode)
Creates a production node which is only a mock. This node does not represent an actual node,...
XN_C_API XnStatus XN_C_DECL xnContextAddRef(XnContext *pContext)
Adds a reference to the context object.
XN_C_API XnBool XN_C_DECL xnGetGlobalMirror(XnContext *pContext)
Gets the global mirror flag.
XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptFromFileEx(XnContext *pContext, const XnChar *strFileName, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
Runs an XML script in the given context.
XN_C_API XnStatus XN_C_DECL xnCreateProductionTree(XnContext *pContext, XnNodeInfo *pTree, XnNodeHandle *phNode)
Creates a production node. If the tree specifies additional needed nodes, and those nodes do not exis...
XN_C_API void XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode)
XN_C_API XnStatus XN_C_DECL xnContextRegisterForShutdown(XnContext *pContext, XnContextShuttingDownHandler pHandler, void *pCookie, XnCallbackHandle *phCallback)
Registers for context shutting down event. This function is used for backwards compatibility and shou...
XN_C_API void XN_C_DECL xnContextUnregisterFromShutdown(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters from context shutting down event. This function is used for backwards compatibility and s...
XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptEx(XnContext *pContext, const XnChar *xmlScript, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
Runs an XML script in the given context.
XN_C_API XnStatus XN_C_DECL xnCreateAnyProductionTree(XnContext *pContext, XnProductionNodeType type, XnNodeQuery *pQuery, XnNodeHandle *phNode, XnEnumerationErrors *pErrors)
Enumerates for production trees for a specific node type, and creates the first found tree....
XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecording(XnContext *pContext, const XnChar *strFileName)
Opens a recording file, adding all nodes in it to the context. NOTE: when using this function,...
XN_C_API XnStatus XN_C_DECL xnStopGeneratingAll(XnContext *pContext)
Stop all generators from generating data.
XN_C_API void XN_C_DECL xnUnregisterFromNodeDestruction(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToNodeDestruction().
XN_C_API XnStatus XN_C_DECL xnInitFromXmlFileEx(const XnChar *strFileName, XnContext **ppContext, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
Initializes OpenNI context, and then configures it using the given file.
XN_C_API void XN_C_DECL xnShutdown(XnContext *pContext)
Shuts down an OpenNI context, destroying all its nodes. Do not call any function of this context or a...
XN_C_API void XN_C_DECL xnForceShutdown(XnContext *pContext)
Forces a context to shutdown, destroying all nodes. This function is used for backwards compatibility...
XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodesByType(XnContext *pContext, XnProductionNodeType type, XnNodeInfoList **ppList)
Gets a list of all existing node in the context. Each node that was returned increases its ref count....
XN_C_API XnStatus XN_C_DECL xnGetRefNodeHandleByName(XnContext *pContext, const XnChar *strInstanceName, XnNodeHandle *phNode)
Gets a handle to an existing production node instance using that instance name.
XN_C_API XnStatus xnContextRunXmlScriptFromFile(XnContext *pContext, const XnChar *strFileName, XnEnumerationErrors *pErrors)
Runs an XML script in the given context. NOTE: when using this function, the context will be the owne...
XN_C_API XnStatus XN_C_DECL xnGetGlobalErrorState(XnContext *pContext)
Gets the global error state of the context. If one of the nodes in the context is in error state,...
XN_C_API XnStatus XN_C_DECL xnEnumerateProductionTrees(XnContext *pContext, XnProductionNodeType Type, const XnNodeQuery *pQuery, XnNodeInfoList **ppTreesList, XnEnumerationErrors *pErrors)
Enumerates all available production trees for a specific node type. The trees populated in the list s...
XN_C_API XnStatus XN_C_DECL xnRegisterToGlobalErrorStateChange(XnContext *pContext, XnErrorStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
Registers a callback function to global error state changes.
XN_C_API XnStatus XN_C_DECL xnRegisterToNodeDestruction(XnContext *pContext, XnNodeDestructionHandler handler, void *pCookie, XnCallbackHandle *phCallback)
Registers a callback function to 'Node Destruction' event. This event is raised whenever a node is de...
XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecordingEx(XnContext *pContext, const XnChar *strFileName, XnNodeHandle *phPlayerNode)
Opens a recording file, adding all nodes in it to the context.
XN_C_API XnStatus XN_C_DECL xnWaitOneUpdateAll(XnContext *pContext, XnNodeHandle hNode)
Updates all generators nodes in the context, waiting for a specific one to have new data.
XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodes(XnContext *pContext, XnNodeInfoList **ppList)
Gets a list of all existing node in the context. Each node that was returned increases its ref count....
XN_C_API XnStatus XN_C_DECL xnProductionNodeAddRef(XnNodeHandle hNode)
References a production node, increasing its reference count by 1.
XN_C_API XnStatus XN_C_DECL xnSetGlobalMirror(XnContext *pContext, XnBool bMirror)
Sets the global mirror flag. This will set all current existing nodes' mirror state,...
struct XnEnumerationErrors XnEnumerationErrors
Definition XnTypes.h:214