void XnExportedSensorDevice::Destroy(xn::ModuleProductionNode* pInstance) { XnStatus nRetVal = XN_STATUS_OK; XnSensorDevice* pDevice = dynamic_cast<XnSensorDevice*>(pInstance); XnChar strConnStr[XN_MAX_CREATION_INFO_LENGTH]; nRetVal = pDevice->GetStringProperty(XN_MODULE_PROPERTY_USB_PATH, strConnStr, sizeof(strConnStr)); if (nRetVal != XN_STATUS_OK) { xnLogWarning(XN_MASK_DEVICE_SENSOR, "Couldn't get usb path property ?! :("); XN_ASSERT(FALSE); } XnContext* pContext = pDevice->GetContext().GetUnderlyingObject(); CreatedDevices::Iterator it = FindCreatedDevice(pContext, strConnStr); if (it == m_createdDevices.End()) { xnLogWarning(XN_MASK_DEVICE_SENSOR, "Couldn't find device in created devices ?! :("); XN_ASSERT(FALSE); } else { m_createdDevices.Remove(it); } XnDeviceBase* pSensor = pDevice->GetSensor(); pSensor->Destroy(); XN_DELETE(pSensor); XN_DELETE(pDevice); }
void XnExportedSensorDevice::Destroy(xn::ModuleProductionNode* pInstance) { XnSensorDevice* pDevice = dynamic_cast<XnSensorDevice*>(pInstance); XnDeviceBase* pSensor = pDevice->GetSensor(); pSensor->Destroy(); XN_DELETE(pSensor); XN_DELETE(pDevice); }