当前位置: 首页>>代码示例>>C++>>正文


C++ NodeInfoList::IsEmpty方法代码示例

本文整理汇总了C++中xn::NodeInfoList::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeInfoList::IsEmpty方法的具体用法?C++ NodeInfoList::IsEmpty怎么用?C++ NodeInfoList::IsEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xn::NodeInfoList的用法示例。


在下文中一共展示了NodeInfoList::IsEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EnumerateProductionTrees

XnStatus XnExportedSensorGenerator::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
{
	XnStatus nRetVal = XN_STATUS_OK;

	XnProductionNodeDescription Description;
	GetDescription(&Description);

	// perform a query to be sure the device we'll find is the same one exported from this DLL.
	xn::Query query;
	query.SetVendor(XN_VENDOR_PRIMESENSE);
	query.SetName(XN_DEVICE_NAME);
	query.SetMinVersion(Description.Version);
	query.SetMaxVersion(Description.Version);

	nRetVal = context.AutoEnumerateOverSingleInput(TreesList, Description, NULL, XN_NODE_TYPE_DEVICE, pErrors, &query);
	XN_IS_STATUS_OK(nRetVal);

	if (!m_bIsAvailableInLowBand)
	{
		xn::NodeInfoList::Iterator it = TreesList.Begin();
		while (it != TreesList.End())
		{
			xn::NodeInfoList::Iterator curr = it;
			it++;

			xn::NodeInfo node = *curr;

			// take sensor node
			xn::NodeInfo sensorNode = *node.GetNeededNodes().Begin();

			XnBool bIsLowBand;
			nRetVal = XnSensorIO::IsSensorLowBandwidth(sensorNode.GetCreationInfo(), &bIsLowBand);
			XN_IS_STATUS_OK(nRetVal);

			if (bIsLowBand)
			{
				// sensor is low band
				nRetVal = TreesList.Remove(curr);
				XN_IS_STATUS_OK(nRetVal);
			}
		}

		if (TreesList.IsEmpty())
		{
			return XN_STATUS_NO_NODE_PRESENT;
		}
	}
	
	return (XN_STATUS_OK);
}
开发者ID:marshally,项目名称:Sensor,代码行数:50,代码来源:XnExportedSensorGenerator.cpp

示例2: EnumerateProductionTrees

XnStatus XnExportedSensorImageGenerator::EnumerateProductionTrees(xn::Context& context, xn::NodeInfoList& TreesList, xn::EnumerationErrors* pErrors)
{
	XnStatus nRetVal = XN_STATUS_OK;
	
	nRetVal = XnExportedSensorGenerator::EnumerateProductionTrees(context, TreesList, pErrors);
	XN_IS_STATUS_OK(nRetVal);

	XnStringToBoolHash Devices;

	// make sure device has image CMOS
	xn::NodeInfoList::Iterator it = TreesList.Begin();
	while (it != TreesList.End())
	{
		xn::NodeInfoList::Iterator curr = it;
		it++;

		xn::NodeInfo node = *curr;

		// take sensor node
		xn::NodeInfo sensorNode = *node.GetNeededNodes().Begin();

		XnBool bHasImageCMOS = TRUE;

		if (XN_STATUS_OK != Devices.Get(sensorNode.GetCreationInfo(), bHasImageCMOS))
		{
			// wasn't checked yet. check it now
			xn::Device sensor;
			nRetVal = sensorNode.GetInstance(sensor);
			XN_IS_STATUS_OK(nRetVal);

			XnBool bShouldCreated = (!sensor.IsValid());

			if (bShouldCreated)
			{
				nRetVal = context.CreateProductionTree(sensorNode);
				XN_IS_STATUS_OK(nRetVal);

				nRetVal = sensorNode.GetInstance(sensor);
				XN_IS_STATUS_OK(nRetVal);
			}

			// This is an ugly patch to find out if this sensor has an image CMOS. It will be fixed
			// in future firmwares so we can just ask.
			XnCmosBlankingUnits units;
			units.nCmosID = XN_CMOS_TYPE_IMAGE;
			nRetVal = sensor.GetGeneralProperty(XN_MODULE_PROPERTY_CMOS_BLANKING_UNITS, sizeof(units), &units);
			if (nRetVal != XN_STATUS_OK || units.nUnits == 0)
			{
				// Failed. this means no image CMOS
				bHasImageCMOS = FALSE;
			}

			if (bShouldCreated)
			{
				sensor.Release();
			}

			// add to checked list
			Devices.Set(sensorNode.GetCreationInfo(), bHasImageCMOS);
		}

		if (!bHasImageCMOS)
		{
			// remove it from enumeration
			nRetVal = TreesList.Remove(curr);
			XN_IS_STATUS_OK(nRetVal);
		}
	}

	if (TreesList.IsEmpty())
	{
		return XN_STATUS_NO_NODE_PRESENT;
	}
	
	return (XN_STATUS_OK);
}
开发者ID:izim,项目名称:Sensor,代码行数:76,代码来源:XnSensorImageGenerator.cpp


注:本文中的xn::NodeInfoList::IsEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。