本文整理汇总了C++中CSerializablePtr::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CSerializablePtr::clear方法的具体用法?C++ CSerializablePtr::clear怎么用?C++ CSerializablePtr::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSerializablePtr
的用法示例。
在下文中一共展示了CSerializablePtr::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeOperationOnRawlog
//.........这里部分代码省略.........
int changes = 0;
wxBusyCursor cursor;
while ((( !isInMemory && keepLoading ) ||
( isInMemory && countLoop < rawlog.size() ))&& !sensorPoseReadOK && !camReadIsOk )
{
CSerializablePtr newObj;
try
{
if (isInMemory)
{
newObj = rawlog.getAsGeneric(countLoop);
}
else
{
(*in_fil) >> newObj;
}
// Check type:
if ( newObj->GetRuntimeClass() == CLASS_ID(CSensoryFrame))
{
// A sensory frame:
CSensoryFramePtr sf(newObj);
// Process & save:
operation(NULL,sf.pointer(),changes );
if (!isInMemory) (*out_fil) << *sf.pointer();
}
else if ( newObj->GetRuntimeClass() == CLASS_ID(CActionCollection))
{
// This is an action:
CActionCollectionPtr acts =CActionCollectionPtr( newObj );
// Process & save:
operation( (CActionCollection*)acts.pointer(),NULL,changes);
if (!isInMemory) (*out_fil) << *acts;
}
else if ( newObj->GetRuntimeClass()->derivedFrom(CLASS_ID(CObservation)))
{
// A sensory frame:
CObservationPtr o(newObj);
static CSensoryFrame sf;
sf.clear();
sf.insert(o);
// Process & save:
operation(NULL,&sf,changes );
if (!isInMemory) (*out_fil) << *o;
}
else
{ // Unknown class:
THROW_EXCEPTION(format("Unexpected class found in the file: '%s'",newObj->GetRuntimeClass()->className) );
}
}
catch (exception &e)
{
errorMsg = e.what();
keepLoading = false;
}
catch (...)
{
keepLoading = false;
}
// Step counter & update progress dialog
if (countLoop++ % 300 == 0)
{
auxStr.sprintf(wxT("Processing... (%u objects processed)"),countLoop);
int curProgr = isInMemory ? countLoop : (int)in_fil->getPosition();
if (!progDia.Update( curProgr , auxStr ))
keepLoading = false;
wxTheApp->Yield(); // Let the app. process messages
}
// Delete only if processing file
if (newObj && !isInMemory)
{
newObj.clear();
}
} // end while keep loading
progDia.Update( processMax ); // Close dialog.
if (strlen(endMsg))
{
char tmpStr[1000];
os::sprintf(tmpStr,sizeof(tmpStr),"%s %i\n\nEnd message:\n%s", endMsg, changes, errorMsg.c_str() );
wxMessageBox( _U(tmpStr), _("Result:"), wxOK,this);
}
if (in_fil) delete in_fil;
if (out_fil) delete out_fil;
WX_END_TRY
}