OpenNI 1.5.4
Public Member Functions | List of all members
xn::ScriptNode Class Reference

#include <XnCppWrapper.h>

Inheritance diagram for xn::ScriptNode:
Inheritance graph
[legend]

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)
- Public Member Functions inherited from xn::ProductionNode
 ProductionNode (XnNodeHandle hNode=NULL)
 ProductionNode (const NodeWrapper &other)
NodeInfo GetInfo () const
XnStatus AddNeededNode (ProductionNode &needed)
XnStatus RemoveNeededNode (ProductionNode &needed)
void GetContext (Context &context) const
Context GetContext () const
XnBool IsCapabilitySupported (const XnChar *strCapabilityName) const
XnStatus SetIntProperty (const XnChar *strName, XnUInt64 nValue)
XnStatus SetRealProperty (const XnChar *strName, XnDouble dValue)
XnStatus SetStringProperty (const XnChar *strName, const XnChar *strValue)
XnStatus SetGeneralProperty (const XnChar *strName, XnUInt32 nBufferSize, const void *pBuffer)
XnStatus GetIntProperty (const XnChar *strName, XnUInt64 &nValue) const
XnStatus GetRealProperty (const XnChar *strName, XnDouble &dValue) const
XnStatus GetStringProperty (const XnChar *strName, XnChar *csValue, XnUInt32 nBufSize) const
XnStatus GetGeneralProperty (const XnChar *strName, XnUInt32 nBufferSize, void *pBuffer) const
XnStatus LockForChanges (XnLockHandle *phLock)
void UnlockForChanges (XnLockHandle hLock)
XnStatus LockedNodeStartChanges (XnLockHandle hLock)
void LockedNodeEndChanges (XnLockHandle hLock)
const ErrorStateCapability GetErrorStateCap () const
ErrorStateCapability GetErrorStateCap ()
GeneralIntCapability GetGeneralIntCap (const XnChar *strCapability)
- Public Member Functions inherited from xn::NodeWrapper
 NodeWrapper (XnNodeHandle hNode)
 NodeWrapper (const NodeWrapper &other)
NodeWrapperoperator= (const NodeWrapper &other)
 ~NodeWrapper ()
 operator XnNodeHandle () const
XnNodeHandle GetHandle () const
XnBool operator== (const NodeWrapper &other)
XnBool operator!= (const NodeWrapper &other)
XnBool IsValid () const
const XnChar * GetName () const
XnStatus AddRef ()
void Release ()
void SetHandle (XnNodeHandle hNode)
void TakeOwnership (XnNodeHandle hNode)

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: