本文整理汇总了C++中XnActualPropertiesHash类的典型用法代码示例。如果您正苦于以下问题:C++ XnActualPropertiesHash类的具体用法?C++ XnActualPropertiesHash怎么用?C++ XnActualPropertiesHash使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XnActualPropertiesHash类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: streamProps
XnStatus XnDeviceBase::CreateStreams(const XnPropertySet* pSet)
{
XnStatus nRetVal = XN_STATUS_OK;
for (XnPropertySetData::ConstIterator it = pSet->pData->begin(); it != pSet->pData->end(); ++it)
{
// check if this module is a stream
XnActualPropertiesHash* pModule = it.Value();
XnActualPropertiesHash::ConstIterator itProp = pModule->end();
if (XN_STATUS_OK == pModule->Find(XN_STREAM_PROPERTY_TYPE, itProp))
{
// create a copy of the properties
XnActualPropertiesHash streamProps(it.Key());
nRetVal = streamProps.CopyFrom(*pModule);
XN_IS_STATUS_OK(nRetVal);
// remove the type property
nRetVal = streamProps.Remove(XN_STREAM_PROPERTY_TYPE);
XN_IS_STATUS_OK(nRetVal);
// and create the stream
XnActualStringProperty* pActualProp = (XnActualStringProperty*)itProp.Value();
nRetVal = CreateStreamImpl(pActualProp->GetValue(), it.Key(), &streamProps);
XN_IS_STATUS_OK(nRetVal);
}
}
return (XN_STATUS_OK);
}
开发者ID:0pascal0,项目名称:SensorKinect,代码行数:30,代码来源:XnDeviceBase.cpp
示例2: XN_IS_STATUS_OK
XnStatus XnServerSensorInvoker::RegisterToProps(XnPropertySet* pProps)
{
XnStatus nRetVal = XN_STATUS_OK;
XnCallbackHandle hDummy = NULL;
for (XnPropertySetData::Iterator itMod = pProps->pData->Begin(); itMod != pProps->pData->End(); ++itMod)
{
XnActualPropertiesHash* pHash = itMod->Value();
XnDeviceModule* pModule;
nRetVal = m_sensor.FindModule(itMod->Key(), &pModule);
XN_IS_STATUS_OK(nRetVal);
for (XnActualPropertiesHash::Iterator itProp = pHash->Begin(); itProp != pHash->End(); ++itProp)
{
XnProperty* pProp;
nRetVal = pModule->GetProperty(itProp->Key(), &pProp);
XN_IS_STATUS_OK(nRetVal);
// no need to keep the handle. We only want to unregister when the stream is destroyed, and then
// it happens anyway.
nRetVal = pProp->OnChangeEvent().Register(PropertyChangedCallback, this, hDummy);
XN_IS_STATUS_OK(nRetVal);
}
}
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:28,代码来源:XnServerSensorInvoker.cpp
示例3: XnPropertySetFindProperty
XN_DDK_API XnStatus XnPropertySetFindProperty(const XnPropertySet* pSet, const XnChar* strModule, const XnChar* strProp, XnPropertySetEnumerator** ppEnumerator)
{
XnStatus nRetVal = XN_STATUS_OK;
XN_VALIDATE_INPUT_PTR(pSet);
XN_VALIDATE_INPUT_PTR(strModule);
XN_VALIDATE_INPUT_PTR(strProp);
XN_VALIDATE_OUTPUT_PTR(ppEnumerator);
// find module
XnPropertySetData::Iterator itModule = pSet->pData->End();
nRetVal = pSet->pData->Find(strModule, itModule);
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pModule = itModule->Value();
// find property
XnActualPropertiesHash::Iterator itProp = pModule->End();
nRetVal = pModule->Find(strProp, itProp);
XN_IS_STATUS_OK(nRetVal);
// create enumerator
XnPropertySetEnumerator* pEnumer;
XN_VALIDATE_NEW(pEnumer, XnPropertySetEnumerator);
pEnumer->itModule = itModule;
pEnumer->itProp = itProp;
pEnumer->pModules = pSet->pData;
pEnumer->strModule[0] = '\0';
pEnumer->bFirst = FALSE;
*ppEnumerator = pEnumer;
return XN_STATUS_OK;
}
开发者ID:02031991,项目名称:Sensor,代码行数:35,代码来源:XnPropertySet.cpp
示例4: UnsafeSetProperties
XnStatus XnDeviceModuleHolder::UnsafeSetProperties(const XnActualPropertiesHash& props)
{
XnStatus nRetVal = XN_STATUS_OK;
for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
{
XnProperty* pRequestProp = it->Value();
XnProperty* pProp = NULL;
// check if property already exist
nRetVal = m_pModule->GetProperty(pRequestProp->GetName(), &pProp);
if (nRetVal == XN_STATUS_DEVICE_PROPERTY_DONT_EXIST)
{
// property doesn't exist. create it now
nRetVal = CreateProperty(pRequestProp);
XN_IS_STATUS_OK(nRetVal);
}
else if (nRetVal == XN_STATUS_OK)
{
// property exists. Change its value
nRetVal = UnsafeSetProperty(pRequestProp, pProp);
XN_IS_STATUS_OK(nRetVal);
}
else
{
// error
return (nRetVal);
}
} // props loop
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:33,代码来源:XnDeviceModuleHolder.cpp
示例5: XnPropertySetCloneModule
XN_DDK_API XnStatus XnPropertySetCloneModule(const XnPropertySet* pSource, XnPropertySet* pDest, const XnChar* strModule, const XnChar* strNewName)
{
XnStatus nRetVal = XN_STATUS_OK;
XnActualPropertiesHash* pModuleProps = NULL;
nRetVal = pSource->pData->Get(strModule, pModuleProps);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnPropertySetAddModule(pDest, strNewName);
XN_IS_STATUS_OK(nRetVal);
for (XnActualPropertiesHash::ConstIterator it = pModuleProps->Begin(); it != pModuleProps->End(); ++it)
{
XnProperty* pProp = it->Value();
switch (pProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
nRetVal = XnPropertySetAddIntProperty(pDest, strNewName, pIntProp->GetName(), pIntProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
nRetVal = XnPropertySetAddRealProperty(pDest, strNewName, pRealProp->GetName(), pRealProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pStrProp = (XnActualStringProperty*)pProp;
nRetVal = XnPropertySetAddStringProperty(pDest, strNewName, pStrProp->GetName(), pStrProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProp;
nRetVal = XnPropertySetAddGeneralProperty(pDest, strNewName, pGenProp->GetName(), &pGenProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d", pProp->GetType());
}
}
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:51,代码来源:XnPropertySet.cpp
示例6: WritePropertySetProperties
XnStatus XnDataPacker::WritePropertySetProperties(const XnPropertySet* pSet)
{
XnStatus nRetVal = XN_STATUS_OK;
for (XnPropertySetData::Iterator it = pSet->pData->Begin(); it != pSet->pData->End(); ++it)
{
XnActualPropertiesHash* pModule = it->Value();
for (XnActualPropertiesHash::ConstIterator itProp = pModule->Begin(); itProp != pModule->End(); ++itProp)
{
switch (itProp->Value()->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pProp = (XnActualIntProperty*)itProp->Value();
nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pProp = (XnActualRealProperty*)itProp->Value();
nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pProp = (XnActualStringProperty*)itProp->Value();
nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)itProp->Value();
nRetVal = WritePropertyImpl(pProp->GetModule(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d", itProp->Value()->GetType());
}
}
}
StartWritingIntenalObject(XN_PACKED_PROPERTY_SET_PROPERTIES_END_MARKER);
EndWritingInternalObject();
return (XN_STATUS_OK);
}
开发者ID:githubgzc,项目名称:Sensor,代码行数:50,代码来源:XnDataPacker.cpp
示例7: CopyFrom
XnStatus XnActualPropertiesHash::CopyFrom(const XnActualPropertiesHash& other)
{
XnStatus nRetVal = XN_STATUS_OK;
Clear();
strncpy(m_strName, other.m_strName, XN_DEVICE_MAX_STRING_LENGTH);
for (ConstIterator it = other.Begin(); it != other.End(); ++it)
{
switch (it->Value()->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pProp = (XnActualIntProperty*)it->Value();
nRetVal = Add(pProp->GetId(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pProp = (XnActualRealProperty*)it->Value();
nRetVal = Add(pProp->GetId(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pProp = (XnActualStringProperty*)it->Value();
nRetVal = Add(pProp->GetId(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)it->Value();
nRetVal = Add(pProp->GetId(), pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d\n", it->Value()->GetType());
}
}
return (XN_STATUS_OK);
}
开发者ID:1170390,项目名称:OpenNI2,代码行数:46,代码来源:XnActualPropertiesHash.cpp
示例8: XnPropertySetAddRealProperty
XnStatus XnPropertySetAddRealProperty(XnPropertySet* pSet, const XnChar* strModuleName, XnUInt32 propertyId, XnDouble dValue)
{
XnStatus nRetVal = XN_STATUS_OK;
XN_VALIDATE_INPUT_PTR(pSet);
XN_VALIDATE_INPUT_PTR(strModuleName);
// get module
XnActualPropertiesHash* pModule = NULL;
nRetVal = pSet->pData->Get(strModuleName, pModule);
XN_IS_STATUS_OK(nRetVal);
// add property
nRetVal = pModule->Add(propertyId, "", dValue);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
开发者ID:1170390,项目名称:OpenNI2,代码行数:18,代码来源:XnPropertySet.cpp
示例9: XnPropertySetRemoveProperty
XnStatus XnPropertySetRemoveProperty(XnPropertySet* pSet, const XnChar* strModuleName, XnUInt32 propertyId)
{
XnStatus nRetVal = XN_STATUS_OK;
XN_VALIDATE_INPUT_PTR(pSet);
XN_VALIDATE_INPUT_PTR(strModuleName);
// get module
XnActualPropertiesHash* pModule = NULL;
nRetVal = pSet->pData->Get(strModuleName, pModule);
XN_IS_STATUS_OK(nRetVal);
// remove the property
nRetVal = pModule->Remove(propertyId);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
开发者ID:1170390,项目名称:OpenNI2,代码行数:18,代码来源:XnPropertySet.cpp
示例10: UnsafeBatchConfig
XnStatus XnDeviceModule::UnsafeBatchConfig(const XnActualPropertiesHash& props)
{
XnStatus nRetVal = XN_STATUS_OK;
for (XnActualPropertiesHash::ConstIterator it = props.Begin(); it != props.End(); ++it)
{
XnProperty* pRequestProp = it->Value();
switch (pRequestProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pProp = (XnActualIntProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pProp = (XnActualRealProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pProp = (XnActualStringProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pProp = (XnActualGeneralProperty*)pRequestProp;
nRetVal = UnsafeUpdateProperty(pProp->GetName(), pProp->GetValue());
XN_IS_STATUS_OK(nRetVal);
break;
}
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DDK, "Unknown property type: %d\n", pRequestProp->GetType());
} // type switch
} // props loop
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:44,代码来源:XnDeviceModule.cpp
示例11: SetInitialState
XnStatus XnFileDevice::SetInitialState(XnPropertySet* pSet)
{
XnStatus nRetVal = XN_STATUS_OK;
// Fix state (remove some properties that we don't wish to reflect in reader device)
XnActualPropertiesHash* pDeviceModule = NULL;
if (XN_STATUS_OK == pSet->pData->Get(XN_MODULE_NAME_DEVICE, pDeviceModule))
{
pDeviceModule->Remove(XN_MODULE_PROPERTY_READ_WRITE_MODE);
pDeviceModule->Remove(XN_MODULE_PROPERTY_PRIMARY_STREAM);
// check for timestamps resolution
XnActualIntProperty* pIntProp = NULL;
if (XN_STATUS_OK == pDeviceModule->Get(XN_MODULE_PROPERTY_HIGH_RES_TIMESTAMPS, (XnProperty*&)pIntProp))
{
m_bHighresTimestamps = (pIntProp->GetValue() == TRUE);
}
}
// TODO: create DEVICE node
// now create the rest of the modules and streams (DEVICE was already created)
XnPropertySetData* pPropSetData = pSet->pData;
for (XnPropertySetData::ConstIterator it = pPropSetData->Begin(); it != pPropSetData->End(); ++it)
{
// ignore module DEVICE
if (strcmp(XN_MODULE_NAME_DEVICE, it->Key()) == 0)
{
continue;
}
// check if this is a stream
XnActualPropertiesHash::ConstIterator itProp = it->Value()->End();
if (XN_STATUS_OK == it->Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
{
XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp->Value();
nRetVal = HandleNewStream(pTypeProp->GetValue(), it->Key(), it->Value());
XN_IS_STATUS_OK(nRetVal);
}
} // modules loop
return (XN_STATUS_OK);
}
开发者ID:RikeshThapa,项目名称:VirtueX,代码行数:43,代码来源:XnFileDevice.cpp
示例12: XnPropertySetAddIntProperty
XN_DDK_API XnStatus XnPropertySetAddIntProperty(XnPropertySet* pSet, const XnChar* strModuleName, const XnChar* strProperty, XnUInt64 nValue)
{
XnStatus nRetVal = XN_STATUS_OK;
XN_VALIDATE_INPUT_PTR(pSet);
XN_VALIDATE_INPUT_PTR(strModuleName);
XN_VALIDATE_INPUT_PTR(strProperty);
// get module
XnActualPropertiesHash* pModule = NULL;
nRetVal = pSet->pData->Get(strModuleName, pModule);
XN_IS_STATUS_OK(nRetVal);
// add property
nRetVal = pModule->Add(strProperty, nValue);
XN_IS_STATUS_OK(nRetVal);
return (XN_STATUS_OK);
}
开发者ID:02031991,项目名称:Sensor,代码行数:19,代码来源:XnPropertySet.cpp
示例13: BatchConfig
XnStatus XnSensorStreamHelper::BatchConfig(const XnActualPropertiesHash& props)
{
XnStatus nRetVal = XN_STATUS_OK;
XnBool bShouldClose = FALSE;
if (m_pStream->IsOpen())
{
// check if one of the properties requires to close the stream
for (FirmareProperties::Iterator it = m_FirmwareProperties.Begin(); it != m_FirmwareProperties.End(); ++it)
{
if (!it->Value().bAllowWhileOpen)
{
XnProperty* pProp;
if (XN_STATUS_OK == props.Get(it->Value().pStreamProp->GetName(), pProp))
{
bShouldClose = TRUE;
break;
}
}
}
}
if (bShouldClose)
{
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "closing stream before batch config...");
nRetVal = m_pStream->Close();
XN_IS_STATUS_OK(nRetVal);
}
nRetVal = m_pStream->XnDeviceStream::BatchConfig(props);
XN_IS_STATUS_OK(nRetVal);
if (bShouldClose)
{
xnLogVerbose(XN_MASK_DEVICE_SENSOR, "re-opening stream after batch config...");
nRetVal = m_pStream->Open();
XN_IS_STATUS_OK(nRetVal);
}
return (XN_STATUS_OK);
}
开发者ID:RikeshThapa,项目名称:VirtueX,代码行数:42,代码来源:XnSensorStreamHelper.cpp
示例14: XN_IS_STATUS_OK
XnStatus XnStreamReaderDevice::SetInitialState(const XnDeviceConfig* pDeviceConfig, XnPropertySet* pSet)
{
XnStatus nRetVal = XN_STATUS_OK;
// Fix state (remove some properties that we don't wish to reflect in reader device)
XnActualPropertiesHash* pDeviceModule = NULL;
if (XN_STATUS_OK == pSet->pData->Get(XN_MODULE_NAME_DEVICE, pDeviceModule))
{
pDeviceModule->Remove(XN_MODULE_PROPERTY_READ_WRITE_MODE);
pDeviceModule->Remove(XN_MODULE_PROPERTY_PRIMARY_STREAM);
}
// now init base using this state (this will also create module DEVICE)
XnDeviceConfig initConfig;
initConfig.cpConnectionString = pDeviceConfig->cpConnectionString;
initConfig.DeviceMode = pDeviceConfig->DeviceMode;
initConfig.pInitialValues = pSet;
initConfig.SharingMode = pDeviceConfig->SharingMode;
nRetVal = XnStreamDevice::InitImpl(&initConfig);
XN_IS_STATUS_OK(nRetVal);
// now create the rest of the modules and streams (DEVICE was already created)
XnPropertySetData* pPropSetData = pSet->pData;
for (XnPropertySetData::ConstIterator it = pPropSetData->begin(); it != pPropSetData->end(); ++it)
{
// ignore module DEVICE
if (strcmp(XN_MODULE_NAME_DEVICE, it.Key()) == 0)
{
continue;
}
// check if this is a stream
XnActualPropertiesHash::ConstIterator itProp = it.Value()->end();
if (XN_STATUS_OK == it.Value()->Find(XN_STREAM_PROPERTY_TYPE, itProp))
{
XnActualStringProperty* pTypeProp = (XnActualStringProperty*)itProp.Value();
nRetVal = HandleNewStream(pTypeProp->GetValue(), it.Key(), it.Value());
XN_IS_STATUS_OK(nRetVal);
}
else
{
// this is module. create it
XnDeviceModuleHolder* pHolder = NULL;
nRetVal = CreateModule(it.Key(), &pHolder);
XN_IS_STATUS_OK(nRetVal);
// set its props
nRetVal = pHolder->Init(it.Value());
if (nRetVal != XN_STATUS_OK)
{
DestroyModule(pHolder);
return (nRetVal);
}
// and add it
nRetVal = AddModule(pHolder);
if (nRetVal != XN_STATUS_OK)
{
DestroyModule(pHolder);
return (nRetVal);
}
}
} // modules loop
return (XN_STATUS_OK);
}
开发者ID:linjason,项目名称:Scene-Matching,代码行数:67,代码来源:XnStreamReaderDevice.cpp
示例15: XN_PROPERTY_SET_CREATE_ON_STACK
XnStatus XnServerSensorInvoker::OnStreamAdded(const XnChar* StreamName)
{
XnStatus nRetVal = XN_STATUS_OK;
// get all props
XN_PROPERTY_SET_CREATE_ON_STACK(props);
nRetVal = m_sensor.GetAllProperties(&props, FALSE, StreamName);
XN_IS_STATUS_OK(nRetVal);
// register to all props
nRetVal = RegisterToProps(&props);
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pStreamProps = props.pData->Begin()->Value();
// create stream data
SensorInvokerStream serverStream;
xnOSMemSet(&serverStream, 0, sizeof(serverStream));
strcpy(serverStream.strType, StreamName);
XN_VALIDATE_NEW(serverStream.pNewDataEvent, NewStreamDataEvent);
// check if this is a frame stream
XnProperty* pIsFrameBased;
nRetVal = pStreamProps->Get(XN_STREAM_PROPERTY_IS_FRAME_BASED, pIsFrameBased);
if (nRetVal == XN_STATUS_OK)
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pIsFrameBased;
serverStream.bFrameStream = (pIntProp->GetValue() == TRUE);
}
if (serverStream.bFrameStream)
{
// create the "shared memory name" property
XN_VALIDATE_NEW(serverStream.pSharedMemoryName, XnActualStringProperty, XN_STREAM_PROPERTY_SHARED_BUFFER_NAME);
// and add it to the stream
XnDeviceStream* pStream;
nRetVal = m_sensor.GetStream(StreamName, &pStream);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return nRetVal;
}
nRetVal = pStream->AddProperty(serverStream.pSharedMemoryName);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return nRetVal;
}
// create a shared memory buffer pool for it
nRetVal = SetStreamSharedMemory(&serverStream);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return nRetVal;
}
}
// create a stream data object for the stream
nRetVal = m_sensor.CreateStreamData(StreamName, &serverStream.pStreamData);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return (nRetVal);
}
// and add it to our list of streams
nRetVal = m_streams.Set(StreamName, serverStream);
if (nRetVal != XN_STATUS_OK)
{
XN_DELETE(serverStream.pNewDataEvent);
XN_DELETE(serverStream.pSharedMemoryName);
return (nRetVal);
}
return (XN_STATUS_OK);
}
开发者ID:DogfishLab88,项目名称:debian-openni-sensor-avin2-sensorkinect,代码行数:84,代码来源:XnServerSensorInvoker.cpp
示例16: XN_PROPERTY_SET_CREATE_ON_STACK
XnStatus XnSensorProductionNode::NotifyExState(XnNodeNotifications* pNotifications, void* pCookie)
{
XnStatus nRetVal = XN_STATUS_OK;
// get all properties
XN_PROPERTY_SET_CREATE_ON_STACK(props);
nRetVal = m_pSensor->GetAllProperties(&props, FALSE, GetModuleName());
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pPropsHash = props.pData->begin().Value();
// filter properties (remove the ones already exposed as OpenNI interfaces)
FilterProperties(pPropsHash);
const XnChar* astrIntProps[200] = {0};
const XnChar* astrRealProps[200] = {0};
const XnChar* astrStringProps[200] = {0};
const XnChar* astrGeneralProps[200] = {0};
XnUInt32 nIntProps = 0;
XnUInt32 nRealProps = 0;
XnUInt32 nStringProps = 0;
XnUInt32 nGeneralProps = 0;
// enumerate over properties
for (XnActualPropertiesHash::Iterator it = pPropsHash->begin(); it != pPropsHash->end(); ++it)
{
XnProperty* pProp = it.Value();
switch (pProp->GetType())
{
case XN_PROPERTY_TYPE_INTEGER:
{
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
pNotifications->OnNodeIntPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pIntProp->GetValue());
astrIntProps[nIntProps++] = pProp->GetName();
}
break;
case XN_PROPERTY_TYPE_REAL:
{
XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
pNotifications->OnNodeRealPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pRealProp->GetValue());
astrRealProps[nRealProps++] = pProp->GetName();
}
break;
case XN_PROPERTY_TYPE_STRING:
{
XnActualStringProperty* pStrProp = (XnActualStringProperty*)pProp;
pNotifications->OnNodeStringPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pStrProp->GetValue());
astrStringProps[nStringProps++] = pProp->GetName();
}
break;
case XN_PROPERTY_TYPE_GENERAL:
{
XnActualGeneralProperty* pGenProp = (XnActualGeneralProperty*)pProp;
pNotifications->OnNodeGeneralPropChanged(pCookie, GetInstanceName(), pProp->GetName(), pGenProp->GetValue().nDataSize, pGenProp->GetValue().pData);
astrGeneralProps[nGeneralProps++] = pProp->GetName();
}
break;
default:
XN_LOG_WARNING_RETURN(XN_STATUS_ERROR, XN_MASK_DEVICE_SENSOR, "Unknown property type: %d", pProp->GetType());
}
}
// TODO: also register to these properties, and if changed, notify.
// store notifications object
m_pNotifications = pNotifications;
m_pCookie = pCookie;
return (XN_STATUS_OK);
}
开发者ID:AlpinistPanda,项目名称:SensorKinect,代码行数:72,代码来源:XnSensorProductionNode.cpp
示例17: GetIOStream
XnStatus XnDeviceFileReader::Rewind()
{
XnStatus nRetVal = XN_STATUS_OK;
// go back to start of stream
nRetVal = GetIOStream()->Seek(XN_DEVICE_FILE_MAGIC_LEN);
XN_IS_STATUS_OK(nRetVal);
// read initial state
XN_PROPERTY_SET_CREATE_ON_STACK(state);
nRetVal = ReadInitialState(&state);
XN_IS_STATUS_OK(nRetVal);
// first handle current streams. remove or reset them
XnDeviceModuleHolderList streams;
nRetVal = GetStreamsList(streams);
XN_IS_STATUS_OK(nRetVal);
for (XnDeviceModuleHolderList::Iterator it = streams.Begin(); it != streams.End(); ++it)
{
XnDeviceModuleHolder* pHolder = *it;
if (m_bStreamsCollectionChanged)
{
// we need to destroy all streams, and recreate them later
nRetVal = DestroyStream(pHolder->GetModule()->GetName());
XN_IS_STATUS_OK(nRetVal);
}
else
{
// just reset frame ID
XnStreamReaderStream* pStream = (XnStreamReaderStream*)pHolder->GetModule();
pStream->Reset();
}
}
// if we need, recreate streams
if (m_bStreamsCollectionChanged)
{
nRetVal = CreateStreams(&state);
XN_IS_STATUS_OK(nRetVal);
}
// now set state.
for (XnPropertySetData::Iterator it = state.pData->Begin(); it != state.pData->End(); ++it)
{
const XnChar* strName = it->Key();
XnActualPropertiesHash* pHash = it->Value();
// fix it first
if (strcmp(strName, XN_MODULE_NAME_DEVICE) == 0)
{
pHash->Remove(XN_MODULE_PROPERTY_READ_WRITE_MODE);
pHash->Remove(XN_MODULE_PROPERTY_PRIMARY_STREAM);
}
XnDeviceModule* pModule;
nRetVal = FindModule(strName, &pModule);
XN_IS_STATUS_OK(nRetVal);
nRetVal = pModule->UnsafeBatchConfig(*pHash);
XN_IS_STATUS_OK(nRetVal);
}
ResetLastTimestampAndFrame();
m_nReferenceTimestamp = 0;
m_nReferenceTime = 0;
m_bStreamsCollectionChanged = FALSE;
return (XN_STATUS_OK);
}
开发者ID:RikeshThapa,项目名称:VirtueX,代码行数:71,代码来源:XnDeviceFileReader.cpp
示例18: BCInit
XnStatus XnDeviceFileReader::ReadInitialState(XnPropertySet *pSet)
{
XnStatus nRetVal = XN_STATUS_OK;
if (m_nFileVersion < 4)
{
if (m_pBCData == NULL)
{
nRetVal = BCInit();
XN_IS_STATUS_OK(nRetVal);
}
return BCReadInitialState(pSet);
}
// first read first object - modules properties - using base
nRetVal = XnStreamReaderDevice::ReadInitialState(pSet);
XN_IS_STATUS_OK(nRetVal);
// now continue reading until we get to first data
XnPackedDataType nType;
XnBool bStateEnd = FALSE;
XnUInt64 nPositionBefore;
while (!bStateEnd)
{
nRetVal = GetIOStream()->Tell(&nPositionBefore);
XN_IS_STATUS_OK(nRetVal);
nRetVal = GetDataPacker()->ReadNextObject(&nType);
XN_IS_STATUS_OK(nRetVal);
switch (nType)
{
case XN_PACKED_NEW_STREAM:
{
XnChar strType[XN_DEVICE_MAX_STRING_LENGTH];
XnChar strName[XN_DEVICE_MAX_STRING_LENGTH];
XN_PROPERTY_SET_CREATE_ON_STACK(props);
nRetVal = GetDataPacker()->ReadNewStream(strType, strName, &props);
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pStreamProps;
nRetVal = XnPropertySetDataDetachModule(props.pData, strName, &pStreamProps);
XN_IS_STATUS_OK(nRetVal);
nRetVal = XnPropertySetDataAttachModule(pSet->pData, strName, pStreamProps);
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PACKED_INT_PROPERTY:
{
XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
XnUInt64 nValue;
nRetVal = GetDataPacker()->ReadProperty(strModule, strProp, &nValue);
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pModule = NULL;
nRetVal = pSet->pData->Get(strModule, pModule);
XN_IS_STATUS_OK(nRetVal);
XnProperty* pProp = NULL;
nRetVal = pModule->Get(strProp, pProp);
XN_IS_STATUS_OK(nRetVal);
XnActualIntProperty* pIntProp = (XnActualIntProperty*)pProp;
nRetVal = pIntProp->UnsafeUpdateValue(nValue);
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PACKED_REAL_PROPERTY:
{
XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
XnDouble dValue;
nRetVal = GetDataPacker()->ReadProperty(strModule, strProp, &dValue);
XN_IS_STATUS_OK(nRetVal);
XnActualPropertiesHash* pModule;
nRetVal = pSet->pData->Get(strModule, pModule);
XN_IS_STATUS_OK(nRetVal);
XnProperty* pProp;
nRetVal = pModule->Get(strProp, pProp);
XN_IS_STATUS_OK(nRetVal);
XnActualRealProperty* pRealProp = (XnActualRealProperty*)pProp;
nRetVal = pRealProp->UnsafeUpdateValue(dValue);
XN_IS_STATUS_OK(nRetVal);
break;
}
case XN_PACKED_STRING_PROPERTY:
{
XnChar strModule[XN_DEVICE_MAX_STRING_LENGTH];
XnChar strProp[XN_DEVICE_MAX_STRING_LENGTH];
XnChar strValue[XN_DEVICE_MAX_STRING_LENGTH];
nRetVal = GetDataPacker()->ReadProperty(strModule, strProp, strValue);
XN_IS_STATUS_OK(nRetVal);
//.........这里部分代码省略.........
开发者ID:RikeshThapa,项目名称:VirtueX,代码行数:101,代码来源:XnDeviceFileReader.cpp
注:本文中的XnActualPropertiesHash类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论