本文整理汇总了C++中DataFile::Type方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFile::Type方法的具体用法?C++ DataFile::Type怎么用?C++ DataFile::Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFile
的用法示例。
在下文中一共展示了DataFile::Type方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddDataFile
/** Create new DataFile, or return existing DataFile. */
DataFile* DataFileList::AddDataFile(FileName const& nameIn, ArgList& argIn,
DataFile::DataFormatType typeIn)
{
// If no filename, no output desired
if (nameIn.empty()) return 0;
FileName fname( nameIn );
// Append ensemble number if set.
//rprintf("DEBUG: Setting up data file '%s' with ensembleNum %i\n", nameIn.base(), ensembleNum_);
if (ensembleNum_ != -1)
fname.Append( "." + integerToString(ensembleNum_) );
// Check if filename in use by CpptrajFile.
CpptrajFile* cf = GetCpptrajFile(fname);
if (cf != 0) {
mprinterr("Error: Data file name '%s' already in use by text output file '%s'.\n",
fname.full(), cf->Filename().full());
return 0;
}
// Check if this filename already in use
DataFile* Current = GetDataFile(fname);
// If no DataFile associated with name, create new DataFile
if (Current==0) {
Current = new DataFile();
if (Current->SetupDatafile(fname, argIn, typeIn, debug_)) {
mprinterr("Error: Setting up data file %s\n", fname.full());
delete Current;
return 0;
}
fileList_.push_back(Current);
} else {
// Set debug level
Current->SetDebug(debug_);
// If a type was specified, make sure it matches.
if (typeIn != DataFile::UNKNOWN_DATA && typeIn != Current->Type()) {
mprinterr("Error: '%s' is type %s but has been requested as type %s.\n",
Current->DataFilename().full(), Current->FormatString(),
DataFile::FormatString( typeIn ));
return 0;
}
// Check for keywords that do not match file type
DataFile::DataFormatType kType = DataFile::GetFormatFromArg( argIn );
if (kType != DataFile::UNKNOWN_DATA && kType != Current->Type())
mprintf("Warning: %s is type %s but type %s keyword specified; ignoring keyword.\n",
Current->DataFilename().full(), Current->FormatString(),
DataFile::FormatString( kType ));
// Process Arguments
if (!argIn.empty())
Current->ProcessArgs( argIn );
}
return Current;
}