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 33 of file RunFinder.cxx.

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

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

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

Definition at line 27 of file RunFinder.cxx.

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

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

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

Definition at line 21 of file RunFinder.cxx.

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

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

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

Definition at line 15 of file RunFinder.cxx.

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

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

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

Definition at line 48 of file RunFinder.cxx.

References infile.

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

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


Generated on Fri Mar 28 16:15:56 2008 for loon by  doxygen 1.3.9.1