OpenNI 1.5.7
Enumerating possible production chains

The following code shows how to fine control the enumeration process. It enumerates Production Chains for producing User output, reducing the options using a basic query, and then chooses the first one from all possibilities.

// Build a query object
xn::Query query;
nRetVal = query.SetVendor("MyVendor");
// TODO: check error code
// TODO: check error code
// Enumerate
xn::NodeInfoList possibleChains;
nRetVal = context.EnumerateProductionTrees(XN_NODE_TYPE_USER, &query, possibleChains, NULL);
// TODO: check error code
// No errors so far. This means list has at least one item. Take the first one
xn::NodeInfo selected = *possibleChains.Begin();
// Create it
nRetVal = context.CreateProductionTree(selected);
// TODO: check error code
// Take the node
nRetVal = selected.GetInstance(userGen);
// TODO: check error code
// Now we can start to use it
XN_NODE_TYPE_USER
Definition: XnTypes.h:119
xn::UserGenerator
Definition: XnCppWrapper.h:7709
xn::Context::EnumerateProductionTrees
XnStatus EnumerateProductionTrees(XnProductionNodeType Type, const Query *pQuery, NodeInfoList &TreesList, EnumerationErrors *pErrors=NULL) const
Enumerates all available production nodes for a specific node type (e.g., the application wants to cr...
Definition: XnCppWrapper.h:8995
xn::Context::CreateProductionTree
XnStatus CreateProductionTree(NodeInfo &Tree, ProductionNode &node)
Creates a production node from the information supplied in a xn::NodeInfo object.
Definition: XnCppWrapper.h:9073
xn::Query
Definition: XnCppWrapper.h:1992
xn::NodeInfo::GetInstance
XnStatus GetInstance(ProductionNode &node) const
Definition: XnCppWrapper.h:9796
xn::NodeInfo
Definition: XnCppWrapper.h:1818
XN_CAPABILITY_SKELETON
#define XN_CAPABILITY_SKELETON
Definition: XnTypes.h:319
xn::NodeInfoList::Begin
Iterator Begin() const
Definition: XnCppWrapper.h:2353
xn::Query::SetVendor
XnStatus SetVendor(const XnChar *strVendor)
Sets in the Query object the vendor name to search for.
Definition: XnCppWrapper.h:2022
xn::NodeInfoList
Definition: XnCppWrapper.h:2160
xn::Query::AddSupportedCapability
XnStatus AddSupportedCapability(const XnChar *strNeededCapability)
Sets in the Query object a capability that the Node Alternative must support.
Definition: XnCppWrapper.h:2084