コード例 #1
0
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);
}
コード例 #2
0
XnStatus XnActualPropertiesHash::Remove(ConstIterator where)
{
	XnStatus nRetVal = XN_STATUS_OK;

	XnProperty* pProp = where->Value();

	nRetVal = m_Hash.Remove(where);
	XN_IS_STATUS_OK(nRetVal);

	XN_DELETE(pProp);

	return (XN_STATUS_OK);
}