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 
5 #include <string>
6 #include <list>
7 #include <map>
8 #include <utility>
9 #include <regex>
10 #include "tinyxml2.h"
11 #include <boost/property_tree/ptree.hpp>
12 
13 namespace edm {
14 
15  class FileLocator {
16  public:
17  explicit FileLocator(
18  edm::CatalogAttributes const& catAttr,
19  unsigned iCatalog = 0,
20  //storageDescriptionPath is used to override path provided by SiteLocalConfig. This is used in FileLocator_t.cpp tests
21  std::string const& storageDescriptionPath = std::string());
22  explicit FileLocator(std::string const& catUrl, unsigned iCatalog = 0);
23 
24  ~FileLocator();
25 
26  std::string pfn(std::string const& ilfn, edm::CatalogType catType) const;
27 
28  private:
32  static int s_numberOfInstances;
33 
34  struct Rule {
35  std::regex pathMatch;
36  std::regex destinationMatch;
39  };
40 
41  typedef std::vector<Rule> Rules;
42  typedef std::map<std::string, Rules> ProtocolRules;
43 
44  void init_trivialCatalog(std::string const& catUrl, unsigned iCatalog);
45  void parseRuleTrivialCatalog(tinyxml2::XMLElement* ruleNode, ProtocolRules& rules);
46  //using data-access
47  void init(edm::CatalogAttributes const& input_dataCatalog,
48  unsigned iCatalog,
49  std::string const& storageDescriptionPath);
50  void parseRule(boost::property_tree::ptree::value_type const& storageRule,
51  std::string const& protocol,
53 
54  std::string applyRules(ProtocolRules const& protocolRules,
55  std::string const& protocol,
56  std::string const& destination,
57  bool direct,
58  std::string name) const;
59 
60  std::string convert(std::string const& input, ProtocolRules const& rules, bool direct) const;
61 
68 
71  std::vector<std::string> m_protocols;
74  };
75 } // namespace edm
76 
77 #endif // FWCore_Catalog_FileLocator_h
ProtocolRules m_directRules_trivialCatalog
Definition: FileLocator.h:63
std::map< std::string, Rules > ProtocolRules
Definition: FileLocator.h:42
FileLocator(edm::CatalogAttributes const &catAttr, unsigned iCatalog=0, std::string const &storageDescriptionPath=std::string())
Definition: FileLocator.cc:53
static int s_numberOfInstances
Definition: FileLocator.h:32
std::string m_destination
Definition: FileLocator.h:72
std::string pfn(std::string const &ilfn, edm::CatalogType catType) const
Definition: FileLocator.cc:62
static std::string const input
Definition: EdmProvDump.cc:50
ProtocolRules m_inverseRules
Definition: FileLocator.h:65
std::string m_filename
Definition: FileLocator.h:70
std::string m_fileType
Definition: FileLocator.h:69
std::string m_prefix
Definition: FileLocator.h:73
void init_trivialCatalog(std::string const &catUrl, unsigned iCatalog)
Definition: FileLocator.cc:129
void init(edm::CatalogAttributes const &input_dataCatalog, unsigned iCatalog, std::string const &storageDescriptionPath)
Definition: FileLocator.cc:223
ProtocolRules m_directRules
Definition: FileLocator.h:67
std::vector< Rule > Rules
Definition: FileLocator.h:41
HLT enums.
std::vector< std::string > m_protocols
Definition: FileLocator.h:71
void parseRuleTrivialCatalog(tinyxml2::XMLElement *ruleNode, ProtocolRules &rules)
Definition: FileLocator.cc:90
void parseRule(boost::property_tree::ptree::value_type const &storageRule, std::string const &protocol, ProtocolRules &rules)
Definition: FileLocator.cc:113
std::string convert(std::string const &input, ProtocolRules const &rules, bool direct) const
Definition: FileLocator.cc:68
std::string applyRules(ProtocolRules const &protocolRules, std::string const &protocol, std::string const &destination, bool direct, std::string name) const
Definition: FileLocator.cc:316
std::regex destinationMatch
Definition: FileLocator.h:36