Anp::Finder Namespace Reference

Classes

struct  File

Functions

bool operator== (const std::string &lhs, const File &rhs)
bool operator== (const File &lhs, const std::string &rhs)
bool operator< (const File &lhs, const File &rhs)
double file_size (const std::string &path)
const std::vector< std::string > read_file (const std::string &file)

Function Documentation

double Anp::Finder::file_size ( const std::string &  path  ) 

Definition at line 36 of file RunFinder.cxx.

References stat.

Referenced by Anp::RunFinder::GetFileSize().

00037 {
00038    //
00039    // Return file size in megabytes
00040    //
00041    struct stat result;
00042    if(stat(path.c_str(), &result) != 0)
00043    {
00044       return 0.0;
00045    }
00046    
00047    return double(result.st_size)/1038336.0;
00048 }

bool Anp::Finder::operator< ( const File &  lhs,
const File &  rhs 
)

Definition at line 30 of file RunFinder.cxx.

References Anp::Finder::File::name.

00031 {
00032    return (lhs.name < rhs.name);
00033 }

bool Anp::Finder::operator== ( const File &  lhs,
const std::string &  rhs 
)

Definition at line 24 of file RunFinder.cxx.

References Anp::Finder::File::name.

00025 {
00026    return (lhs.name == rhs);
00027 }

bool Anp::Finder::operator== ( const std::string &  lhs,
const File &  rhs 
)

Definition at line 18 of file RunFinder.cxx.

References Anp::Finder::File::name.

00019 {
00020    return (lhs == rhs.name);
00021 }

const std::vector< std::string > Anp::Finder::read_file ( const std::string &  file  ) 

Definition at line 51 of file RunFinder.cxx.

References infile.

Referenced by Anp::RunFinder::AddIndex().

00052 {
00053    std::vector<std::string> svec;
00054 
00055    std::ifstream infile(file.c_str());
00056    if(!infile || !infile.is_open())
00057    {
00058       std::cout << "Error! Cannot open file:" << file << std::endl;
00059       return svec;
00060    }
00061 
00062    while(infile.good())
00063    {
00064       std::string instr;
00065       std::getline(infile, instr);
00066 
00067       if(instr.size() < 6)
00068       {
00069          continue;
00070       }
00071 
00072       svec.push_back(instr);
00073    }
00074 
00075    infile.close();
00076 
00077    return svec;
00078 }


Generated on 21 Jun 2018 for loon by  doxygen 1.6.1