CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FileLocator.h
Go to the documentation of this file.
1 #ifndef FWCore_Catalog_FileLocator_h
2 #define FWCore_Catalog_FileLocator_h
3 
4 #include <string>
5 #include <list>
6 #include <map>
7 #include <utility>
8 #include <boost/regex.hpp>
9 #include <xercesc/dom/DOM.hpp>
10 
11 namespace edm {
12 
13  class FileLocator {
14 
15  public:
16  explicit FileLocator(std::string const& catUrl, bool fallback);
17  ~FileLocator();
18 
19  std::string pfn(std::string const& ilfn) const;
20  std::string lfn(std::string const& ipfn) const;
21 
22  private:
26  static int s_numberOfInstances;
27 
28  struct Rule {
29  boost::regex pathMatch;
30  boost::regex destinationMatch;
33  };
34 
35  typedef std::vector<Rule> Rules;
36  typedef std::map<std::string, Rules> ProtocolRules;
37 
38  void init(std::string const& catUrl, bool fallback);
39 
40  void parseRule(xercesc::DOMNode* ruleNode,
42 
43  std::string applyRules(ProtocolRules const& protocolRules,
44  std::string const& protocol,
45  std::string const& destination,
46  bool direct,
47  std::string name) const;
48 
49  std::string convert(std::string const& input, ProtocolRules const& rules, bool direct) const;
50 
55 
58  std::vector<std::string> m_protocols;
60  };
61 }
62 
63 #endif // FWCore_Catalog_FileLocator_h
std::map< std::string, Rules > ProtocolRules
Definition: FileLocator.h:36
static int s_numberOfInstances
Definition: FileLocator.h:26
std::string lfn(std::string const &ipfn) const
Definition: FileLocator.cc:89
std::string m_destination
Definition: FileLocator.h:59
static std::string const input
Definition: EdmProvDump.cc:43
ProtocolRules m_inverseRules
Definition: FileLocator.h:54
std::string convert(std::string const &input, ProtocolRules const &rules, bool direct) const
Definition: FileLocator.cc:94
std::string pfn(std::string const &ilfn) const
Definition: FileLocator.cc:84
std::string m_filename
Definition: FileLocator.h:57
std::string m_fileType
Definition: FileLocator.h:56
FileLocator(std::string const &catUrl, bool fallback)
Definition: FileLocator.cc:55
ProtocolRules m_directRules
Definition: FileLocator.h:52
std::vector< Rule > Rules
Definition: FileLocator.h:35
void parseRule(xercesc::DOMNode *ruleNode, ProtocolRules &rules)
Definition: FileLocator.cc:106
boost::regex destinationMatch
Definition: FileLocator.h:30
std::vector< std::string > m_protocols
Definition: FileLocator.h:58
boost::regex pathMatch
Definition: FileLocator.h:29
std::string applyRules(ProtocolRules const &protocolRules, std::string const &protocol, std::string const &destination, bool direct, std::string name) const
Definition: FileLocator.cc:246
void init(std::string const &catUrl, bool fallback)
Definition: FileLocator.cc:138