本文整理汇总了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);
}
示例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