OpenNI 1.5.7
XnContext.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * *
3 * OpenNI 1.x Alpha *
4 * Copyright (C) 2012 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * Licensed under the Apache License, Version 2.0 (the "License"); *
9 * you may not use this file except in compliance with the License. *
10 * You may obtain a copy of the License at *
11 * *
12 * http://www.apache.org/licenses/LICENSE-2.0 *
13 * *
14 * Unless required by applicable law or agreed to in writing, software *
15 * distributed under the License is distributed on an "AS IS" BASIS, *
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17 * See the License for the specific language governing permissions and *
18 * limitations under the License. *
19 * *
20 *****************************************************************************/
21 #ifndef __XN_CONTEXT_H__
22 #define __XN_CONTEXT_H__
23 
77 //---------------------------------------------------------------------------
78 // Includes
79 //---------------------------------------------------------------------------
80 #include <XnTypes.h>
81 #include <XnQueries.h>
82 #include <XnPrdNodeInfoList.h>
83 
84 //---------------------------------------------------------------------------
85 // Functions
86 //---------------------------------------------------------------------------
87 
100 XN_C_API XnStatus XN_C_DECL xnInit(XnContext** ppContext);
101 
111 XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptFromFileEx(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
112 
124 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptFromFileEx() instead") xnContextRunXmlScriptFromFile(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors);
125 
135 XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptEx(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
136 
148 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptEx() instead") XN_C_DECL xnContextRunXmlScript(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors);
149 
159 XN_C_API XnStatus XN_C_DECL xnInitFromXmlFileEx(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
160 
172 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnInitFromXmlFileEx() instead") XN_C_DECL xnInitFromXmlFile(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors);
173 
181 XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecordingEx(XnContext* pContext, const XnChar* strFileName, XnNodeHandle* phPlayerNode);
182 
193 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextOpenFileRecordingEx() instead") XN_C_DECL xnContextOpenFileRecording(XnContext* pContext, const XnChar* strFileName);
194 
200 XN_C_API XnStatus XN_C_DECL xnContextAddRef(XnContext* pContext);
201 
208 XN_C_API void XN_C_DECL xnContextRelease(XnContext* pContext);
209 
218 XN_C_API void XN_API_DEPRECATED("Use xnContextRelease() instead") XN_C_DECL xnShutdown(XnContext* pContext);
219 
226 XN_C_API void XN_C_DECL xnForceShutdown(XnContext* pContext);
227 
232 XN_C_API XnStatus XN_C_DECL xnContextRegisterForShutdown(XnContext* pContext, XnContextShuttingDownHandler pHandler, void* pCookie, XnCallbackHandle* phCallback);
233 
238 XN_C_API void XN_C_DECL xnContextUnregisterFromShutdown(XnContext* pContext, XnCallbackHandle hCallback);
239 
240 // @}
241 
258  XnContext* pContext,
259  XnProductionNodeType Type,
260  const XnNodeQuery* pQuery,
261  XnNodeInfoList** ppTreesList,
262  XnEnumerationErrors* pErrors
263  );
264 
274  XnContext* pContext,
275  XnNodeInfo* pTree,
276  XnNodeHandle* phNode
277  );
278 
291  XnContext* pContext,
293  XnNodeQuery* pQuery,
294  XnNodeHandle* phNode,
295  XnEnumerationErrors* pErrors
296  );
297 
310  XnContext* pContext,
312  const XnChar* strName,
313  XnNodeHandle* phNode
314  );
315 
328  XnContext* pContext,
329  XnNodeHandle hOriginalNode,
330  const XnChar* strName,
331  XnNodeHandle* phMockNode
332  );
333 
340 
347 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnProductionNodeAddRef() instead.") XN_C_DECL xnRefProductionNode(XnNodeHandle hNode);
348 
355 XN_C_API void XN_C_DECL xnProductionNodeRelease(XnNodeHandle hNode);
356 
364 XN_C_API void XN_API_DEPRECATED("Please use xnProductionNodeRelease() instead.") XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode);
365 
373 XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodes(XnContext* pContext, XnNodeInfoList** ppList);
374 
384 
393  XnContext* pContext,
395  XnNodeHandle* phNode
396  );
397 
398 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnFindExistingRefNodeByType() instead") XN_C_DECL xnFindExistingNodeByType(
399  XnContext* pContext,
401  XnNodeHandle* phNode
402  );
403 
414  XnContext* pContext,
415  const XnChar* strInstanceName,
416  XnNodeHandle* phNode
417  );
418 
419 XN_C_API XnStatus XN_API_DEPRECATED("Please use xnGetRefNodeHandleByName() instead") XN_C_DECL xnGetNodeHandleByName(
420  XnContext* pContext,
421  const XnChar* strInstanceName,
422  XnNodeHandle* phNode
423  );
424 
425 // @}
426 
437 XN_C_API XnStatus XN_C_DECL xnWaitAndUpdateAll(XnContext* pContext);
438 
445 XN_C_API XnStatus XN_C_DECL xnWaitOneUpdateAll(XnContext* pContext, XnNodeHandle hNode);
446 
452 XN_C_API XnStatus XN_C_DECL xnWaitAnyUpdateAll(XnContext* pContext);
453 
460 XN_C_API XnStatus XN_C_DECL xnWaitNoneUpdateAll(XnContext* pContext);
461 
467 XN_C_API XnStatus XN_C_DECL xnStartGeneratingAll(XnContext* pContext);
468 
474 XN_C_API XnStatus XN_C_DECL xnStopGeneratingAll(XnContext* pContext);
475 
483 XN_C_API XnStatus XN_C_DECL xnSetGlobalMirror(XnContext* pContext, XnBool bMirror);
484 
490 XN_C_API XnBool XN_C_DECL xnGetGlobalMirror(XnContext* pContext);
491 
499 XN_C_API XnStatus XN_C_DECL xnGetGlobalErrorState(XnContext* pContext);
500 
510  (XnContext* pContext, XnErrorStateChangedHandler handler,
511  void* pCookie, XnCallbackHandle* phCallback);
512 
520  (XnContext* pContext, XnCallbackHandle hCallback);
521 
531  (XnContext* pContext, XnNodeCreationHandler handler,
532  void* pCookie, XnCallbackHandle* phCallback);
533 
541  (XnContext* pContext, XnCallbackHandle hCallback);
542 
552  (XnContext* pContext, XnNodeDestructionHandler handler,
553  void* pCookie, XnCallbackHandle* phCallback);
554 
562  (XnContext* pContext, XnCallbackHandle hCallback);
563 
565 
568 #endif // __XN_CONTEXT_H__
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 xnWaitAnyUpdateAll(XnContext *pContext)
Updates all generators nodes in the context, once any of them have new data.
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 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...
struct XnEnumerationErrors XnEnumerationErrors
Definition: XnTypes.h:216
XN_C_API XnStatus XN_C_DECL xnGetNodeHandleByName(XnContext *pContext, const XnChar *strInstanceName, XnNodeHandle *phNode)
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 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 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 xnInitFromXmlFileEx(const XnChar *strFileName, XnContext **ppContext, XnEnumerationErrors *pErrors, XnNodeHandle *phScriptNode)
Initializes OpenNI context, and then configures it using the given file.
XN_C_API XnStatus XN_C_DECL xnFindExistingNodeByType(XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
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 xnSetGlobalMirror(XnContext *pContext, XnBool bMirror)
Sets the global mirror flag. This will set all current existing nodes&#39; mirror state, and also affect future created nodes. The default mirror flag is FALSE.
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 XnStatus XN_C_DECL xnStopGeneratingAll(XnContext *pContext)
Stop all generators from generating data.
void(* XnNodeCreationHandler)(XnContext *pContext, XnNodeHandle hCreatedNode, void *pCookie)
Definition: XnTypes.h:258
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 xnRegisterToGlobalErrorStateChange(XnContext *pContext, XnErrorStateChangedHandler handler, void *pCookie, XnCallbackHandle *phCallback)
Registers a callback function to global error state changes.
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...
XnUInt32 XnStatus
Definition: XnStatus.h:33
XN_C_API XnStatus XN_C_DECL xnContextAddRef(XnContext *pContext)
Adds a reference to the context object.
XnInt32 XnProductionNodeType
Definition: XnTypes.h:94
XN_C_API XnStatus XN_C_DECL xnRegisterToNodeCreation(XnContext *pContext, XnNodeCreationHandler handler, void *pCookie, XnCallbackHandle *phCallback)
Registers a callback function to &#39;Node Creation&#39; event. This event is raised whenever node are create...
struct XnInternalNodeData * XnNodeHandle
Definition: XnTypes.h:84
struct XnNodeInfoList XnNodeInfoList
Definition: XnTypes.h:189
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...
#define XN_C_API
Definition: XnPlatform.h:123
XN_C_API void XN_C_DECL xnUnregisterFromGlobalErrorStateChange(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToGlobalErrorStateChange().
XN_C_API XnStatus XN_C_DECL xnInit(XnContext **ppContext)
Initializes the OpenNI library.
void * XnCallbackHandle
Definition: XnTypes.h:270
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...
struct XnNodeQuery XnNodeQuery
Definition: XnTypes.h:199
struct XnNodeInfo XnNodeInfo
Definition: XnTypes.h:179
void(* XnNodeDestructionHandler)(XnContext *pContext, const XnChar *strDestroyedNodeName, void *pCookie)
Definition: XnTypes.h:267
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 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 xnWaitNoneUpdateAll(XnContext *pContext)
Updates all generator nodes in the context, without any waiting. If a node has new data...
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 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 xnRefProductionNode(XnNodeHandle hNode)
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 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 xnStartGeneratingAll(XnContext *pContext)
Make sure all generators are generating data.
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 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...
void(* XnErrorStateChangedHandler)(XnStatus errorState, void *pCookie)
Definition: XnTypes.h:237
XN_C_API XnStatus XN_C_DECL xnProductionNodeAddRef(XnNodeHandle hNode)
References a production node, increasing its reference count by 1.
XN_C_API void XN_C_DECL xnUnregisterFromNodeCreation(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToNodeCreation().
XN_C_API void XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode)
void(* XnContextShuttingDownHandler)(XnContext *pContext, void *pCookie)
Definition: XnTypes.h:246
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 xnEnumerateExistingNodes(XnContext *pContext, XnNodeInfoList **ppList)
Gets a list of all existing node in the context. Each node that was returned increases its ref count...
struct XnContext XnContext
Definition: XnTypes.h:79
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 xnRegisterToNodeDestruction(XnContext *pContext, XnNodeDestructionHandler handler, void *pCookie, XnCallbackHandle *phCallback)
Registers a callback function to &#39;Node Destruction&#39; event. This event is raised whenever a node is de...
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 XnBool XN_C_DECL xnGetGlobalMirror(XnContext *pContext)
Gets the global mirror flag.
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 void XN_C_DECL xnContextRelease(XnContext *pContext)
Releases a context object, decreasing its ref count by 1. If reference count has reached 0...