File indexing completed on 2024-04-06 12:02:30
0001 #ifndef CondFormats_RPCObjects_RPCLBLink_h
0002 #define CondFormats_RPCObjects_RPCLBLink_h
0003
0004 #include <cstdint>
0005 #include <string>
0006 #include <iosfwd>
0007 #include <climits>
0008
0009 #include "CondFormats/Serialization/interface/Serializable.h"
0010
0011
0012 class RPCLBLink {
0013 public:
0014 static int const wildcard_ = INT_MIN;
0015
0016
0017
0018 static int const min_region_ = 0;
0019 static int const max_region_ = 1;
0020 static int const min_yoke_ = -5;
0021 static int const max_yoke_ = 5;
0022 static int const min_sector_ = 1;
0023 static int const max_sector_ = 12;
0024 static int const min_side_ = 0;
0025 static int const max_side_ = 2;
0026 static int const min_wheelordisk_ = 0;
0027 static int const max_wheelordisk_ = 4;
0028 static int const min_fibre_ = 0;
0029 static int const max_fibre_ = 7;
0030 static int const min_radial_ = 0;
0031 static int const max_radial_ = 1;
0032 static int const min_linkboard_ = 0;
0033 static int const max_linkboard_ = 2;
0034 static int const min_connector_ = 0;
0035 static int const max_connector_ = 5;
0036
0037
0038 protected:
0039
0040
0041 static int const pos_region_ = 24;
0042 static std::uint32_t const mask_region_ = 0x03000000;
0043 static int const pos_yoke_ = 20;
0044 static std::uint32_t const mask_yoke_ = 0x00f00000;
0045 static int const pos_sector_ = 16;
0046 static std::uint32_t const mask_sector_ = 0x000f0000;
0047 static int const pos_side_ = 14;
0048 static std::uint32_t const mask_side_ = 0x0000c000;
0049 static int const pos_wheelordisk_ = 11;
0050 static std::uint32_t const mask_wheelordisk_ = 0x00003800;
0051 static int const pos_fibre_ = 7;
0052 static std::uint32_t const mask_fibre_ = 0x00000780;
0053 static int const pos_radial_ = 5;
0054 static std::uint32_t const mask_radial_ = 0x00000060;
0055 static int const pos_linkboard_ = 3;
0056 static std::uint32_t const mask_linkboard_ = 0x00000018;
0057 static int const pos_connector_ = 0;
0058 static std::uint32_t const mask_connector_ = 0x00000007;
0059
0060
0061 public:
0062 RPCLBLink();
0063 RPCLBLink(std::uint32_t const& id);
0064 RPCLBLink(int region,
0065 int yoke,
0066 int sector = wildcard_,
0067 int side = wildcard_,
0068 int wheelordisk = wildcard_,
0069 int fibre = wildcard_,
0070 int radial = wildcard_,
0071 int linkboard = wildcard_,
0072 int connector = wildcard_);
0073
0074 std::uint32_t getId() const;
0075 operator std::uint32_t() const;
0076 std::uint32_t getMask() const;
0077
0078 bool matches(RPCLBLink const& rhs) const;
0079
0080 void setId(std::uint32_t const& id);
0081 void reset();
0082
0083
0084
0085 int getRegion() const;
0086 int getYoke() const;
0087 int getSector() const;
0088 int getSide() const;
0089 int getWheelOrDisk() const;
0090 int getFibre() const;
0091 int getRadial() const;
0092 int getLinkBoard() const;
0093 int getConnector() const;
0094
0095
0096
0097
0098
0099
0100 RPCLBLink& setRegion(int region = wildcard_);
0101 RPCLBLink& setYoke(int yoke = wildcard_);
0102 RPCLBLink& setSector(int sector = wildcard_);
0103 RPCLBLink& setSide(int side = wildcard_);
0104 RPCLBLink& setWheelOrDisk(int wheelordisk = wildcard_);
0105 RPCLBLink& setFibre(int fibre = wildcard_);
0106 RPCLBLink& setRadial(int radial = wildcard_);
0107 RPCLBLink& setLinkBoard(int linkboard = wildcard_);
0108 RPCLBLink& setConnector(int connector = wildcard_);
0109
0110
0111 std::string getName() const;
0112
0113 bool operator<(RPCLBLink const& rhs) const;
0114 bool operator==(RPCLBLink const& rhs) const;
0115 bool operator!=(RPCLBLink const& rhs) const;
0116 bool operator<(std::uint32_t const& rhs) const;
0117 bool operator==(std::uint32_t const& rhs) const;
0118 bool operator!=(std::uint32_t const& rhs) const;
0119
0120 RPCLBLink& operator++();
0121 RPCLBLink operator++(int);
0122 RPCLBLink& operator--();
0123 RPCLBLink operator--(int);
0124
0125 protected:
0126 int bf_get(int const min, std::uint32_t const mask, int const pos) const;
0127 RPCLBLink& bf_set(int const min, int const max, std::uint32_t const mask, int const pos, int const value);
0128 std::ostream& bf_stream(std::ostream& ostream, int const min, std::uint32_t const mask, int const pos) const;
0129
0130 protected:
0131 std::uint32_t id_;
0132
0133 COND_SERIALIZABLE;
0134 };
0135
0136 std::ostream& operator<<(std::ostream& ostream, RPCLBLink const& link);
0137
0138 #include "CondFormats/RPCObjects/interface/RPCLBLink.icc"
0139
0140 #endif