本文整理汇总了C++中DeviceVector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceVector::begin方法的具体用法?C++ DeviceVector::begin怎么用?C++ DeviceVector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceVector
的用法示例。
在下文中一共展示了DeviceVector::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeDevice
void removeDevice(Freenect2DeviceImpl *device)
{
DeviceVector::iterator it = std::find(devices_.begin(), devices_.end(), device);
if(it != devices_.end())
{
devices_.erase(it);
}
else
{
std::cout << "[Freenect2Impl] tried to remove device, which is not in the internal device list!" << std::endl;
}
}
示例2: tryGetDevice
bool tryGetDevice(libusb_device *usb_device, Freenect2DeviceImpl **device)
{
for(DeviceVector::iterator it = devices_.begin(); it != devices_.end(); ++it)
{
if((*it)->isSameUsbDevice(usb_device))
{
*device = *it;
return true;
}
}
return false;
}
示例3: clearDevices
void clearDevices()
{
DeviceVector devices(devices_.begin(), devices_.end());
for(DeviceVector::iterator it = devices.begin(); it != devices.end(); ++it)
{
delete (*it);
}
if(!devices_.empty())
{
std::cout << "[Freenect2Impl] after deleting all devices the internal device list should be empty!" << std::endl;
}
}
示例4: handleMethod
ErrorPtr DaliDeviceContainer::handleMethod(VdcApiRequestPtr aRequest, const string &aMethod, ApiValuePtr aParams)
{
ErrorPtr respErr;
if (aMethod=="x-p44-groupDevices") {
// create a composite device out of existing single-channel ones
ApiValuePtr components;
long long collectionID = -1;
DeviceVector groupedDevices;
respErr = checkParam(aParams, "members", components);
if (Error::isOK(respErr)) {
if (components->isType(apivalue_object)) {
components->resetKeyIteration();
string dimmerType;
ApiValuePtr o;
while (components->nextKeyValue(dimmerType, o)) {
DsUid memberUID;
memberUID.setAsBinary(o->binaryValue());
bool deviceFound = false;
// search for this device
for (DeviceVector::iterator pos = devices.begin(); pos!=devices.end(); ++pos) {
// only non-grouped DALI devices can be grouped
DaliDevicePtr dev = boost::dynamic_pointer_cast<DaliDevice>(*pos);
if (dev && dev->getDsUid() == memberUID) {
deviceFound = true;
// found this device, create DB entry for it
db.executef(
"INSERT OR REPLACE INTO compositeDevices (dimmerUID, dimmerType, collectionID) VALUES ('%s','%s',%lld)",
memberUID.getString().c_str(),
dimmerType.c_str(),
collectionID
);
if (collectionID<0) {
// use rowid of just inserted item as collectionID
collectionID = db.last_insert_rowid();
// - update already inserted first record
db.executef(
"UPDATE compositeDevices SET collectionID=%lld WHERE ROWID=%lld",
collectionID,
collectionID
);
}
// remember
groupedDevices.push_back(dev);
// done
break;
}
}
if (!deviceFound) {
respErr = ErrorPtr(new WebError(404, "some devices of the group could not be found"));
break;
}
}
if (Error::isOK(respErr) && groupedDevices.size()>0) {
// all components inserted into DB
// - remove grouped single devices
for (DeviceVector::iterator pos = groupedDevices.begin(); pos!=groupedDevices.end(); ++pos) {
(*pos)->hasVanished(false); // vanish, but keep settings
}
// - re-collect devices to find grouped composite now, but only in a second starting from main loop, not from here
CompletedCB cb = boost::bind(&DaliDeviceContainer::groupCollected, this, aRequest);
MainLoop::currentMainLoop().executeOnce(boost::bind(&DaliDeviceContainer::collectDevices, this, cb, false, false), 1*Second);
}
}
}
}
else {
respErr = inherited::handleMethod(aRequest, aMethod, aParams);
}
return respErr;
}