RawFileTools Namespace Reference


Functions

std::vector< std::stringwildcard_correct (const std::string &fname)
std::vector< std::stringwildcard_correct (const std::vector< std::string > &fnames)
std::string fname2idxname (const std::string &fname)
std::string itoa (int i)
std::vector< std::stringwildcard_correct (const std::string &fname)
std::vector< std::stringwildcard_correct (const std::vector< std::string > &fnames)
std::string fname2idxname (const std::string &fname)
std::string itoa (int i)


Function Documentation

std::vector<std::string> RawFileTools::wildcard_correct ( const std::string fname  ) 

Definition at line 6 of file RawFileTools.cxx.

Referenced by RawFileReader::getEventNumber(), main(), and RawFileReader::RawFileReader().

00007 {
00008    static char pbuf[8192];
00009    static const std::string lsCom("/bin/ls ");
00010 
00011    std::vector<std::string> newfnames;
00012 
00013    if ( ( fname.find('*', 0) != std::string::npos ) ||
00014          ( fname.find('?', 0) != std::string::npos ) )
00015    {
00016       FILE* ftmp = popen((lsCom+fname).c_str(), "r");
00017 
00018       std::stringstream  fnstream;
00019       while ( fgets(pbuf, 8192, ftmp) != NULL ) {
00020          fnstream << pbuf;
00021       }
00022 
00023       std::string tfn;
00024       while ( ! (fnstream>>tfn).eof() ) {
00025          newfnames.push_back(tfn);
00026       }
00027    }
00028    else {
00029       newfnames.push_back(fname);
00030    }
00031 
00032    return newfnames;
00033 }

std::vector<std::string> RawFileTools::wildcard_correct ( const std::vector< std::string > &  fnames  ) 

Definition at line 35 of file RawFileTools.cxx.

References fname, RealDBUtil::npos, and deljobs::string.

00036 {
00037    static char pbuf[8192];
00038    static const std::string lsCom("/bin/ls ");
00039 
00040    std::vector<std::string> newfnames;
00041    std::string fname;
00042    std::stringstream  fnstream;
00043    std::vector<std::string>::const_iterator it = fnames.begin();
00044 
00045    while ( it != fnames.end() ) {
00046       if ( ( it->find('*', 0) != std::string::npos ) ||
00047            ( it->find('?', 0) != std::string::npos ) ) {
00048          // list and get the wildcard files
00049          std::string com = lsCom + (*it);
00050          FILE* ftmp = popen(com.c_str(), "r");
00051 
00052          fnstream.clear();
00053          while ( fgets(pbuf, 8192, ftmp) != NULL ) {
00054             fnstream << pbuf;
00055          }
00056 
00057          while ( ! (fnstream>>fname).eof() ) {
00058             newfnames.push_back(fname);
00059          }
00060       }
00061       else {
00062          newfnames.push_back(*it);
00063       }
00064       ++it;
00065    }
00066 
00067    return newfnames;
00068 }

std::string RawFileTools::fname2idxname ( const std::string fname  ) 

Definition at line 70 of file RawFileTools.cxx.

References RealDBUtil::npos, and deljobs::string.

Referenced by main().

00071 {
00072    std::string::size_type pathend = fname.rfind('/', fname.length());
00073    std::string idxname = (pathend != std::string::npos ) ? fname.substr(pathend+1) : fname;
00074 
00075    idxname += ".idx";
00076 
00077    return idxname;
00078 }

std::string RawFileTools::itoa ( int  i  ) 

Definition at line 80 of file RawFileTools.cxx.

References deljobs::string.

Referenced by calibUtil::Metadata::adjustVend(), rdbModel::MysqlConnection::dbRequest(), doUpdate(), xmlBase::XmlErrorHandler::error(), xmlBase::XmlErrorHandler::fatalError(), calibUtil::Metadata::findBest(), calibUtil::Metadata::findSoonAfter(), calibUtil::Metadata::getReadInfo(), main(), raw_ofstream::real_fname(), calibUtil::Metadata::registerCalib(), rdbModel::MysqlConnection::select(), and rdbModel::Table::supersedeRow().

00081 {
00082    std::stringstream  sstr;
00083    sstr << i;
00084 
00085    std::string str;
00086    sstr >> str;
00087 
00088    while ( str.length() < 3 ) {
00089       str = std::string("0") + str;
00090    }
00091 
00092    return str;
00093 }

std::vector<std::string> RawFileTools::wildcard_correct ( const std::string fname  ) 

Definition at line 6 of file RawFileTools.cxx.

References EvtCyclic3::c_str(), RealDBUtil::npos, and deljobs::string.

00007 {
00008    static char pbuf[8192];
00009    static const std::string lsCom("/bin/ls ");
00010 
00011    std::vector<std::string> newfnames;
00012 
00013    if ( ( fname.find('*', 0) != std::string::npos ) ||
00014          ( fname.find('?', 0) != std::string::npos ) )
00015    {
00016       FILE* ftmp = popen((lsCom+fname).c_str(), "r");
00017 
00018       std::stringstream  fnstream;
00019       while ( fgets(pbuf, 8192, ftmp) != NULL ) {
00020          fnstream << pbuf;
00021       }
00022 
00023       std::string tfn;
00024       while ( ! (fnstream>>tfn).eof() ) {
00025          newfnames.push_back(tfn);
00026       }
00027    }
00028    else {
00029       newfnames.push_back(fname);
00030    }
00031 
00032    return newfnames;
00033 }

std::vector<std::string> RawFileTools::wildcard_correct ( const std::vector< std::string > &  fnames  ) 

Definition at line 35 of file RawFileTools.cxx.

References fname, RealDBUtil::npos, and deljobs::string.

00036 {
00037    static char pbuf[8192];
00038    static const std::string lsCom("/bin/ls ");
00039 
00040    std::vector<std::string> newfnames;
00041    std::string fname;
00042    std::stringstream  fnstream;
00043    std::vector<std::string>::const_iterator it = fnames.begin();
00044 
00045    while ( it != fnames.end() ) {
00046       if ( ( it->find('*', 0) != std::string::npos ) ||
00047            ( it->find('?', 0) != std::string::npos ) ) {
00048          // list and get the wildcard files
00049          std::string com = lsCom + (*it);
00050          FILE* ftmp = popen(com.c_str(), "r");
00051 
00052          fnstream.clear();
00053          while ( fgets(pbuf, 8192, ftmp) != NULL ) {
00054             fnstream << pbuf;
00055          }
00056 
00057          while ( ! (fnstream>>fname).eof() ) {
00058             newfnames.push_back(fname);
00059          }
00060       }
00061       else {
00062          newfnames.push_back(*it);
00063       }
00064       ++it;
00065    }
00066 
00067    return newfnames;
00068 }

std::string RawFileTools::fname2idxname ( const std::string fname  ) 

Definition at line 70 of file RawFileTools.cxx.

References RealDBUtil::npos, and deljobs::string.

Referenced by main().

00071 {
00072    std::string::size_type pathend = fname.rfind('/', fname.length());
00073    std::string idxname = (pathend != std::string::npos ) ? fname.substr(pathend+1) : fname;
00074 
00075    idxname += ".idx";
00076 
00077    return idxname;
00078 }

std::string RawFileTools::itoa ( int  i  ) 

Definition at line 80 of file RawFileTools.cxx.

References deljobs::string.

Referenced by calibUtil::Metadata::adjustVend(), rdbModel::MysqlConnection::dbRequest(), doUpdate(), xmlBase::XmlErrorHandler::error(), xmlBase::XmlErrorHandler::fatalError(), calibUtil::Metadata::findBest(), calibUtil::Metadata::findSoonAfter(), calibUtil::Metadata::getReadInfo(), main(), raw_ofstream::real_fname(), calibUtil::Metadata::registerCalib(), rdbModel::MysqlConnection::select(), and rdbModel::Table::supersedeRow().

00081 {
00082    std::stringstream  sstr;
00083    sstr << i;
00084 
00085    std::string str;
00086    sstr >> str;
00087 
00088    while ( str.length() < 3 ) {
00089       str = std::string("0") + str;
00090    }
00091 
00092    return str;
00093 }


Generated on Tue Nov 29 23:36:35 2016 for BOSS_7.0.2 by  doxygen 1.4.7