XnContext.h
Go to the documentation of this file.
/****************************************************************************
* *
* OpenNI 1.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* OpenNI is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* OpenNI is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
* *
****************************************************************************/
#ifndef __XN_CONTEXT_H__
#define __XN_CONTEXT_H__
//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include <XnTypes.h>
#include <XnQueries.h>
#include <XnPrdNodeInfoList.h>
//---------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------
XN_C_API XnStatus XN_C_DECL xnInit(XnContext** ppContext);
XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptFromFileEx(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptFromFileEx() instead") xnContextRunXmlScriptFromFile(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors);
XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptEx(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptEx() instead") XN_C_DECL xnContextRunXmlScript(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors);
XN_C_API XnStatus XN_C_DECL xnInitFromXmlFileEx(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnInitFromXmlFileEx() instead") XN_C_DECL xnInitFromXmlFile(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors);
XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecordingEx(XnContext* pContext, const XnChar* strFileName, XnNodeHandle* phPlayerNode);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextOpenFileRecordingEx() instead") XN_C_DECL xnContextOpenFileRecording(XnContext* pContext, const XnChar* strFileName);
XN_C_API XnStatus XN_C_DECL xnContextAddRef(XnContext* pContext);
XN_C_API void XN_C_DECL xnContextRelease(XnContext* pContext);
XN_C_API void XN_API_DEPRECATED("Use xnContextRelease() instead") XN_C_DECL xnShutdown(XnContext* pContext);
XN_C_API void XN_C_DECL xnForceShutdown(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnContextRegisterForShutdown(XnContext* pContext, XnContextShuttingDownHandler pHandler, void* pCookie, XnCallbackHandle* phCallback);
XN_C_API void XN_C_DECL xnContextUnregisterFromShutdown(XnContext* pContext, XnCallbackHandle hCallback);
// @}
XN_C_API XnStatus XN_C_DECL xnEnumerateProductionTrees(
XnContext* pContext,
XnProductionNodeType Type,
const XnNodeQuery* pQuery,
XnNodeInfoList** ppTreesList,
XnEnumerationErrors* pErrors
);
XN_C_API XnStatus XN_C_DECL xnCreateProductionTree(
XnContext* pContext,
XnNodeInfo* pTree,
XnNodeHandle* phNode
);
XN_C_API XnStatus XN_C_DECL xnCreateAnyProductionTree(
XnContext* pContext,
XnProductionNodeType type,
XnNodeQuery* pQuery,
XnNodeHandle* phNode,
XnEnumerationErrors* pErrors
);
XN_C_API XnStatus XN_C_DECL xnCreateMockNode(
XnContext* pContext,
XnProductionNodeType type,
const XnChar* strName,
XnNodeHandle* phNode
);
XN_C_API XnStatus XN_C_DECL xnCreateMockNodeBasedOn(
XnContext* pContext,
XnNodeHandle hOriginalNode,
const XnChar* strName,
XnNodeHandle* phMockNode
);
XN_C_API XnStatus XN_C_DECL xnProductionNodeAddRef(XnNodeHandle hNode);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnProductionNodeAddRef() instead.") XN_C_DECL xnRefProductionNode(XnNodeHandle hNode);
XN_C_API void XN_C_DECL xnProductionNodeRelease(XnNodeHandle hNode);
XN_C_API void XN_API_DEPRECATED("Please use xnProductionNodeRelease() instead.") XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode);
XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodes(XnContext* pContext, XnNodeInfoList** ppList);
XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodesByType(XnContext* pContext, XnProductionNodeType type, XnNodeInfoList** ppList);
XN_C_API XnStatus XN_C_DECL xnFindExistingRefNodeByType(
XnContext* pContext,
XnProductionNodeType type,
XnNodeHandle* phNode
);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnFindExistingRefNodeByType() instead") XN_C_DECL xnFindExistingNodeByType(
XnContext* pContext,
XnProductionNodeType type,
XnNodeHandle* phNode
);
XN_C_API XnStatus XN_C_DECL xnGetRefNodeHandleByName(
XnContext* pContext,
const XnChar* strInstanceName,
XnNodeHandle* phNode
);
XN_C_API XnStatus XN_API_DEPRECATED("Please use xnGetRefNodeHandleByName() instead") XN_C_DECL xnGetNodeHandleByName(
XnContext* pContext,
const XnChar* strInstanceName,
XnNodeHandle* phNode
);
// @}
XN_C_API XnStatus XN_C_DECL xnWaitAndUpdateAll(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnWaitOneUpdateAll(XnContext* pContext, XnNodeHandle hNode);
XN_C_API XnStatus XN_C_DECL xnWaitAnyUpdateAll(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnWaitNoneUpdateAll(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnStartGeneratingAll(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnStopGeneratingAll(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnSetGlobalMirror(XnContext* pContext, XnBool bMirror);
XN_C_API XnBool XN_C_DECL xnGetGlobalMirror(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnGetGlobalErrorState(XnContext* pContext);
XN_C_API XnStatus XN_C_DECL xnRegisterToGlobalErrorStateChange
(XnContext* pContext, XnErrorStateChangedHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
XN_C_API void XN_C_DECL xnUnregisterFromGlobalErrorStateChange
(XnContext* pContext, XnCallbackHandle hCallback);
XN_C_API XnStatus XN_C_DECL xnRegisterToNodeCreation
(XnContext* pContext, XnNodeCreationHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
XN_C_API void XN_C_DECL xnUnregisterFromNodeCreation
(XnContext* pContext, XnCallbackHandle hCallback);
XN_C_API XnStatus XN_C_DECL xnRegisterToNodeDestruction
(XnContext* pContext, XnNodeDestructionHandler handler,
void* pCookie, XnCallbackHandle* phCallback);
XN_C_API void XN_C_DECL xnUnregisterFromNodeDestruction
(XnContext* pContext, XnCallbackHandle hCallback);
#endif // __XN_CONTEXT_H__
XN_C_API
#define XN_C_API
Definition XnPlatform.h:132
XnPrdNodeInfoList.h
XnQueries.h
XnStatus
XnUInt32 XnStatus
Definition XnStatus.h:34
XnTypes.h
XnNodeCreationHandler
void(* XnNodeCreationHandler)(XnContext *pContext, XnNodeHandle hCreatedNode, void *pCookie)
Definition XnTypes.h:256
XnCallbackHandle
void * XnCallbackHandle
Definition XnTypes.h:268
XnNodeInfoList
struct XnNodeInfoList XnNodeInfoList
Definition XnTypes.h:187
XnContextShuttingDownHandler
void(* XnContextShuttingDownHandler)(XnContext *pContext, void *pCookie)
Definition XnTypes.h:244
XnErrorStateChangedHandler
void(* XnErrorStateChangedHandler)(XnStatus errorState, void *pCookie)
Definition XnTypes.h:235
XnNodeInfo
struct XnNodeInfo XnNodeInfo
Definition XnTypes.h:177
XnProductionNodeType
XnInt32 XnProductionNodeType
Definition XnTypes.h:92
XnNodeQuery
struct XnNodeQuery XnNodeQuery
Definition XnTypes.h:197
XnNodeHandle
struct XnInternalNodeData * XnNodeHandle
Definition XnTypes.h:82
XnNodeDestructionHandler
void(* XnNodeDestructionHandler)(XnContext *pContext, const XnChar *strDestroyedNodeName, void *pCookie)
Definition XnTypes.h:265
XnContext
struct XnContext XnContext
Definition XnTypes.h:77
xnUnregisterFromNodeCreation
XN_C_API void XN_C_DECL xnUnregisterFromNodeCreation(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToNodeCreation().
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...
xnCreateMockNodeBasedOn
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....
xnWaitAndUpdateAll
XN_C_API XnStatus XN_C_DECL xnWaitAndUpdateAll(XnContext *pContext)
Updates all generators nodes in the context, waiting for all to have new data.
xnFindExistingNodeByType
XN_C_API XnStatus XN_C_DECL xnFindExistingNodeByType(XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
xnContextRunXmlScript
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...
xnInit
XN_C_API XnStatus XN_C_DECL xnInit(XnContext **ppContext)
Initializes the OpenNI library.
xnWaitAnyUpdateAll
XN_C_API XnStatus XN_C_DECL xnWaitAnyUpdateAll(XnContext *pContext)
Updates all generators nodes in the context, once any of them have new data.
xnFindExistingRefNodeByType
XN_C_API XnStatus XN_C_DECL xnFindExistingRefNodeByType(XnContext *pContext, XnProductionNodeType type, XnNodeHandle *phNode)
Returns the first found existing node of the specified type.
xnUnregisterFromGlobalErrorStateChange
XN_C_API void XN_C_DECL xnUnregisterFromGlobalErrorStateChange(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToGlobalErrorStateChange().
xnContextRelease
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,...
xnGetNodeHandleByName
XN_C_API XnStatus XN_C_DECL xnGetNodeHandleByName(XnContext *pContext, const XnChar *strInstanceName, XnNodeHandle *phNode)
xnWaitNoneUpdateAll
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,...
xnProductionNodeRelease
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...
xnStartGeneratingAll
XN_C_API XnStatus XN_C_DECL xnStartGeneratingAll(XnContext *pContext)
Make sure all generators are generating data.
xnInitFromXmlFile
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...
xnRefProductionNode
XN_C_API XnStatus XN_C_DECL xnRefProductionNode(XnNodeHandle hNode)
xnCreateMockNode
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,...
xnContextAddRef
XN_C_API XnStatus XN_C_DECL xnContextAddRef(XnContext *pContext)
Adds a reference to the context object.
xnGetGlobalMirror
XN_C_API XnBool XN_C_DECL xnGetGlobalMirror(XnContext *pContext)
Gets the global mirror flag.
xnContextRunXmlScriptFromFileEx
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.
xnCreateProductionTree
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...
xnUnrefProductionNode
XN_C_API void XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode)
xnContextRegisterForShutdown
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...
xnContextUnregisterFromShutdown
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...
xnContextRunXmlScriptEx
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.
xnCreateAnyProductionTree
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....
xnContextOpenFileRecording
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,...
xnStopGeneratingAll
XN_C_API XnStatus XN_C_DECL xnStopGeneratingAll(XnContext *pContext)
Stop all generators from generating data.
xnUnregisterFromNodeDestruction
XN_C_API void XN_C_DECL xnUnregisterFromNodeDestruction(XnContext *pContext, XnCallbackHandle hCallback)
Unregisters a callback function which was registered using xnRegisterToNodeDestruction().
xnInitFromXmlFileEx
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.
xnShutdown
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...
xnForceShutdown
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...
xnEnumerateExistingNodesByType
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....
xnGetRefNodeHandleByName
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.
xnContextRunXmlScriptFromFile
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...
xnGetGlobalErrorState
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,...
xnEnumerateProductionTrees
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...
xnRegisterToGlobalErrorStateChange
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.
xnRegisterToNodeDestruction
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...
xnContextOpenFileRecordingEx
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.
xnWaitOneUpdateAll
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.
xnEnumerateExistingNodes
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....
xnProductionNodeAddRef
XN_C_API XnStatus XN_C_DECL xnProductionNodeAddRef(XnNodeHandle hNode)
References a production node, increasing its reference count by 1.
xnSetGlobalMirror
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,...
XnEnumerationErrors
struct XnEnumerationErrors XnEnumerationErrors
Definition XnTypes.h:214