本文整理汇总了C++中DataSetList::ClearAll方法的典型用法代码示例。如果您正苦于以下问题:C++ DataSetList::ClearAll方法的具体用法?C++ DataSetList::ClearAll怎么用?C++ DataSetList::ClearAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSetList
的用法示例。
在下文中一共展示了DataSetList::ClearAll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteByGroup
// DataIO_Std::WriteByGroup()
int DataIO_Std::WriteByGroup(CpptrajFile& file, DataSetList const& SetList, GroupType gtype)
{
int err = 0;
bool firstWrite = true;
DataSetList tmpdsl;
std::vector<bool> setIsWritten(SetList.size(), false);
unsigned int startIdx = 0;
unsigned int nWritten = 0;
while (nWritten < SetList.size()) {
std::string currentName;
Dimension currentDim;
int currentNum = -1;
switch (gtype) {
case BY_NAME : currentName = SetList[startIdx]->Meta().Name(); break;
case BY_ASPECT : currentName = SetList[startIdx]->Meta().Aspect(); break;
case BY_IDX : currentNum = SetList[startIdx]->Meta().Idx(); break;
case BY_ENS : currentNum = SetList[startIdx]->Meta().EnsembleNum(); break;
case BY_DIM : currentDim = SetList[startIdx]->Dim(0); break;
case NO_TYPE : return 1;
}
int firstNonMatch = -1;
for (unsigned int idx = startIdx; idx != SetList.size(); idx++)
{
if (!setIsWritten[idx])
{
bool match = false;
switch (gtype) {
case BY_NAME : match = (currentName == SetList[idx]->Meta().Name()); break;
case BY_ASPECT : match = (currentName == SetList[idx]->Meta().Aspect()); break;
case BY_IDX : match = (currentNum == SetList[idx]->Meta().Idx()); break;
case BY_ENS : match = (currentNum == SetList[idx]->Meta().EnsembleNum()); break;
case BY_DIM : match = (currentDim == SetList[idx]->Dim(0)); break;
case NO_TYPE : return 1;
}
if (match)
{
tmpdsl.AddCopyOfSet( SetList[idx] );
setIsWritten[idx] = true;
nWritten++;
} else if (firstNonMatch == -1)
firstNonMatch = (int)idx;
}
}
if (firstNonMatch > -1)
startIdx = (unsigned int)firstNonMatch;
if (!firstWrite)
file.Printf("\n");
else
firstWrite = false;
if (isInverted_)
err += WriteDataInverted(file, tmpdsl);
else
err += WriteDataNormal(file, tmpdsl);
tmpdsl.ClearAll();
}
return err;
}