CMS 3D CMS Logo

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 <regex>
9 #include "tinyxml2.h"
10 
11 namespace edm {
12 
13  class FileLocator {
14  public:
15  explicit FileLocator(std::string const& catUrl, bool fallback);
16  ~FileLocator();
17 
18  std::string pfn(std::string const& ilfn) const;
19  std::string lfn(std::string const& ipfn) const;
20 
21  private:
25  static int s_numberOfInstances;
26 
27  struct Rule {
28  std::regex pathMatch;
29  std::regex destinationMatch;
32  };
33 
34  typedef std::vector<Rule> Rules;
35  typedef std::map<std::string, Rules> ProtocolRules;
36 
37  void init(std::string const& catUrl, bool fallback);
38 
39  void parseRule(tinyxml2::XMLElement* ruleNode, ProtocolRules& rules);
40 
41  std::string applyRules(ProtocolRules const& protocolRules,
42  std::string const& protocol,
43  std::string const& destination,
44  bool direct,
45  std::string name) const;
46 
47  std::string convert(std::string const& input, ProtocolRules const& rules, bool direct) const;
48 
50  ProtocolRules m_directRules;
52  ProtocolRules m_inverseRules;
53 
56  std::vector<std::string> m_protocols;
58  };
59 } // namespace edm
60 
61 #endif // FWCore_Catalog_FileLocator_h
std::map< std::string, Rules > ProtocolRules
Definition: FileLocator.h:35
static int s_numberOfInstances
Definition: FileLocator.h:25
std::string lfn(std::string const &ipfn) const
Definition: FileLocator.cc:57
std::string m_destination
Definition: FileLocator.h:57
static std::string const input
Definition: EdmProvDump.cc:48
ProtocolRules m_inverseRules
Definition: FileLocator.h:52
std::string convert(std::string const &input, ProtocolRules const &rules, bool direct) const
Definition: FileLocator.cc:59
std::string pfn(std::string const &ilfn) const
Definition: FileLocator.cc:55
std::string m_filename
Definition: FileLocator.h:55
std::string m_fileType
Definition: FileLocator.h:54
FileLocator(std::string const &catUrl, bool fallback)
Definition: FileLocator.cc:46
ProtocolRules m_directRules
Definition: FileLocator.h:50
std::vector< Rule > Rules
Definition: FileLocator.h:34
HLT enums.
std::vector< std::string > m_protocols
Definition: FileLocator.h:56
void parseRule(tinyxml2::XMLElement *ruleNode, ProtocolRules &rules)
Definition: FileLocator.cc:70
std::string applyRules(ProtocolRules const &protocolRules, std::string const &protocol, std::string const &destination, bool direct, std::string name) const
Definition: FileLocator.cc:194
std::regex destinationMatch
Definition: FileLocator.h:29
void init(std::string const &catUrl, bool fallback)
Definition: FileLocator.cc:93