本文整理汇总了C++中DevicePtr::close方法的典型用法代码示例。如果您正苦于以下问题:C++ DevicePtr::close方法的具体用法?C++ DevicePtr::close怎么用?C++ DevicePtr::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DevicePtr
的用法示例。
在下文中一共展示了DevicePtr::close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sxname
/**
* \brief Get a list of Starlight Express cameras.
*
* \return a vector of strings that uniquely descript devices
*/
std::vector<std::string> SxCameraLocator::getDevicelist(DeviceName::device_type device) {
std::vector<std::string> names;
// list all devices from the context
std::vector<DevicePtr> d = context.devices();
std::vector<DevicePtr>::const_iterator i;
for (i = d.begin(); i != d.end(); i++) {
// try to open the device. On Mac OS X, opening doesn't fail
// ever, but on Linux, we may not have permission to open
// all devices
try {
DevicePtr devptr = *i;
devptr->open();
try {
if (device == DeviceName::Camera) {
names.push_back("camera:sx/" + sxname(devptr));
}
if (device == DeviceName::Guiderport) {
names.push_back("guiderport:sx/" + sxname(devptr) + "/guiderport");
}
} catch (std::runtime_error& x) {
debug(LOG_DEBUG, DEBUG_LOG, 0, "found a non"
" SX device: %s", x.what());
}
devptr->close();
} catch (std::exception& x) {
// log the error, but don't do anything about it
debug(LOG_ERR, DEBUG_LOG, 0, "cannot work with device");
}
}
debug(LOG_DEBUG, DEBUG_LOG, 0, "found %d SX devices", names.size());
return names;
}