本文整理汇总了C++中KstDataSourcePtr::update方法的典型用法代码示例。如果您正苦于以下问题:C++ KstDataSourcePtr::update方法的具体用法?C++ KstDataSourcePtr::update怎么用?C++ KstDataSourcePtr::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstDataSourcePtr
的用法示例。
在下文中一共展示了KstDataSourcePtr::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doUpdates
bool UpdateThread::doUpdates(bool force, bool *gotData) {
KstObject::UpdateType U = KstObject::NO_CHANGE;
_updatedCurves.clear(); // HACK
if (gotData) {
*gotData = false;
}
#if UPDATEDEBUG > 0
if (force) {
qDebug() << "Forced update!" << endl;
}
#endif
_updateCounter++;
if (_updateCounter < 1) {
_updateCounter = 1; // check for wrap around
}
#if UPDATEDEBUG > 2
qDebug() << "UPDATE: counter=" << _updateCounter << endl;
#endif
{
// Must make a copy to avoid deadlock
KstBaseCurveList cl;
KstDataObjectList dol;
kstObjectSplitList<KstDataObject, KstBaseCurve>(KST::dataObjectList, cl, dol);
qSort(cl);
qSort(dol);
// Update all curves
for (uint i = 0; i < cl.count(); ++i) {
KstBaseCurvePtr bcp = cl[i];
bcp->writeLock();
assert(bcp.data());
#if UPDATEDEBUG > 1
qDebug() << "updating curve: " << (void*)bcp << " - " << bcp->tagName() << endl;
#endif
KstObject::UpdateType ut = bcp->update(_updateCounter);
bcp->unlock();
if (ut == KstObject::UPDATE) { // HACK
_updatedCurves.append(bcp);
}
if (U != KstObject::UPDATE) {
U = ut;
if (U == KstObject::UPDATE) {
#if UPDATEDEBUG > 0
qDebug() << "Curve " << bcp->tagName() << " said UPDATE" << endl;
#endif
}
}
if (_done || (_paused && !force)) {
#if UPDATEDEBUG > 1
qDebug() << "5 Returning from scan with U=" << (int)U << endl;
#endif
return U == KstObject::UPDATE;
}
}
// Update all data objects
for (uint i = 0; i < dol.count(); ++i) {
KstDataObjectPtr dp = dol[i];
dp->writeLock();
assert(dp.data());
#if UPDATEDEBUG > 1
qDebug() << "updating data object: " << (void*)dp << " - " << dp->tagName() << endl;
#endif
dp->update(_updateCounter);
dp->unlock();
if (_done || (_paused && !force)) {
#if UPDATEDEBUG > 1
qDebug() << "5 Returning from scan with U=" << (int)U << endl;
#endif
return U == KstObject::UPDATE;
}
}
}
// Update the files
if (!_paused) { // don't update even if paused && force
KST::dataSourceList.lock().readLock();
unsigned cnt = KST::dataSourceList.count();
for (uint i = 0; i < cnt; ++i) {
KstDataSourcePtr dsp = KST::dataSourceList[i];
dsp->writeLock();
dsp->update(_updateCounter);
dsp->unlock();
if (_done) {
KST::dataSourceList.lock().unlock();
return false;
}
}
//.........这里部分代码省略.........