#include <Utilities/General/interface/FileInPath.h>
Public Types | |
typedef std::string | String |
Public Member Functions | |
FileInPath (const FileInPath &rh) | |
FileInPath (const String &ipath, const String &ifile) | |
constructor | |
const String & | name () const |
return full name | |
std::ifstream * | operator() () |
return stream | |
FileInPath & | operator= (const FileInPath &rh) |
and usual operator | |
~FileInPath () | |
destructor | |
Private Member Functions | |
void | init (const String &ipath, const String &ifile) |
Private Attributes | |
std::vector< String > | directories |
String | file |
own_ptr< std::ifstream > | in |
Static Private Attributes | |
static const String | semicolon |
Definition at line 14 of file FileInPath.h.
typedef std::string FileInPath::String |
Definition at line 16 of file FileInPath.h.
FileInPath::FileInPath | ( | const FileInPath & | rh | ) |
Definition at line 25 of file FileInPath.cc.
References file, own_ptr< X, P >::get(), and in.
00025 : 00026 directories(rh.directories), file(rh.file) { 00027 if (rh.in.get()) in = own_ptr<std::ifstream>(new std::ifstream(file.c_str())); 00028 }
FileInPath::~FileInPath | ( | ) |
Definition at line 12 of file FileInPath.cc.
References d, directories, file, in, own_ptr< X, P >::release(), and semicolon.
Referenced by FileInPath().
00012 { 00013 if (ipath.empty()||ifile.empty()) return; 00014 00015 directories = Tokenizer(semicolon,ipath); 00016 typedef std::vector<std::string>::const_iterator Itr; 00017 for (Itr d=directories.begin(); d!=directories.end(); d++) { 00018 file = *d; file += "/"; file += ifile; 00019 in = own_ptr<std::ifstream>(new std::ifstream(file.c_str())); 00020 if (in->good()) break; 00021 } 00022 if (!in->good()) { in.release(); file="";} 00023 }
return full name
Definition at line 34 of file FileInPath.h.
References file.
Referenced by FMGLfromL3EfficiencyHandler::FMGLfromL3EfficiencyHandler(), FMGLfromL3TKEfficiencyHandler::FMGLfromL3TKEfficiencyHandler(), FMGLfromTKEfficiencyHandler::FMGLfromTKEfficiencyHandler(), FML1EfficiencyHandler::FML1EfficiencyHandler(), FML1PtSmearer::FML1PtSmearer(), FML3EfficiencyHandler::FML3EfficiencyHandler(), and CSCGasCollisions::readCollisionTable().
00034 { return file;}
std::ifstream* FileInPath::operator() | ( | void | ) | [inline] |
return stream
Definition at line 31 of file FileInPath.h.
References own_ptr< X, P >::get(), and in.
FileInPath & FileInPath::operator= | ( | const FileInPath & | rh | ) |
and usual operator
Definition at line 31 of file FileInPath.cc.
References directories, file, own_ptr< X, P >::get(), and in.
00031 { 00032 directories = rh.directories; 00033 file = rh.file; 00034 if (rh.in.get()&&(!file.empty())) in = own_ptr<std::ifstream>(new std::ifstream(file.c_str())); 00035 return *this; 00036 }
std::vector<String> FileInPath::directories [private] |
String FileInPath::file [private] |
Definition at line 42 of file FileInPath.h.
Referenced by FileInPath(), init(), name(), and operator=().
own_ptr<std::ifstream> FileInPath::in [private] |
Definition at line 43 of file FileInPath.h.
Referenced by FileInPath(), init(), operator()(), and operator=().
const std::string FileInPath::semicolon [static, private] |