OpenNI 1.5.4: xn::ScriptNode Class Reference

OpenNI

#include <XnCppWrapper.h>

Inheritance diagram for xn::ScriptNode:

List of all members.

Public Member Functions

 ScriptNode (XnNodeHandle hNode=NULL)
 ScriptNode (const NodeWrapper &other)
XnStatus Create (Context &context, const XnChar *strFormat)
const XnChar * GetSupportedFormat ()
XnStatus LoadScriptFromFile (const XnChar *strFileName)
XnStatus LoadScriptFromString (const XnChar *strScript)
XnStatus Run (EnumerationErrors *pErrors)

Detailed Description

Purpose: The ScriptNode object loads an XML script from a file or string, and then runs the XML script to build a production graph. It also references every node created from that script, so it wouldn't be destroyed.

Remarks:

A typical usage of a script node is:

Note that the context's RunXmlScriptFromFile() or RunXmlScript() methods can be used to perform all above steps.

All production nodes in the production graph use reference count to determine their life time, but if an application executed a script, it can't know upfront which nodes will be created by this script, and so, can't take reference to them, so those nodes might be destroyed immediately. The script node, apart from executing the script, also keeps reference to all the nodes created by the script. This means that if the script node is destroyed, every production node that was created by the script, and is unreferenced by the application will also be destroyed. For this reason, it is recommended for application using XML scripts to keep a reference to the script node as long as they keep a reference to the context itself.

A single ScriptNode object is responsible for building the entire production graph, irrespective of however many node definitions there are in the XML script and how many production nodes are created.

For additional information about XML scripts, see Xml Scripts.


Constructor & Destructor Documentation

xn::ScriptNode::ScriptNode ( XnNodeHandle  hNode = NULL) [inline]

Ctor

Parameters:
[in]hNodeNode handle
xn::ScriptNode::ScriptNode ( const NodeWrapper other) [inline]

Member Function Documentation

XnStatus xn::ScriptNode::Create ( Context context,
const XnChar *  strFormat 
) [inline]
const XnChar* xn::ScriptNode::GetSupportedFormat ( ) [inline]
XnStatus xn::ScriptNode::LoadScriptFromFile ( const XnChar *  strFileName) [inline]

Loads an XML script file into the ScriptNode object.

Parameters:
[in]strFileNameName of file containing an XML script.
XnStatus xn::ScriptNode::LoadScriptFromString ( const XnChar *  strScript) [inline]

Loads an XML script string into the ScriptNode object.

Parameters:
[in]strScriptString containing an XML script.
XnStatus xn::ScriptNode::Run ( EnumerationErrors pErrors) [inline]

Runs the ScriptNode object's XML script to build a production graph.

Parameters:
[out]pErrorsList of enumeration errors produced during method execution.

Remarks

This method causes the whole production graph to enter Generating state. To read data you have to run one of the 'Update Data' methods of the Context or of the node itself.


The documentation for this class was generated from the following file:
Generated on Wed May 16 2012 10:16:07 for OpenNI 1.5.4 by   doxygen 1.7.5.1