From dc33f1a5da057cb3e9c682d9b5f256b29b32e175 Mon Sep 17 00:00:00 2001 From: Erik Frojdh Date: Mon, 27 Jul 2020 09:14:58 +0200 Subject: [PATCH] const --- slsDetectorSoftware/src/Module.cpp | 92 +++++++++++++++--------------- slsDetectorSoftware/src/Module.h | 92 +++++++++++++++--------------- 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 3c309fca3..9de682878 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -1273,7 +1273,7 @@ void Module::setQuad(const bool enable) { // Jungfrau Specific -int Module::getThresholdTemperature() { +int Module::getThresholdTemperature() const { int arg = GET_FLAG; auto retval = sendToDetectorStop(F_THRESHOLD_TEMP, arg); if (retval != 0) { @@ -1291,7 +1291,7 @@ void Module::setThresholdTemperature(int val) { sendToDetectorStop(F_THRESHOLD_TEMP, val); } -bool Module::getTemperatureControl() { +bool Module::getTemperatureControl() const { int arg = GET_FLAG; return static_cast(sendToDetectorStop(F_TEMP_CONTROL, arg)); } @@ -1300,7 +1300,7 @@ void Module::setTemperatureControl(bool val) { sendToDetectorStop(F_TEMP_CONTROL, static_cast(val)); } -int Module::getTemperatureEvent() { +int Module::getTemperatureEvent() const { int arg = GET_FLAG; return sendToDetectorStop(F_TEMP_EVENT, arg); } @@ -1310,7 +1310,7 @@ void Module::resetTemperatureEvent() { sendToDetectorStop(F_TEMP_EVENT, arg); } -bool Module::getAutoComparatorDisableMode() { +bool Module::getAutoComparatorDisableMode() const{ int arg = GET_FLAG; return static_cast(sendToDetector(F_AUTO_COMP_DISABLE, arg)); } @@ -1319,7 +1319,7 @@ void Module::setAutoComparatorDisableMode(bool val) { sendToDetector(F_AUTO_COMP_DISABLE, static_cast(val)); } -int Module::getNumberOfAdditionalStorageCells() { +int Module::getNumberOfAdditionalStorageCells() const { return sendToDetector(F_GET_NUM_ADDITIONAL_STORAGE_CELLS); } @@ -1327,7 +1327,7 @@ void Module::setNumberOfAdditionalStorageCells(int value) { sendToDetector(F_SET_NUM_ADDITIONAL_STORAGE_CELLS, value, nullptr); } -int Module::getStorageCellStart() { +int Module::getStorageCellStart() const { int arg = GET_FLAG; return sendToDetector(F_STORAGE_CELL_START, arg); } @@ -1336,7 +1336,7 @@ void Module::setStorageCellStart(int pos) { sendToDetector(F_STORAGE_CELL_START, pos); } -int64_t Module::getStorageCellDelay() { +int64_t Module::getStorageCellDelay() const { return sendToDetector(F_GET_STORAGE_CELL_DELAY); } @@ -1346,7 +1346,7 @@ void Module::setStorageCellDelay(int64_t value) { // Gotthard Specific -slsDetectorDefs::ROI Module::getROI() { +slsDetectorDefs::ROI Module::getROI() const { return sendToDetector(F_GET_ROI); } @@ -1369,7 +1369,7 @@ int64_t Module::getExptimeLeft() const { // Gotthard2 Specific -int64_t Module::getNumberOfBursts() { +int64_t Module::getNumberOfBursts() const { return sendToDetector(F_GET_NUM_BURSTS); } @@ -1380,7 +1380,7 @@ void Module::setNumberOfBursts(int64_t value) { } } -int64_t Module::getBurstPeriod() { +int64_t Module::getBurstPeriod() const { return sendToDetector(F_GET_BURST_PERIOD); } @@ -1388,7 +1388,7 @@ void Module::setBurstPeriod(int64_t value) { sendToDetector(F_SET_BURST_PERIOD, value, nullptr); } -std::array Module::getInjectChannel() { +std::array Module::getInjectChannel() const { return sendToDetector>(F_GET_INJECT_CHANNEL); } @@ -1398,7 +1398,7 @@ void Module::setInjectChannel(const int offsetChannel, sendToDetector(F_SET_INJECT_CHANNEL, args, nullptr); } -std::vector Module::getVetoPhoton(const int chipIndex) { +std::vector Module::getVetoPhoton(const int chipIndex) const { int fnum = F_GET_VETO_PHOTON; int ret = FAIL; auto client = DetectorSocket(shm()->hostname, shm()->controlPort); @@ -1609,7 +1609,7 @@ void Module::setVetoFile(const int chipIndex, const std::string &fname) { } } -slsDetectorDefs::burstMode Module::getBurstMode() { +slsDetectorDefs::burstMode Module::getBurstMode() const{ auto r = sendToDetector(F_GET_BURST_MODE); return static_cast(r); } @@ -1622,19 +1622,19 @@ void Module::setBurstMode(slsDetectorDefs::burstMode value) { } } -bool Module::getCDSGain() { return sendToDetector(F_GET_CDS_GAIN); } +bool Module::getCDSGain() const { return sendToDetector(F_GET_CDS_GAIN); } void Module::setCDSGain(bool value) { sendToDetector(F_SET_CDS_GAIN, static_cast(value), nullptr); } -int Module::getFilter() { return sendToDetector(F_GET_FILTER); } +int Module::getFilter() const { return sendToDetector(F_GET_FILTER); } void Module::setFilter(int value) { sendToDetector(F_SET_FILTER, value, nullptr); } -bool Module::getCurrentSource() { +bool Module::getCurrentSource() const { return sendToDetector(F_GET_CURRENT_SOURCE); } @@ -1642,7 +1642,7 @@ void Module::setCurrentSource(bool value) { sendToDetector(F_SET_CURRENT_SOURCE, static_cast(value), nullptr); } -slsDetectorDefs::timingSourceType Module::getTimingSource() { +slsDetectorDefs::timingSourceType Module::getTimingSource() const { auto r = sendToDetector(F_GET_TIMING_SOURCE); return static_cast(r); } @@ -1651,13 +1651,13 @@ void Module::setTimingSource(slsDetectorDefs::timingSourceType value) { sendToDetector(F_SET_TIMING_SOURCE, static_cast(value), nullptr); } -bool Module::getVeto() { return sendToDetector(F_GET_VETO); } +bool Module::getVeto() const { return sendToDetector(F_GET_VETO); } void Module::setVeto(bool enable) { sendToDetector(F_SET_VETO, static_cast(enable), nullptr); } -int Module::getADCConfiguration(const int chipIndex, const int adcIndex) { +int Module::getADCConfiguration(const int chipIndex, const int adcIndex) const { int args[]{chipIndex, adcIndex}; return sendToDetector(F_GET_ADC_CONFIGURATION, args); } @@ -1668,7 +1668,7 @@ void Module::setADCConfiguration(const int chipIndex, const int adcIndex, sendToDetector(F_SET_ADC_CONFIGURATION, args, nullptr); } -void Module::getBadChannels(const std::string &fname) { +void Module::getBadChannels(const std::string &fname) const { LOG(logDEBUG1) << "Getting bad channels to " << fname; int fnum = F_GET_BAD_CHANNELS; int ret = FAIL; @@ -1754,7 +1754,7 @@ void Module::setBadChannels(const std::string &fname) { // Mythen3 Specific -uint32_t Module::getCounterMask() { +uint32_t Module::getCounterMask() const { return sendToDetector(F_GET_COUNTER_MASK); } @@ -1768,7 +1768,7 @@ void Module::setCounterMask(uint32_t countermask) { } } -int Module::getNumberOfGates() { return sendToDetector(F_GET_NUM_GATES); } +int Module::getNumberOfGates() const { return sendToDetector(F_GET_NUM_GATES); } void Module::setNumberOfGates(int value) { sendToDetector(F_SET_NUM_GATES, value, nullptr); @@ -1777,12 +1777,12 @@ void Module::setNumberOfGates(int value) { } } -std::array Module::getExptimeForAllGates() { +std::array Module::getExptimeForAllGates() const { static_assert(sizeof(time::ns) == 8, "ns needs to be 64bit"); return sendToDetector>(F_GET_EXPTIME_ALL_GATES); } -int64_t Module::getGateDelay(int gateIndex) { +int64_t Module::getGateDelay(int gateIndex) const { return sendToDetector(F_GET_GATE_DELAY, gateIndex); } @@ -1794,14 +1794,14 @@ void Module::setGateDelay(int gateIndex, int64_t value) { } } -std::array Module::getGateDelayForAllGates() { +std::array Module::getGateDelayForAllGates() const { static_assert(sizeof(time::ns) == 8, "ns needs to be 64bit"); return sendToDetector>(F_GET_GATE_DELAY_ALL_GATES); } // CTB / Moench Specific -int Module::getNumberOfAnalogSamples() { +int Module::getNumberOfAnalogSamples() const { return sendToDetector(F_GET_NUM_ANALOG_SAMPLES); } @@ -1814,7 +1814,7 @@ void Module::setNumberOfAnalogSamples(int value) { } } -int Module::getPipeline(int clkIndex) { +int Module::getPipeline(int clkIndex) const { return sendToDetector(F_GET_PIPELINE, clkIndex); } @@ -1823,7 +1823,7 @@ void Module::setPipeline(int clkIndex, int value) { sendToDetector(F_SET_PIPELINE, args, nullptr); } -uint32_t Module::getADCEnableMask() { +uint32_t Module::getADCEnableMask() const { return sendToDetector(F_GET_ADC_ENABLE_MASK); } @@ -1841,7 +1841,7 @@ void Module::setADCEnableMask(uint32_t mask) { } } -uint32_t Module::getTenGigaADCEnableMask() { +uint32_t Module::getTenGigaADCEnableMask() const { return sendToDetector(F_GET_ADC_ENABLE_MASK_10G); } @@ -1861,7 +1861,7 @@ void Module::setTenGigaADCEnableMask(uint32_t mask) { // CTB Specific -int Module::getNumberOfDigitalSamples() { +int Module::getNumberOfDigitalSamples() const { return sendToDetector(F_GET_NUM_DIGITAL_SAMPLES); } @@ -1877,7 +1877,7 @@ void Module::setNumberOfDigitalSamples(int value) { } } -slsDetectorDefs::readoutMode Module::getReadoutMode() { +slsDetectorDefs::readoutMode Module::getReadoutMode() const { auto r = sendToDetector(F_GET_READOUT_MODE); return static_cast(r); } @@ -1903,7 +1903,7 @@ int Module::setExternalSamplingSource(int value) { return sendToDetector(F_EXTERNAL_SAMPLING_SOURCE, value); } -bool Module::getExternalSampling() { +bool Module::getExternalSampling() const{ int arg = GET_FLAG; return sendToDetector(F_EXTERNAL_SAMPLING, arg); } @@ -1932,7 +1932,7 @@ void Module::setReceiverDbitList(const std::vector &list) { sendToReceiver(F_SET_RECEIVER_DBIT_LIST, arg, nullptr); } -int Module::getReceiverDbitOffset() { +int Module::getReceiverDbitOffset() const { return sendToReceiver(F_GET_RECEIVER_DBIT_OFFSET); } @@ -1945,7 +1945,7 @@ void Module::setDigitalIODelay(uint64_t pinMask, int delay) { sendToDetector(F_DIGITAL_IO_DELAY, args, nullptr); } -bool Module::getLEDEnable() { +bool Module::getLEDEnable() const { int arg = GET_FLAG; return static_cast(sendToDetector(F_LED, arg)); } @@ -2058,7 +2058,7 @@ void Module::setPattern(const std::string &fname) { 0); } -uint64_t Module::getPatternIOControl() { +uint64_t Module::getPatternIOControl() const { int64_t arg = GET_FLAG; return sendToDetector(F_SET_PATTERN_IO_CONTROL, arg); } @@ -2067,7 +2067,7 @@ void Module::setPatternIOControl(uint64_t word) { sendToDetector(F_SET_PATTERN_IO_CONTROL, word); } -uint64_t Module::getPatternWord(int addr) { +uint64_t Module::getPatternWord(int addr) const { uint64_t args[]{static_cast(addr), static_cast(GET_FLAG)}; return sendToDetector(F_SET_PATTERN_WORD, args); @@ -2078,7 +2078,7 @@ void Module::setPatternWord(int addr, uint64_t word) { sendToDetector(F_SET_PATTERN_WORD, args); } -std::array Module::getPatternLoopAddresses(int level) { +std::array Module::getPatternLoopAddresses(int level) const { int args[]{level, GET_FLAG, GET_FLAG}; std::array retvals{}; sendToDetector(F_SET_PATTERN_LOOP_ADDRESSES, args, retvals); @@ -2091,7 +2091,7 @@ void Module::setPatternLoopAddresses(int level, int start, int stop) { sendToDetector(F_SET_PATTERN_LOOP_ADDRESSES, args, retvals); } -int Module::getPatternLoopCycles(int level) { +int Module::getPatternLoopCycles(int level) const { int args[]{level, GET_FLAG}; return sendToDetector(F_SET_PATTERN_LOOP_CYCLES, args); } @@ -2101,7 +2101,7 @@ void Module::setPatternLoopCycles(int level, int n) { sendToDetector(F_SET_PATTERN_LOOP_CYCLES, args); } -int Module::getPatternWaitAddr(int level) { +int Module::getPatternWaitAddr(int level) const { int args[]{level, GET_FLAG}; return sendToDetector(F_SET_PATTERN_WAIT_ADDR, args); } @@ -2111,7 +2111,7 @@ void Module::setPatternWaitAddr(int level, int addr) { sendToDetector(F_SET_PATTERN_WAIT_ADDR, args); } -uint64_t Module::getPatternWaitTime(int level) { +uint64_t Module::getPatternWaitTime(int level) const { uint64_t args[]{static_cast(level), static_cast(GET_FLAG)}; return sendToDetector(F_SET_PATTERN_WAIT_TIME, args); @@ -2122,7 +2122,7 @@ void Module::setPatternWaitTime(int level, uint64_t t) { sendToDetector(F_SET_PATTERN_WAIT_TIME, args); } -uint64_t Module::getPatternMask() { +uint64_t Module::getPatternMask() const { return sendToDetector(F_GET_PATTERN_MASK); } @@ -2130,7 +2130,7 @@ void Module::setPatternMask(uint64_t mask) { sendToDetector(F_SET_PATTERN_MASK, mask, nullptr); } -uint64_t Module::getPatternBitMask() { +uint64_t Module::getPatternBitMask() const { return sendToDetector(F_GET_PATTERN_BIT_MASK); } @@ -2275,7 +2275,7 @@ void Module::rebootController() { LOG(logINFO) << "Controller rebooted successfully!"; } -uint32_t Module::readRegister(uint32_t addr) { +uint32_t Module::readRegister(uint32_t addr) const { return sendToDetectorStop(F_READ_REGISTER, addr); } @@ -2311,7 +2311,7 @@ void Module::writeAdcRegister(uint32_t addr, uint32_t val) { sendToDetector(F_WRITE_ADC_REG, args, nullptr); } -uint32_t Module::getADCInvert() { +uint32_t Module::getADCInvert() const { return sendToDetector(F_GET_ADC_INVERT); } @@ -2347,7 +2347,7 @@ int Module::setStopPort(int port_number) { return shm()->stopPort; } -bool Module::getLockDetector() { +bool Module::getLockDetector() const { int arg = GET_FLAG; return static_cast(sendToDetector(F_LOCK_SERVER, arg)); } @@ -2356,7 +2356,7 @@ void Module::setLockDetector(bool lock) { sendToDetector(F_LOCK_SERVER, static_cast(lock)); } -sls::IpAddr Module::getLastClientIP() { +sls::IpAddr Module::getLastClientIP() const { return sendToDetector(F_GET_LAST_CLIENT_IP); } diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index b2921b9ed..6a58a5776 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -335,19 +335,19 @@ class Module : public virtual slsDetectorDefs { * Jungfrau Specific * * * * ************************************************/ - int getThresholdTemperature(); + int getThresholdTemperature() const; void setThresholdTemperature(int val); - bool getTemperatureControl(); + bool getTemperatureControl() const; void setTemperatureControl(bool val); - int getTemperatureEvent(); + int getTemperatureEvent() const; void resetTemperatureEvent(); - bool getAutoComparatorDisableMode(); + bool getAutoComparatorDisableMode() const; void setAutoComparatorDisableMode(bool val); - int getNumberOfAdditionalStorageCells(); + int getNumberOfAdditionalStorageCells() const; void setNumberOfAdditionalStorageCells(int value); - int getStorageCellStart(); + int getStorageCellStart() const; void setStorageCellStart(int pos); - int64_t getStorageCellDelay(); + int64_t getStorageCellDelay() const; void setStorageCellDelay(int64_t value); /************************************************** @@ -355,7 +355,7 @@ class Module : public virtual slsDetectorDefs { * Gotthard Specific * * * * ************************************************/ - slsDetectorDefs::ROI getROI(); + slsDetectorDefs::ROI getROI() const; void setROI(slsDetectorDefs::ROI arg); void clearROI(); int64_t getExptimeLeft() const; @@ -365,33 +365,33 @@ class Module : public virtual slsDetectorDefs { * Gotthard2 Specific * * * * ************************************************/ - int64_t getNumberOfBursts(); + int64_t getNumberOfBursts() const; void setNumberOfBursts(int64_t value); - int64_t getBurstPeriod(); + int64_t getBurstPeriod() const; void setBurstPeriod(int64_t value); - std::array getInjectChannel(); + std::array getInjectChannel() const; void setInjectChannel(const int offsetChannel, const int incrementChannel); - std::vector getVetoPhoton(const int chipIndex); + std::vector getVetoPhoton(const int chipIndex) const; void setVetoPhoton(const int chipIndex, const int numPhotons, const int energy, const std::string &fname); void setVetoReference(const int gainIndex, const int value); void setVetoFile(const int chipIndex, const std::string &fname); - burstMode getBurstMode(); + burstMode getBurstMode() const; void setBurstMode(burstMode value); - bool getCDSGain(); + bool getCDSGain() const; void setCDSGain(bool value); - int getFilter(); + int getFilter() const; void setFilter(int value); - bool getCurrentSource(); + bool getCurrentSource() const; void setCurrentSource(bool value); - slsDetectorDefs::timingSourceType getTimingSource(); + slsDetectorDefs::timingSourceType getTimingSource() const; void setTimingSource(slsDetectorDefs::timingSourceType value); - bool getVeto(); + bool getVeto() const; void setVeto(bool enable); - int getADCConfiguration(const int chipIndex, const int adcIndex); + int getADCConfiguration(const int chipIndex, const int adcIndex) const; void setADCConfiguration(const int chipIndex, const int adcIndex, int value); - void getBadChannels(const std::string &fname); + void getBadChannels(const std::string &fname) const; void setBadChannels(const std::string &fname); /************************************************** @@ -399,27 +399,27 @@ class Module : public virtual slsDetectorDefs { * Mythen3 Specific * * * * ************************************************/ - uint32_t getCounterMask(); + uint32_t getCounterMask() const; void setCounterMask(uint32_t countermask); - int getNumberOfGates(); + int getNumberOfGates() const; void setNumberOfGates(int value); - std::array getExptimeForAllGates(); - int64_t getGateDelay(int gateIndex); + std::array getExptimeForAllGates() const; + int64_t getGateDelay(int gateIndex) const; void setGateDelay(int gateIndex, int64_t value); - std::array getGateDelayForAllGates(); + std::array getGateDelayForAllGates() const; /************************************************** * * * CTB / Moench Specific * * * * ************************************************/ - int getNumberOfAnalogSamples(); + int getNumberOfAnalogSamples() const; void setNumberOfAnalogSamples(int value); - int getPipeline(int clkIndex); + int getPipeline(int clkIndex) const; void setPipeline(int clkIndex, int value); - uint32_t getADCEnableMask(); + uint32_t getADCEnableMask() const; void setADCEnableMask(uint32_t mask); - uint32_t getTenGigaADCEnableMask(); + uint32_t getTenGigaADCEnableMask() const; void setTenGigaADCEnableMask(uint32_t mask); /************************************************** @@ -427,20 +427,20 @@ class Module : public virtual slsDetectorDefs { * CTB Specific * * * * ************************************************/ - int getNumberOfDigitalSamples(); + int getNumberOfDigitalSamples() const; void setNumberOfDigitalSamples(int value); - readoutMode getReadoutMode(); + readoutMode getReadoutMode() const; void setReadoutMode(const readoutMode mode); int getExternalSamplingSource(); int setExternalSamplingSource(int value); - bool getExternalSampling(); + bool getExternalSampling() const; void setExternalSampling(bool value); std::vector getReceiverDbitList() const; void setReceiverDbitList(const std::vector &list); - int getReceiverDbitOffset(); + int getReceiverDbitOffset() const; void setReceiverDbitOffset(int value); void setDigitalIODelay(uint64_t pinMask, int delay); - bool getLEDEnable(); + bool getLEDEnable() const; void setLEDEnable(bool enable); /************************************************** @@ -449,21 +449,21 @@ class Module : public virtual slsDetectorDefs { * * * ************************************************/ void setPattern(const std::string &fname); - uint64_t getPatternIOControl(); + uint64_t getPatternIOControl() const; void setPatternIOControl(uint64_t word); - uint64_t getPatternWord(int addr); + uint64_t getPatternWord(int addr) const; void setPatternWord(int addr, uint64_t word); - std::array getPatternLoopAddresses(int level); + std::array getPatternLoopAddresses(int level) const; void setPatternLoopAddresses(int level, int start, int stop); - int getPatternLoopCycles(int level); + int getPatternLoopCycles(int level) const; void setPatternLoopCycles(int level, int n); - int getPatternWaitAddr(int level); + int getPatternWaitAddr(int level) const; void setPatternWaitAddr(int level, int addr); - uint64_t getPatternWaitTime(int level); + uint64_t getPatternWaitTime(int level) const; void setPatternWaitTime(int level, uint64_t t); - uint64_t getPatternMask(); + uint64_t getPatternMask() const; void setPatternMask(uint64_t mask); - uint64_t getPatternBitMask(); + uint64_t getPatternBitMask() const; void setPatternBitMask(uint64_t mask); void startPattern(); @@ -489,14 +489,14 @@ class Module : public virtual slsDetectorDefs { void copyDetectorServer(const std::string &fname, const std::string &hostname); void rebootController(); - uint32_t readRegister(uint32_t addr); + uint32_t readRegister(uint32_t addr) const; uint32_t writeRegister(uint32_t addr, uint32_t val); uint32_t setBit(uint32_t addr, int n); uint32_t clearBit(uint32_t addr, int n); void executeFirmwareTest(); void executeBusTest(); void writeAdcRegister(uint32_t addr, uint32_t val); - uint32_t getADCInvert(); + uint32_t getADCInvert() const; void setADCInvert(uint32_t value); /************************************************** @@ -508,9 +508,9 @@ class Module : public virtual slsDetectorDefs { int setControlPort(int port_number); int getStopPort() const; int setStopPort(int port_number); - bool getLockDetector(); + bool getLockDetector() const; void setLockDetector(bool lock); - sls::IpAddr getLastClientIP(); + sls::IpAddr getLastClientIP() const; std::string execCommand(const std::string &cmd); int64_t getNumberOfFramesFromStart() const; int64_t getActualTime() const;