本文整理汇总了C++中FileName::Full方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::Full方法的具体用法?C++ FileName::Full怎么用?C++ FileName::Full使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::Full方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mprintf
// =============================================================================
// ----- RepName Class ---------------------------------------------------------
// RepName CONSTRUCTOR
File::RepName::RepName(FileName const& fname, int debugIn) :
extChar_('.')
{
if (debugIn > 1)
mprintf("\tREMDTRAJ: FileName=[%s]\n", fname.full());
if ( fname.Ext().empty() ) {
mprinterr("Error: Traj %s has no numerical extension, required for automatic\n"
"Error: detection of replica trajectories. Expected filename format is\n"
"Error: <Prefix>.<#> (with optional compression extension), examples:\n"
"Error: Rep.traj.nc.000, remd.x.01.gz etc.\n", fname.base());
return;
}
// Split off everything before replica extension
size_t found = fname.Full().rfind( fname.Ext() );
Prefix_.assign( fname.Full().substr(0, found) );
ReplicaExt_.assign( fname.Ext() ); // This should be the numeric extension
// Remove leading '.'
if (ReplicaExt_[0] == '.') ReplicaExt_.erase(0,1);
CompressExt_.assign( fname.Compress() );
if (debugIn > 1) {
mprintf("\tREMDTRAJ: Prefix=[%s], #Ext=[%s], CompressExt=[%s]\n",
Prefix_.c_str(), ReplicaExt_.c_str(), CompressExt_.c_str());
}
// CHARMM replica numbers are format <name>_<num>
if ( !validInteger(ReplicaExt_) ) {
size_t uscore = fname.Full().rfind('_');
if (uscore != std::string::npos) {
Prefix_.assign( fname.Full().substr(0, uscore) );
ReplicaExt_.assign( fname.Full().substr(uscore+1) );
extChar_ = '_';
if (debugIn > 0)
mprintf("\tREMDTRAJ: CHARMM style replica names detected, prefix='%s' ext='%s'\n",
Prefix_.c_str(), ReplicaExt_.c_str());
}
}
// Check that the numerical extension is valid.
if ( !validInteger(ReplicaExt_) ) {
mprinterr("Error: Replica extension [%s] is not an integer.\n", ReplicaExt_.c_str());
Prefix_.clear(); // Empty Prefix_ indicates error.
return;
}
ExtWidth_ = (int)ReplicaExt_.size();
if (debugIn > 1)
mprintf("\tREMDTRAJ: Numerical Extension width=%i\n", ExtWidth_);
// Store lowest replica number
lowestRepnum_ = convertToInteger( ReplicaExt_ );
// TODO: Do not allow negative replica numbers?
if (debugIn > 1)
mprintf("\tREMDTRAJ: index of first replica = %i\n", lowestRepnum_);
}
示例2: GetCpptrajFileIdx
/** \return Index of CpptrajFile with specified file name if it exists in
* the list, otherwise return -1. Must match full path.
*/
int DataFileList::GetCpptrajFileIdx(FileName const& nameIn) const {
if (!nameIn.empty()) {
for (int idx = 0; idx != (int)cfList_.size(); idx++)
if (nameIn.Full() == cfList_[idx]->Filename().Full()) return idx;
}
return -1;
}
示例3: ReadData
// TODO: Set dimension labels
// DataIO_Std::ReadData()
int DataIO_Std::ReadData(FileName const& fname,
DataSetList& dsl, std::string const& dsname)
{
int err = 0;
switch ( mode_ ) {
case READ1D:
err = Read_1D(fname.Full(), dsl, dsname);
if (err == IS_ASCII_CMATRIX)
err = ReadCmatrix(fname, dsl, dsname);
break;
case READ2D: err = Read_2D(fname.Full(), dsl, dsname); break;
case READ3D: err = Read_3D(fname.Full(), dsl, dsname); break;
case READVEC: err = Read_Vector(fname.Full(), dsl, dsname); break;
case READMAT3X3: err = Read_Mat3x3(fname.Full(), dsl, dsname); break;
}
return err;
}