Go to the documentation of this file.00001 #ifndef FWCore_Catalog_FileLocator_h
00002 #define FWCore_Catalog_FileLocator_h
00003
00004 #include <string>
00005 #include <list>
00006 #include <map>
00007 #include <utility>
00008 #include <boost/regex.hpp>
00009 #include <xercesc/dom/DOM.hpp>
00010
00011 namespace edm {
00012
00013 class FileLocator {
00014
00015 public:
00016 explicit FileLocator(std::string const& catUrl, bool fallback);
00017 ~FileLocator();
00018
00019 std::string pfn(std::string const& ilfn) const;
00020 std::string lfn(std::string const& ipfn) const;
00021
00022 private:
00026 static int s_numberOfInstances;
00027
00028 struct Rule {
00029 boost::regex pathMatch;
00030 boost::regex destinationMatch;
00031 std::string result;
00032 std::string chain;
00033 };
00034
00035 typedef std::vector<Rule> Rules;
00036 typedef std::map<std::string, Rules> ProtocolRules;
00037
00038 void init(std::string const& catUrl, bool fallback);
00039
00040 void parseRule(xercesc::DOMNode* ruleNode,
00041 ProtocolRules& rules);
00042
00043 std::string applyRules(ProtocolRules const& protocolRules,
00044 std::string const& protocol,
00045 std::string const& destination,
00046 bool direct,
00047 std::string name) const;
00048
00049 std::string convert(std::string const& input, ProtocolRules const& rules, bool direct) const;
00050
00052 ProtocolRules m_directRules;
00054 ProtocolRules m_inverseRules;
00055
00056 std::string m_fileType;
00057 std::string m_filename;
00058 std::vector<std::string> m_protocols;
00059 std::string m_destination;
00060 };
00061 }
00062
00063 #endif // FWCore_Catalog_FileLocator_h