#include <InputFileCatalog.h>
Public Member Functions | |
bool | empty () const |
std::vector< std::string > const & | fallbackFileNames () const |
std::vector< FileCatalogItem > const & | fileCatalogItems () const |
std::vector< std::string > const & | fileNames () const |
InputFileCatalog (std::vector< std::string > const &fileNames, std::string const &override, std::string const &overrideFallback, bool noThrow=false) | |
InputFileCatalog (std::vector< std::string > const &fileNames, std::string const &override, bool noThrow=false) | |
std::vector< std::string > const & | logicalFileNames () const |
~InputFileCatalog () | |
Static Public Member Functions | |
static bool | isPhysical (std::string const &name) |
Private Member Functions | |
void | findFile (std::string &pfn, std::string &fallbackPfn, std::string const &lfn, bool noThrow) |
void | init (std::vector< std::string > const &fileNames, std::string const &override, std::string const &overrideFallback, bool noThrow) |
Private Attributes | |
boost::scoped_ptr< FileLocator > | fallbackFileLocator_ |
std::vector< std::string > | fallbackFileNames_ |
std::vector< FileCatalogItem > | fileCatalogItems_ |
boost::scoped_ptr< FileLocator > | fileLocator_ |
std::vector< std::string > | fileNames_ |
std::vector< std::string > | logicalFileNames_ |
boost::scoped_ptr< FileLocator > | overrideFallbackFileLocator_ |
boost::scoped_ptr< FileLocator > | overrideFileLocator_ |
Definition at line 28 of file InputFileCatalog.h.
edm::InputFileCatalog::InputFileCatalog | ( | std::vector< std::string > const & | fileNames, |
std::string const & | override, | ||
bool | noThrow = false |
||
) |
Definition at line 14 of file InputFileCatalog.cc.
References init().
: logicalFileNames_(fileNames), fileNames_(fileNames), fallbackFileNames_(fileNames.size()), fileCatalogItems_(), fileLocator_(), overrideFileLocator_(), fallbackFileLocator_(), overrideFallbackFileLocator_() { init(fileNames, override, "", noThrow); }
edm::InputFileCatalog::InputFileCatalog | ( | std::vector< std::string > const & | fileNames, |
std::string const & | override, | ||
std::string const & | overrideFallback, | ||
bool | noThrow = false |
||
) |
Definition at line 27 of file InputFileCatalog.cc.
References init().
: logicalFileNames_(fileNames), fileNames_(fileNames), fallbackFileNames_(fileNames.size()), fileCatalogItems_(), fileLocator_(), overrideFileLocator_(), fallbackFileLocator_(), overrideFallbackFileLocator_() { init(fileNames, override, overrideFallback, noThrow); }
edm::InputFileCatalog::~InputFileCatalog | ( | ) |
Definition at line 40 of file InputFileCatalog.cc.
{}
bool edm::InputFileCatalog::empty | ( | void | ) | const [inline] |
Definition at line 37 of file InputFileCatalog.h.
References fileCatalogItems_.
Referenced by edm::EDInputSource::EDInputSource().
{return fileCatalogItems_.empty();}
std::vector<std::string> const& edm::InputFileCatalog::fallbackFileNames | ( | ) | const [inline] |
Definition at line 36 of file InputFileCatalog.h.
References fallbackFileNames_.
{return fallbackFileNames_;}
std::vector<FileCatalogItem> const& edm::InputFileCatalog::fileCatalogItems | ( | ) | const [inline] |
Definition at line 33 of file InputFileCatalog.h.
References fileCatalogItems_.
Referenced by edm::EDInputSource::fileCatalogItems(), and edm::RootInputFileSequence::fileCatalogItems().
{return fileCatalogItems_;}
std::vector<std::string> const& edm::InputFileCatalog::fileNames | ( | ) | const [inline] |
Definition at line 35 of file InputFileCatalog.h.
References fileNames_.
Referenced by DQMFileReader::beginJob(), DQMRootSource::DQMRootSource(), edm::ExternalInputSource::fileNames(), edm::EDInputSource::fileNames(), DQMRootSource::readFile_(), DQMRootSource::readNextItemType(), DQMRootSource::setupFile(), and edm::StreamerFileReader::StreamerFileReader().
{return fileNames_;}
void edm::InputFileCatalog::findFile | ( | std::string & | pfn, |
std::string & | fallbackPfn, | ||
std::string const & | lfn, | ||
bool | noThrow | ||
) | [private] |
Definition at line 80 of file InputFileCatalog.cc.
References Exception, fallbackFileLocator_, fileLocator_, overrideFallbackFileLocator_, and overrideFileLocator_.
Referenced by init().
{ if (overrideFileLocator_) { pfn = overrideFileLocator_->pfn(lfn); if (pfn.empty()) { pfn = fileLocator_->pfn(lfn); } } else { pfn = fileLocator_->pfn(lfn); } if (pfn.empty()) { if (!noThrow) { throw cms::Exception("LogicalFileNameNotFound", "FileCatalog::findFile()\n") << "Logical file name '" << lfn << "' was not found in the file catalog.\n" << "If you wanted a local file, you forgot the 'file:' prefix\n" << "before the file name in your configuration file.\n"; } pfn = lfn; } if (overrideFallbackFileLocator_) { fallbackPfn = overrideFallbackFileLocator_->pfn(lfn); if (fallbackFileLocator_ && fallbackPfn.empty()) { fallbackPfn = fallbackFileLocator_->pfn(lfn); } } else if (fallbackFileLocator_) { fallbackPfn = fallbackFileLocator_->pfn(lfn); // Empty fallback PFN is OK. } }
void edm::InputFileCatalog::init | ( | std::vector< std::string > const & | fileNames, |
std::string const & | override, | ||
std::string const & | overrideFallback, | ||
bool | noThrow | ||
) | [private] |
Definition at line 42 of file InputFileCatalog.cc.
References edm::errors::Configuration, Exception, fallbackFileLocator_, fallbackFileNames_, fileCatalogItems_, fileLocator_, fileNames_, findFile(), isPhysical(), logicalFileNames_, lt, overrideFallbackFileLocator_, and overrideFileLocator_.
Referenced by InputFileCatalog().
{ fileCatalogItems_.reserve(fileNames_.size()); typedef std::vector<std::string>::iterator iter; for(iter it = fileNames_.begin(), lt = logicalFileNames_.begin(), itEnd = fileNames_.end(), ft = fallbackFileNames_.begin(); it != itEnd; ++it, ++lt, ++ft) { boost::trim(*it); if (it->empty()) { throw Exception(errors::Configuration, "InputFileCatalog::InputFileCatalog()\n") << "An empty string specified in the fileNames parameter for input source.\n"; } if (isPhysical(*it)) { // Clear the LFN. lt->clear(); } else { if (!fileLocator_) { fileLocator_.reset(new FileLocator("", false)); } if (!overrideFileLocator_ && !inputOverride.empty()) { overrideFileLocator_.reset(new FileLocator(inputOverride, false)); } if (!fallbackFileLocator_) { try { fallbackFileLocator_.reset(new FileLocator("", true)); } catch (cms::Exception const& e) { // No valid fallback locator is OK too. } } if (!overrideFallbackFileLocator_ && !inputOverrideFallback.empty()) { overrideFallbackFileLocator_.reset(new FileLocator(inputOverrideFallback, true)); } boost::trim(*lt); findFile(*it, *ft, *lt, noThrow); } fileCatalogItems_.push_back(FileCatalogItem(*it, *lt, *ft)); } }
static bool edm::InputFileCatalog::isPhysical | ( | std::string const & | name | ) | [inline, static] |
Definition at line 38 of file InputFileCatalog.h.
Referenced by init().
std::vector<std::string> const& edm::InputFileCatalog::logicalFileNames | ( | ) | const [inline] |
Definition at line 34 of file InputFileCatalog.h.
References logicalFileNames_.
Referenced by edm::ExternalInputSource::logicalFileNames(), edm::EDInputSource::logicalFileNames(), and DQMRootSource::readFile_().
{return logicalFileNames_;}
boost::scoped_ptr<FileLocator> edm::InputFileCatalog::fallbackFileLocator_ [private] |
Definition at line 51 of file InputFileCatalog.h.
Referenced by findFile(), and init().
std::vector<std::string> edm::InputFileCatalog::fallbackFileNames_ [private] |
Definition at line 47 of file InputFileCatalog.h.
Referenced by fallbackFileNames(), and init().
std::vector<FileCatalogItem> edm::InputFileCatalog::fileCatalogItems_ [private] |
Definition at line 48 of file InputFileCatalog.h.
Referenced by empty(), fileCatalogItems(), and init().
boost::scoped_ptr<FileLocator> edm::InputFileCatalog::fileLocator_ [private] |
Definition at line 49 of file InputFileCatalog.h.
Referenced by findFile(), and init().
std::vector<std::string> edm::InputFileCatalog::fileNames_ [private] |
Definition at line 46 of file InputFileCatalog.h.
Referenced by fileNames(), and init().
std::vector<std::string> edm::InputFileCatalog::logicalFileNames_ [private] |
Definition at line 45 of file InputFileCatalog.h.
Referenced by init(), and logicalFileNames().
boost::scoped_ptr<FileLocator> edm::InputFileCatalog::overrideFallbackFileLocator_ [private] |
Definition at line 52 of file InputFileCatalog.h.
Referenced by findFile(), and init().
boost::scoped_ptr<FileLocator> edm::InputFileCatalog::overrideFileLocator_ [private] |
Definition at line 50 of file InputFileCatalog.h.
Referenced by findFile(), and init().