Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Anp::Finder Namespace Reference


Classes

struct  Anp::Finder::File

Functions

bool operator== (const std::string &lhs, const File &rhs)
bool operator== (const File &lhs, const std::string &lhs)
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 32 of file RunFinder.cxx.

Referenced by Anp::RunFinder::Add(), Anp::RunFinder::AddDir(), and Anp::RunFinder::GetFileSize().

00033 {
00034    struct stat result;
00035    if(stat(path.c_str(), &result) != 0)
00036    {
00037       return 0.0;
00038    }
00039    
00040    return double(result.st_size)/1038336;
00041 }

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

Definition at line 26 of file RunFinder.cxx.

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

00027 {
00028    return (lhs.name < rhs.name);
00029 }

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

Definition at line 20 of file RunFinder.cxx.

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

00021 {
00022    return (lhs.name == rhs);
00023 }

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

Definition at line 14 of file RunFinder.cxx.

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

00015 {
00016    return (lhs == rhs.name);
00017 }

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

Definition at line 44 of file RunFinder.cxx.

References infile.

Referenced by Anp::RunFinder::Add(), and Anp::RunFinder::AddIndex().

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


Generated on Thu Nov 1 12:02:13 2007 for loon by  doxygen 1.3.9.1