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


C++ XnActualGeneralProperty::SetAsBufferOwner方法代码示例

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


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

示例1: Add

XnStatus XnActualPropertiesHash::Add(XnUInt32 propertyId, const XnChar* strName, const OniGeneralBuffer& gbValue)
{
	XnStatus nRetVal = XN_STATUS_OK;

	Iterator it = End();
	if (XN_STATUS_OK == Find(propertyId, it))
	{
		return XN_STATUS_DEVICE_PROPERTY_ALREADY_EXISTS;
	}

	// create buffer
	OniGeneralBuffer gbNew;
	nRetVal = XnGeneralBufferAlloc(&gbNew, gbValue.dataSize);
	XN_IS_STATUS_OK(nRetVal);

	// copy content
	xnOSMemCopy(gbNew.data, gbValue.data, gbValue.dataSize);

	// create property
	XnActualGeneralProperty* pProp;
	XN_VALIDATE_NEW(pProp, XnActualGeneralProperty, propertyId, strName, gbNew, NULL, m_strName);

	pProp->SetAsBufferOwner(TRUE);

	// and add it to the hash
	nRetVal = m_Hash.Set(propertyId, pProp);
	if (nRetVal != XN_STATUS_OK)
	{
		XN_DELETE(pProp);
		return (nRetVal);
	}

	return (XN_STATUS_OK);
}
开发者ID:1170390,项目名称:OpenNI2,代码行数:34,代码来源:XnActualPropertiesHash.cpp

示例2: CreateProperty

XnStatus XnDeviceModuleHolder::CreateProperty(XnProperty* pRequestProp)
{
	XnStatus nRetVal = XN_STATUS_OK;

	XnProperty* pNewProp = NULL;

	switch (pRequestProp->GetType())
	{
	case XN_PROPERTY_TYPE_INTEGER:
		{
			XnActualIntProperty* pProp = (XnActualIntProperty*)pRequestProp;
			XN_VALIDATE_NEW(pNewProp, XnActualIntProperty, pProp->GetName(), pProp->GetValue());
			break;
		}
	case XN_PROPERTY_TYPE_REAL:
		{
			XnActualRealProperty* pProp = (XnActualRealProperty*)pRequestProp;
			XN_VALIDATE_NEW(pNewProp, XnActualRealProperty, pProp->GetName(), pProp->GetValue());
			break;
		}
	case XN_PROPERTY_TYPE_STRING:
		{
			XnActualStringProperty* pProp = (XnActualStringProperty*)pRequestProp;
			XN_VALIDATE_NEW(pNewProp, XnActualStringProperty, pProp->GetName(), pProp->GetValue());
			break;
		}
	case XN_PROPERTY_TYPE_GENERAL:
		{
			XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)pRequestProp;

			// create new buffer
			XnGeneralBuffer gbNew;
			nRetVal = XnGeneralBufferAlloc(&gbNew, pProp->GetValue().nDataSize);
			XN_IS_STATUS_OK(nRetVal);

			// copy content
			xnOSMemCopy(gbNew.pData, pProp->GetValue().pData, pProp->GetValue().nDataSize);

			XnActualGeneralProperty* pNewGeneralProp = NULL;
			XN_VALIDATE_NEW(pNewGeneralProp, XnActualGeneralProperty, pProp->GetName(), gbNew);
			pNewGeneralProp->SetAsBufferOwner(TRUE);
			pNewProp = pNewGeneralProp;
			break;
		}
	default:
		XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d\n", pRequestProp->GetType());
	} // switch

	// add the property to the module
	nRetVal = m_pModule->AddProperty(pNewProp);
	if (nRetVal != XN_STATUS_OK)
	{
		XN_DELETE(pNewProp);
		return (nRetVal);
	}

	// and add it to the list of allocated ones (so we'll delete it afterwards)
	m_Allocated.AddLast(pNewProp);

	return XN_STATUS_OK;
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:61,代码来源:XnDeviceModuleHolder.cpp


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