|
| Context () |
|
| Context (XnContext *pContext) |
|
| Context (const Context &other) |
|
| ~Context () |
|
Context & | operator= (const Context &other) |
|
XnContext * | GetUnderlyingObject () const |
|
XnBool | operator== (const Context &other) |
|
XnBool | operator!= (const Context &other) |
|
XnStatus | Init () |
|
XnStatus | RunXmlScript (const XnChar *strScript, ScriptNode &scriptNode, EnumerationErrors *pErrors=NULL) |
|
XnStatus | RunXmlScriptFromFile (const XnChar *strFileName, ScriptNode &scriptNode, EnumerationErrors *pErrors=NULL) |
|
XnStatus | InitFromXmlFile (const XnChar *strFileName, ScriptNode &scriptNode, EnumerationErrors *pErrors=NULL) |
|
XnStatus | OpenFileRecording (const XnChar *strFileName, ProductionNode &playerNode) |
|
XnStatus | CreateMockNode (XnProductionNodeType type, const XnChar *strName, ProductionNode &mockNode) |
|
XnStatus | CreateMockNodeBasedOn (ProductionNode &originalNode, const XnChar *strName, ProductionNode &mockNode) |
|
XnStatus | CreateCodec (XnCodecID codecID, ProductionNode &initializerNode, Codec &codec) |
|
XnStatus | AddRef () |
|
void | Release () |
|
XnStatus | AddLicense (const XnLicense &License) |
|
XnStatus | EnumerateLicenses (XnLicense *&aLicenses, XnUInt32 &nCount) const |
|
XnStatus | EnumerateProductionTrees (XnProductionNodeType Type, const Query *pQuery, NodeInfoList &TreesList, EnumerationErrors *pErrors=NULL) const |
|
XnStatus | CreateAnyProductionTree (XnProductionNodeType type, Query *pQuery, ProductionNode &node, EnumerationErrors *pErrors=NULL) |
|
XnStatus | CreateProductionTree (NodeInfo &Tree, ProductionNode &node) |
|
XnStatus | EnumerateExistingNodes (NodeInfoList &list) const |
|
XnStatus | EnumerateExistingNodes (NodeInfoList &list, XnProductionNodeType type) const |
|
XnStatus | FindExistingNode (XnProductionNodeType type, ProductionNode &node) const |
|
XnStatus | GetProductionNodeByName (const XnChar *strInstanceName, ProductionNode &node) const |
|
XnStatus | GetProductionNodeInfoByName (const XnChar *strInstanceName, NodeInfo &nodeInfo) const |
|
XnStatus | StartGeneratingAll () |
|
XnStatus | StopGeneratingAll () |
|
XnStatus | SetGlobalMirror (XnBool bMirror) |
|
XnBool | GetGlobalMirror () |
|
XnStatus | GetGlobalErrorState () |
|
XnStatus | RegisterToErrorStateChange (XnErrorStateChangedHandler handler, void *pCookie, XnCallbackHandle &hCallback) |
|
void | UnregisterFromErrorStateChange (XnCallbackHandle hCallback) |
|
XnStatus | RegisterToNodeCreation (NodeCreationHandler handler, void *pCookie, XnCallbackHandle &hCallback) |
|
void | UnregisterFromNodeCreation (XnCallbackHandle hCallback) |
|
XnStatus | RegisterToNodeDestruction (NodeDestructionHandler handler, void *pCookie, XnCallbackHandle &hCallback) |
|
void | UnregisterFromNodeDestruction (XnCallbackHandle hCallback) |
|
XnStatus | WaitAndUpdateAll () |
|
XnStatus | WaitAnyUpdateAll () |
|
XnStatus | WaitOneUpdateAll (ProductionNode &node) |
|
XnStatus | WaitNoneUpdateAll () |
|
XnStatus | AutoEnumerateOverSingleInput (NodeInfoList &List, XnProductionNodeDescription &description, const XnChar *strCreationInfo, XnProductionNodeType InputType, EnumerationErrors *pErrors, Query *pQuery=NULL) const |
|
void | SetHandle (XnContext *pContext) |
|
void | TakeOwnership (XnContext *pContext) |
|
A context is a workspace where the application builds an OpenNI production graph. It contains methods for managing the production graph.
In order to use any of the OpenNI functionality you must first construct a Context object and initialize it. Prior to this, the application cannot do anything with OpenNI.
For a comprehensive overview to the Context class and its members, see Overview to Contexts.
Event: 'Global Error State Change'
Signals that the error state of any of the nodes has changed.
This event can be used by the application to get a signal as soon as any error occurs in one of the production nodes. The global error state aggregates error state from all the production nodes in the context.
Use RegisterToErrorStateChange() and UnregisterFromErrorStateChange() for using this event.
Event: 'Node Creation'
Signals that a new node was created in the context production graph.
Use RegisterToNodeCreation() and UnregisterFromNodeCreation() for using this event.
Event: 'Node Destruction'
Signals that a node was removed from the context production graph, and destroyed.
Use RegisterToNodeDestruction() and UnregisterFromNodeDestruction() for using this event.
Enumerates for production nodes of a specific node type, and creates the first production node found of that type.
- Parameters
-
[in] | type | Requested node type. |
[in] | pQuery | Optional. A query object that can be used to filter results. |
[out] | node | Handle to the newly created node. |
[in,out] | pErrors | Optional. To contain enumeration errors. |
Remarks:
This method is a 'shortcut' version of using the EnumerateProductionTrees() method and then passing the first result to CreateProductionTree(). Thus, this method is exactly like the Create() method for nodes.
Other ways of creating a production graph let the application retrieve a complete list of alternatives and then choose the most appropriate alternative.
This method is the method used by the above XML script methods to create the ProductionNode objects. The XML method runs the XML script, and for each node description the XML method runs this function to create that node.
Using this function is called 'creating a node from the context'. You can also create a node by invoking the Create method of the node itself, e.g., the Create() method of a HandsGenerator node.
By default, this method does not enable the production nodes to start generating data immediately on creation.
- See Also
- Understanding the Create() method for more detail.
Returns a list of the context's existing created nodes filtered by type.
- Parameters
-
[in] | list | List of the context's existing created nodes. |
[in] | type | Type to enumerate for. |
Remarks
Returns the list after filtering them by type, so it returns a list of the created nodes of the specific type only.
An example of a typical case of returning a list of two nodes of the same type is where there are two sensors in a 3D set-up and you need to retrieve the corresponding two depth nodes to generate data from them.
You can use the xn::NodeInfoList::FilterList() method to filter the returned list of existing nodes.
Enumerates all available production nodes for a specific node type (e.g., the application wants to create a depth generator node) and returns a full list of matching production nodes.
- Parameters
-
[in] | Type | Requested node type. |
[in] | pQuery | Optional. A query object that can be used to filter results. |
[out] | TreesList | List of possible production nodes. |
[out] | pErrors | Optional. To contain enumeration errors. |
Remarks:
The application chooses one of the nodes from the node list returned by this method and uses it as input to the xn::Context::CreateProductionTree() method to create a new production node.
Using this method to help create a production node offers the greatest flexibility since it returns a complete list of matching production nodes and so the application can then choose the most suitable node.
By contrast, using CreateAnyProductionTree() or a node's Create() method creates a node from the first matching node that satisfies the query.
Searches for an existing created node of a specified type and returns a reference to it.
- Parameters
-
[in] | type | Type of node to search for. |
[out] | node | Reference to an existing created node that was found. |
Remarks
This method returns only the first node it finds; this method does not return the entire list of matching nodes. Compare this with the xn::Context::EnumerateExistingNodes() method, which returns the entire list of matching nodes. A typical usage is that the application already created all the nodes from XML. Then, when it needs to start generating data from a particular node, e.g., the skeleton data, it will call FindExistingNode specifying the skeleton type, and it will get it and start using it.
This method does not provide a query parameter (compare with xn::Context::EnumerateExistingNodes).
Builds the context's general software environment.
This method initializes runtime variables and data structures, and examines all registered plug-ins to learn the purpose and specific capabilities of each. In particular, during initialization the context initialization examines all registered plug-ins to learn the purpose and specific capabilities of each. For example, one plug-in is for creating a skeleton node, and another plug-in is for creating a depth node. Thus an entire database is built of plug-ins that can be queried according to vendor, model, and capabilities of each.
Once you have completed the initialization you can create nodes that are based on the plug-ins that OpenNI has discovered by this initialization process.
XnStatus xn::Context::WaitAndUpdateAll |
( |
| ) |
|
|
inline |
Updates all generator nodes in the context to their latest available data, first waiting for all nodes to have new data available.
Remarks
This method requests from OpenNI to cause all nodes in the context's Production Graph that have new data available to update their application buffers with the new data, each node updating its own application buffer.
Before OpenNI causes the data updates, it waits until all the nodes have notified that they have new data available. On receiving all the 'new data available' notifications, OpenNI then causes all nodes with new data available to update their application buffers with their new data. At this stage the generator nodes have "generated" new data. This method then stops waiting and returns a success status. The application can now read the newly generated data.
- Note
- Using this method is not recommended for most applications since it requires all the nodes to have new data. Consider instead using WaitAnyUpdateAll() or WaitOneUpdateAll(). Typical applications use the WaitAnyUpdateAll() method.
An error situation is defined as: after a preset timeout, not all nodes have yet notified OpenNI they have new data available. On error, the method stops waiting and returns an error status. None of the nodes update their application buffers.
See 'Wait and Update' Methods for an overview to the 'WaitXUpdateAll' methods and how to read the data from the nodes.
- Return values
-
XN_STATUS_WAIT_DATA_TIMEOUT | No new data available within 2 seconds. |
XnStatus xn::Context::WaitAnyUpdateAll |
( |
| ) |
|
|
inline |
Updates all generator nodes in the context to their latest available data, first waiting for any of the nodes to have new data available.
- Note
- Typical applications use this method. Consider using this method for your application.
Remarks
This method requests from OpenNI to cause all nodes with new data available in the context's Production Graph to update their application buffers with the new data, each node updating its own application buffer.
Before OpenNI causes the data updates, it waits for any of the nodes to have notified that it has new data available. On receiving a 'new data available' notification, OpenNI then causes all nodes with new data available to update their application buffers with their new data. At this stage the generator nodes have "generated" new data. This method then stops waiting and returns a success status. The application can now read the newly generated data.
A node that does not have new data available does not update its application buffer.
An error situation is defined as: after a preset timeout, none of the nodes have yet notified OpenNI they have new data available. On error, the method stops waiting and returns an error status. None of the nodes update their application buffers.
See 'Wait and Update' Methods for an overview to the 'WaitXUpdateAll' methods and how to read the data from the nodes.
- Return values
-
XN_STATUS_WAIT_DATA_TIMEOUT | No new data available within 2 seconds. |
XnStatus xn::Context::WaitNoneUpdateAll |
( |
| ) |
|
|
inline |
Immediately updates all generator nodes in the context to their latest available data, without waiting for notification that any node has new data available.
Remarks
This method requests from OpenNI to cause all nodes in the context's Production Graph with new data available to update their application buffers with the new data, each node updating its own application buffer.
OpenNI causes all nodes with new data available to update their application buffers with their new data. At this stage the generator nodes have "generated" new data. This method returns a success status. The application can now read the newly generated data.
A node that does not have new data available does not update its application buffer.
See 'Wait and Update' Methods for an overview to the 'WaitXUpdateAll' methods and how to read the data from the nodes.
Updates all generator nodes in the context to their latest available data, first waiting for a specified node to have new data available.
Remarks
This method requests from OpenNI to cause all nodes in the context's Production Graph with new data available to update their application buffers with the new data, each node updating its own application buffer.
Before OpenNI causes the data updates, it waits for a specified node to notify that it has new data available. On receiving the 'new data available' notification, OpenNI then causes all nodes with new data available to update their application buffers with their new data. At this stage the generator nodes have "generated" new data. This method then stops waiting and returns a success status. The application can now read the newly generated data.
A node that does not have new data available does not update its application buffer.
An error situation is defined as: after a preset timeout, none of the nodes have yet notified OpenNI they have has new data available. On error, the method stops waiting and returns an error status. None of the nodes update their application buffers.
See 'Wait and Update' Methods for an overview to the 'WaitXUpdateAll' methods and how to read the data from the nodes.
- Return values
-
XN_STATUS_WAIT_DATA_TIMEOUT | No new data available within 2 seconds. |