File indexing completed on 2024-04-06 12:02:30
0001 #ifndef CondFormats_RPCObjects_RPCDCCLink_h
0002 #define CondFormats_RPCObjects_RPCDCCLink_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 RPCDCCLink {
0013 public:
0014 static int const wildcard_ = INT_MIN;
0015
0016
0017
0018 static int const min_fed_ = 0;
0019 static int const max_fed_ = 65534;
0020 static int const min_dccinput_ = 0;
0021 static int const max_dccinput_ = 36;
0022 static int const min_tbinput_ = 0;
0023 static int const max_tbinput_ = 18;
0024
0025
0026 protected:
0027
0028
0029 static int const pos_fed_ = 16;
0030 static std::uint32_t const mask_fed_ = 0xffff0000;
0031 static int const pos_dccinput_ = 8;
0032 static std::uint32_t const mask_dccinput_ = 0x0000ff00;
0033 static int const pos_tbinput_ = 0;
0034 static std::uint32_t const mask_tbinput_ = 0x000000ff;
0035
0036
0037 public:
0038 RPCDCCLink();
0039 RPCDCCLink(std::uint32_t const& id);
0040 RPCDCCLink(int fed, int dccinput, int tbinput = wildcard_);
0041
0042 std::uint32_t getId() const;
0043 operator std::uint32_t() const;
0044 std::uint32_t getMask() const;
0045
0046 bool matches(RPCDCCLink const& rhs) const;
0047
0048 void setId(std::uint32_t const& id);
0049 void reset();
0050
0051
0052
0053 int getFED() const;
0054 int getDCCInput() const;
0055 int getTBInput() const;
0056
0057
0058
0059
0060
0061
0062 RPCDCCLink& setFED(int fed = wildcard_);
0063 RPCDCCLink& setDCCInput(int dccinput = wildcard_);
0064 RPCDCCLink& setTBInput(int tbinput = wildcard_);
0065
0066
0067 std::string getName() const;
0068
0069 bool operator<(RPCDCCLink const& rhs) const;
0070 bool operator==(RPCDCCLink const& rhs) const;
0071 bool operator!=(RPCDCCLink const& rhs) const;
0072 bool operator<(std::uint32_t const& rhs) const;
0073 bool operator==(std::uint32_t const& rhs) const;
0074 bool operator!=(std::uint32_t const& rhs) const;
0075
0076 RPCDCCLink& operator++();
0077 RPCDCCLink operator++(int);
0078 RPCDCCLink& operator--();
0079 RPCDCCLink operator--(int);
0080
0081 protected:
0082 int bf_get(int const min, std::uint32_t const mask, int const pos) const;
0083 RPCDCCLink& bf_set(int const min, int const max, std::uint32_t const mask, int const pos, int const value);
0084 std::ostream& bf_stream(std::ostream& ostream, int const min, std::uint32_t const mask, int const pos) const;
0085
0086 protected:
0087 std::uint32_t id_;
0088
0089 COND_SERIALIZABLE;
0090 };
0091
0092 std::ostream& operator<<(std::ostream& ostream, RPCDCCLink const& link);
0093
0094 #include "CondFormats/RPCObjects/interface/RPCDCCLink.icc"
0095
0096 #endif