本文整理汇总了C++中Progress::frequency方法的典型用法代码示例。如果您正苦于以下问题:C++ Progress::frequency方法的具体用法?C++ Progress::frequency怎么用?C++ Progress::frequency使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress::frequency方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: watcher
static unsigned
exportGames(JNIEnv* env, jobject obj, jmethodID progressMid, Database& src, Consumer& dst, Progress& progress)
{
unsigned numGames = src.countGames();
LOGI("number of games: %u", numGames);
jclass cls = env->GetObjectClass(obj);
jmethodID mid = env->GetMethodID(cls, "setNOGames", "(I)V");
if (mid != 0) {
env->CallVoidMethod(obj, mid, numGames);
}
env->DeleteLocalRef(cls);
util::ProgressWatcher watcher(progress, numGames);
progress.setFrequency(mstl::min(5000u, mstl::max(numGames/100, 1u)));
unsigned reportAfter = progress.frequency();
unsigned count = 0;
unsigned countGames = 0;
::Log log;
for (unsigned i = 0; i < numGames; ++i)
{
if (reportAfter == count++)
{
progress.update(env, obj, progressMid, count);
reportAfter += progress.frequency();
}
save::State state = src.exportGame(i, dst);
if (state == save::Ok)
++countGames;
else if (!log.error(state, i))
return countGames;
}
return countGames;
}