CMS 3D CMS Logo

ESInputTag.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Utilities
4 // Class : ESInputTag
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Thu Feb 19 13:01:56 CST 2009
11 //
12 
13 // system include files
14 #include <iostream>
15 #include <vector>
16 
17 // user include files
21 
22 using namespace edm;
23 
24 ESInputTag::ESInputTag() = default;
25 
26 ESInputTag::ESInputTag(const std::string& moduleLabel, const std::string& dataLabel)
27  : module_(moduleLabel), data_(dataLabel) {}
28 
29 ESInputTag::ESInputTag(const std::string& iEncodedValue) {
30  // string is delimited by colons
31  std::vector<std::string> tokens = tokenize(iEncodedValue, ":");
32  int nwords = tokens.size();
33  if (nwords > 2) {
34  throw edm::Exception(errors::Configuration, "ESInputTag")
35  << "ESInputTag " << iEncodedValue << " has " << nwords << " tokens but only up two 2 are allowed.";
36  }
37  if (nwords > 0)
38  module_ = tokens[0];
39  if (nwords > 1)
40  data_ = tokens[1];
41 }
42 
43 //
44 // const member functions
45 //
46 bool ESInputTag::operator==(const edm::ESInputTag& iRHS) const {
47  return module_ == iRHS.module_ && data_ == iRHS.data_;
48 }
49 
51  static std::string const separator(":");
53  if (!data_.empty()) {
54  result += separator + data_;
55  }
56  return result;
57 }
58 
59 namespace edm {
60  std::ostream& operator<<(std::ostream& os, ESInputTag const& tag) {
61  os << "Module label: " << tag.module() << " Data label: " << tag.data();
62  return os;
63  }
64 } // namespace edm
static const char module_[]
std::string data_
Definition: ESInputTag.h:113
const std::string & data() const
Definition: ESInputTag.h:104
std::string encode() const
Definition: ESInputTag.cc:50
std::string module_
Definition: ESInputTag.h:112
HLT enums.
static std::string const separator(":")
const std::string & module() const
Definition: ESInputTag.h:99
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
bool operator==(const edm::ESInputTag &iRHS) const
Definition: ESInputTag.cc:46
std::vector< std::string > tokenize(std::string const &input, std::string const &separator)
breaks the input string into tokens, delimited by the separator