Queries
C Reference

## Functions

XN_C_API XnStatus XN_C_DECL | xnNodeQueryAllocate (XnNodeQuery **ppQuery)
XN_C_API void XN_C_DECL | xnNodeQueryFree (XnNodeQuery *pQuery)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetVendor (XnNodeQuery *pQuery, const XnChar *strVendor)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetName (XnNodeQuery *pQuery, const XnChar *strName)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetMinVersion (XnNodeQuery *pQuery, const XnVersion *pMinVersion)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetMaxVersion (XnNodeQuery *pQuery, const XnVersion *pMaxVersion)
XN_C_API XnStatus XN_C_DECL | xnNodeQueryAddSupportedCapability (XnNodeQuery *pQuery, const XnChar *strNeededCapability)
XN_C_API XnStatus XN_C_DECL | xnNodeQueryAddSupportedMapOutputMode (XnNodeQuery *pQuery, const XnMapOutputMode *pMapOutputMode)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetSupportedMinUserPositions (XnNodeQuery *pQuery, const XnUInt32 nCount)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetExistingNodeOnly (XnNodeQuery *pQuery, XnBool bExistingNode)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetNonExistingNodeOnly (XnNodeQuery *pQuery, XnBool bNonExistingNode)
XN_C_API XnStatus XN_C_DECL | xnNodeQueryAddNeededNode (XnNodeQuery *pQuery, const XnChar *strInstanceName)
XN_C_API XnStatus XN_C_DECL | xnNodeQuerySetCreationInfo (XnNodeQuery *pQuery, const XnChar *strCreationInfo)
XN_C_API XnStatus XN_C_DECL | xnNodeQueryFilterList (XnContext *pContext, const XnNodeQuery *pQuery, XnNodeInfoList *pList)

## Detailed Description

This page details functions for building queries. Queries can be used during enumeration, and provide an easy way for filtering results before they return to user.

## Function Documentation

## xnNodeQueryAddNeededNode()

XN_C_API XnStatus XN_C_DECL xnNodeQueryAddNeededNode | ( | XnNodeQuery * | pQuery,
|  | const XnChar * | strInstanceName )

Adds a needed node.

Parameters

  pQuery | [in] Query object.
  strInstanceName | [in] The name of the needed instance.

## xnNodeQueryAddSupportedCapability()

XN_C_API XnStatus XN_C_DECL xnNodeQueryAddSupportedCapability | ( | XnNodeQuery * | pQuery,
|  | const XnChar * | strNeededCapability )

Adds a capability that the node must support. Note that for checking if a capability is supported, the node must be created (if it's not an existing one). This operation might take a bit longer...

Parameters

  pQuery | [in] Query object.
  strNeededCapability | [in] A needed capability name.

## xnNodeQueryAddSupportedMapOutputMode()

XN_C_API XnStatus XN_C_DECL xnNodeQueryAddSupportedMapOutputMode | ( | XnNodeQuery * | pQuery,
|  | const XnMapOutputMode * | pMapOutputMode )

Adds a MapOutputMode that the node must support. Note that for checking if a capability is supported, the node must be created (if it's not an existing one). This operation might take a bit longer...

Parameters

  pQuery | [in] Query object.
  pMapOutputMode | [in] A map output mode. Each field of the mode can be set to (-1), meaning results will not be filtered by this field.

## xnNodeQueryAllocate()

XN_C_API XnStatus XN_C_DECL xnNodeQueryAllocate | ( | XnNodeQuery ** | ppQuery | ) |

Allocates a new query object. This object must be freed using xnNodeQueryFree().

Parameters

  ppQuery | [out] Created query object.

## xnNodeQueryFilterList()

XN_C_API XnStatus XN_C_DECL xnNodeQueryFilterList | ( | XnContext * | pContext,
|  | const XnNodeQuery * | pQuery,
|  | XnNodeInfoList * | pList )

Filters a list of nodes according to query. The list will contain only nodes that match all query terms. Note that some query terms might require creation of a node, and thus may take longer.

Parameters

  pContext | [in] OpenNI Context object.
  pQuery | [in] Query object.
  pList | [in] The list to be filtered.

## xnNodeQueryFree()

XN_C_API void XN_C_DECL xnNodeQueryFree | ( | XnNodeQuery * | pQuery | ) |

Frees a query object previously created using xnNodeQueryAllocate().

Parameters

  pQuery | [in] Query object.

## xnNodeQuerySetCreationInfo()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetCreationInfo | ( | XnNodeQuery * | pQuery,
|  | const XnChar * | strCreationInfo )

Sets the creation info field of a query object.

Parameters

  pQuery | [in] Query object.
  strCreationInfo | [in] The creation info to set in the query.

## xnNodeQuerySetExistingNodeOnly()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetExistingNodeOnly | ( | XnNodeQuery * | pQuery,
|  | XnBool | bExistingNode )

Filter results so that only existing nodes will be returned.

Parameters

  pQuery | [in] Query object.
  bExistingNode | [in] TRUE to return only existing ones, FALSE otherwise.

## xnNodeQuerySetMaxVersion()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetMaxVersion | ( | XnNodeQuery * | pQuery,
|  | const XnVersion * | pMaxVersion )

Sets the maximum required version.

Parameters

  pQuery | [in] Query object.
  pMaxVersion | [in] Max Version.

## xnNodeQuerySetMinVersion()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetMinVersion | ( | XnNodeQuery * | pQuery,
|  | const XnVersion * | pMinVersion )

Sets the minimum required version.

Parameters

  pQuery | [in] Query object.
  pMinVersion | [in] Min Version.

## xnNodeQuerySetName()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetName | ( | XnNodeQuery * | pQuery,
|  | const XnChar * | strName )

Sets the requested name.

Parameters

  pQuery | [in] Query object.
  strName | [in] Product Name.

## xnNodeQuerySetNonExistingNodeOnly()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetNonExistingNodeOnly | ( | XnNodeQuery * | pQuery,
|  | XnBool | bNonExistingNode )

Filter results so that only non-existing nodes will be returned.

Parameters

  pQuery | [in] Query object.
  bNonExistingNode | [in] TRUE to return only non-existing ones, FALSE otherwise.

## xnNodeQuerySetSupportedMinUserPositions()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetSupportedMinUserPositions | ( | XnNodeQuery * | pQuery,
|  | const XnUInt32 | nCount )

Sets the minimum required user positions this node supports. Note that for checking if a capability is supported, the node must be created (if it's not an existing one). This operation might take a bit longer...

Parameters

  pQuery | [in] Query object.
  nCount | [in] The number of required positions.

## xnNodeQuerySetVendor()

XN_C_API XnStatus XN_C_DECL xnNodeQuerySetVendor | ( | XnNodeQuery * | pQuery,
|  | const XnChar * | strVendor )

Sets the requested vendor.

Parameters

  pQuery | [in] Query object.
  strVendor | [in] Vendor Name.