File indexing completed on 2024-04-06 11:58:13
0001 #ifndef PixelHdwAddress_h
0002 #define PixelHdwAddress_h
0003
0004
0005
0006
0007
0008
0009
0010 #include <iosfwd>
0011 #include <string>
0012
0013 namespace pos {
0014
0015
0016
0017
0018
0019 class PixelHdwAddress;
0020
0021 std::ostream& operator<<(std::ostream& s, const PixelHdwAddress& pixelroc);
0022
0023 class PixelHdwAddress {
0024 public:
0025 PixelHdwAddress();
0026
0027 PixelHdwAddress(int fecnumber,
0028 int mfec,
0029 int mfecchannel,
0030 int hubaddress,
0031 int portaddress,
0032 int rocid,
0033 int fednumber,
0034 int fedchannel,
0035 int fedrocnumber);
0036
0037 unsigned int fecnumber() const { return fecnumber_; }
0038 unsigned int mfec() const { return mfec_; }
0039 unsigned int mfecchannel() const { return mfecchannel_; }
0040 unsigned int hubaddress() const { return hubaddress_; }
0041 unsigned int portaddress() const { return portaddress_; }
0042 unsigned int rocid() const { return rocid_; }
0043 unsigned int fednumber() const { return fednumber_; }
0044 unsigned int fedchannel() const { return fedchannel_; }
0045 unsigned int fedrocnumber() const { return fedrocnumber_; }
0046
0047 friend std::ostream& pos::operator<<(std::ostream& s, const PixelHdwAddress& pixelroc);
0048
0049 bool operator()(const PixelHdwAddress& roc1, const PixelHdwAddress& roc2) const;
0050
0051
0052 const bool operator|=(const PixelHdwAddress& aHdwAddress) const {
0053 return (fecnumber_ == aHdwAddress.fecnumber_ && mfec_ == aHdwAddress.mfec_ &&
0054 mfecchannel_ == aHdwAddress.mfecchannel_ && hubaddress_ == aHdwAddress.hubaddress_ &&
0055 fednumber_ == aHdwAddress.fednumber_ && fedchannel_ == aHdwAddress.fedchannel_);
0056 }
0057
0058 const bool operator<(const PixelHdwAddress& aHdwAddress) const {
0059 if (fednumber_ < aHdwAddress.fednumber_)
0060 return true;
0061 if (fednumber_ > aHdwAddress.fednumber_)
0062 return false;
0063 if (fedchannel_ < aHdwAddress.fedchannel_)
0064 return true;
0065 if (fedchannel_ > aHdwAddress.fedchannel_)
0066 return false;
0067 return (fedrocnumber_ < aHdwAddress.fedrocnumber_);
0068 }
0069
0070 void setAddress(std::string what, int value);
0071 void compare(std::string what, bool& changed, unsigned int newValue, unsigned int& oldValue);
0072
0073 private:
0074 unsigned int fecnumber_;
0075 unsigned int mfec_;
0076 unsigned int mfecchannel_;
0077 unsigned int portaddress_;
0078 unsigned int hubaddress_;
0079 unsigned int rocid_;
0080 unsigned int fednumber_;
0081 unsigned int fedchannel_;
0082 unsigned int fedrocnumber_;
0083 };
0084
0085 }
0086 #endif