$treeview $search $mathjax $extrastylesheet
otsdaq_components
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_ROCStream_h_ 00002 #define _ots_ROCStream_h_ 00003 00004 #include "otsdaq-components/DetectorConfiguration/ROCDACs.h" 00005 #include "otsdaq-core/Macros/CoutMacros.h" 00006 00007 #include <iostream> 00008 #include <string> 00009 00010 namespace ots 00011 { 00012 class ROCStream 00013 { 00014 public: 00015 ROCStream(void) 00016 : theDetectorID_("") 00017 , theROCType_("") 00018 , theROCStatus_("") 00019 , theFEWROCAddress_(0) 00020 , theROCMask_("") 00021 , theROCTrimBits_("") 00022 { 00023 ; 00024 } 00025 virtual ~ROCStream(void) { ; } 00026 00027 // Setters 00028 void setDetectorID(const std::string& rocName) { theDetectorID_ = rocName; } 00029 void setROCType(const std::string& rocType) { theROCType_ = rocType; } 00030 void setROCStatus(bool rocStatus) { theROCStatus_ = rocStatus; } 00031 void setFEWROCAddress(unsigned int fecROCAddress) 00032 { 00033 theFEWROCAddress_ = fecROCAddress; 00034 } 00035 void setROCDACs(const ROCDACs& rocDACs) { theROCDACs_ = rocDACs; } 00036 void addDAC(std::string name, unsigned int address, unsigned int value) 00037 { 00038 theROCDACs_.setDAC(name, address, value); 00039 } 00040 void setROCMask(const std::string& rocMask); 00041 void setROCTrimBits(const std::string& rocTrimBits) { theROCTrimBits_ = rocTrimBits; } 00042 00043 // Getters 00044 const std::string& getDetectorID(void) const { return theDetectorID_; } 00045 const std::string& getROCType(void) const { return theROCType_; } 00046 bool getROCStatus(void) const { return theROCStatus_; } 00047 unsigned int getFEWROCAddress(void) const { return theFEWROCAddress_; } 00048 const ROCDACs& getROCDACs(void) const { return theROCDACs_; } 00049 const std::string& getROCMask(void) const { return theROCMask_; } 00050 const std::string& getROCTrimBits(void) const { return theROCTrimBits_; } 00051 00052 private: 00053 std::string theDetectorID_; 00054 std::string theROCType_; 00055 bool theROCStatus_; 00056 unsigned int theFEWROCAddress_; 00057 ROCDACs theROCDACs_; 00058 std::string theROCMask_; 00059 std::string theROCTrimBits_; 00060 }; 00061 } 00062 00064 inline void ots::ROCStream::setROCMask(const std::string& rocMask) 00065 { 00066 // theROCMask_ = rocMask; 00067 theROCMask_.clear(); 00068 int row = -1; 00069 int col = -1; 00070 bool openRow = false; 00071 bool openCol = false; 00072 for(unsigned int i = 0; i < rocMask.length(); i++) 00073 if(rocMask[i] == '[') 00074 if(!openRow) 00075 { 00076 openRow = true; 00077 ++row; 00078 } 00079 else if(!openCol) 00080 { 00081 openCol = true; 00082 ++col; 00083 } 00084 else 00085 { 00086 __SS__ << "Too many [ in bit mask configuration" << std::endl; 00087 __COUT_ERR__ << "\n" << ss.str(); 00088 __SS_THROW__; 00089 } 00090 else if(rocMask[i] == ']') 00091 if(openCol) 00092 { 00093 openCol = false; 00094 --col; 00095 } 00096 else if(openRow) 00097 { 00098 openRow = false; 00099 --row; 00100 } 00101 else 00102 { 00103 __SS__ << "Too many ] in bit mask configuration" << std::endl; 00104 __COUT_ERR__ << "\n" << ss.str(); 00105 __SS_THROW__; 00106 } 00107 else if(rocMask[i] == '0' || rocMask[i] == '1') 00108 theROCMask_ += 00109 rocMask[i]; // No matrix style mask ... needs to be changed //TODO 00110 // std::cout << theROCMask_ << std::endl; 00111 } 00112 00113 #endif // ots_ROCStream_h