本文整理汇总了C++中ProgressMeterHolder::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgressMeterHolder::get方法的具体用法?C++ ProgressMeterHolder::get怎么用?C++ ProgressMeterHolder::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgressMeterHolder
的用法示例。
在下文中一共展示了ProgressMeterHolder::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void run() {
// It's necessary to index sufficient keys that a RARELY condition will be triggered.
int32_t nDocs = 130;
// Add some data to the collection.
for( int32_t i = 0; i < nDocs; ++i ) {
_client.insert( _ns, BSON( "a" << i ) );
}
IndexDetails& id = addIndexWithInfo();
// Create a SortPhaseOne.
SortPhaseOne phaseOne;
ProgressMeterHolder pm (cc().curop()->setMessage("InterruptAddKeysToPhaseOne",
"InterruptAddKeysToPhaseOne Progress",
nDocs,
nDocs));
// Register a request to kill the current operation.
cc().curop()->kill();
if ( _mayInterrupt ) {
// Add keys to phaseOne.
ASSERT_THROWS( BtreeBasedBuilder::addKeysToPhaseOne( nsdetails(_ns), _ns,
id,
BSON( "a" << 1 ),
&phaseOne,
nDocs,
pm.get(),
_mayInterrupt,
nsdetails(_ns)->idxNo(id) ),
UserException );
// Not all keys were added to phaseOne due to the interrupt.
ASSERT( static_cast<uint64_t>( nDocs ) > phaseOne.n );
}
else {
// Add keys to phaseOne.
BtreeBasedBuilder::addKeysToPhaseOne( nsdetails(_ns), _ns,
id,
BSON( "a" << 1 ),
&phaseOne,
nDocs,
pm.get(),
_mayInterrupt, nsdetails(_ns)->idxNo(id) );
// All keys were added to phaseOne despite to the kill request, because
// mayInterrupt == false.
ASSERT_EQUALS( static_cast<uint64_t>( nDocs ), phaseOne.n );
}
}
示例2: run
void run() {
// Add some data to the collection.
int32_t nDocs = 130;
for( int32_t i = 0; i < nDocs; ++i ) {
_client.insert( _ns, BSON( "a" << i ) );
}
IndexDescriptor* id = addIndexWithInfo();
// Create a SortPhaseOne.
SortPhaseOne phaseOne;
ProgressMeterHolder pm (cc().curop()->setMessage("AddKeysToPhaseOne",
"AddKeysToPhaseOne Progress",
nDocs,
nDocs));
// Add keys to phaseOne.
BtreeBasedBuilder::addKeysToPhaseOne( collection(),
id,
BSON( "a" << 1 ),
&phaseOne,
pm.get(), true );
// Keys for all documents were added to phaseOne.
ASSERT_EQUALS( static_cast<uint64_t>( nDocs ), phaseOne.n );
}