File indexing completed on 2024-04-06 12:05:01
0001 #ifndef DataFormats_Provenance_BranchID_h
0002 #define DataFormats_Provenance_BranchID_h
0003
0004
0005
0006
0007
0008
0009
0010 #include <iosfwd>
0011 #include <string>
0012
0013 namespace edm {
0014 class BranchID {
0015 public:
0016 typedef unsigned int value_type;
0017 BranchID() : id_(0) {}
0018 explicit BranchID(std::string const& branchName) : id_(toID(branchName)) {}
0019 explicit BranchID(value_type theID) : id_(theID) {}
0020 void setID(std::string const& branchName) { id_ = toID(branchName); }
0021 unsigned int id() const { return id_; }
0022 bool isValid() const { return id_ != 0; }
0023
0024 bool operator<(BranchID const& rh) const { return id_ < rh.id_; }
0025 bool operator>(BranchID const& rh) const { return id_ > rh.id_; }
0026 bool operator==(BranchID const& rh) const { return id_ == rh.id_; }
0027 bool operator!=(BranchID const& rh) const { return id_ != rh.id_; }
0028
0029 private:
0030 static value_type toID(std::string const& branchName);
0031 value_type id_;
0032 };
0033
0034 std::ostream& operator<<(std::ostream& os, BranchID const& id);
0035 }
0036 #endif