From 0c7759d7e4900b40f857272b8d1ebd1635f46bf1 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 11 Aug 2020 17:09:36 +0200 Subject: [PATCH] formatting --- .../slsDetectorFunctionList.c | 14 +++++++----- .../slsDetectorFunctionList.c | 3 ++- .../slsDetectorServer_defs.h | 22 +++++++++---------- slsDetectorSoftware/src/CmdProxy.cpp | 2 +- .../tests/test-CmdProxy-rx.cpp | 8 +++---- slsReceiverSoftware/src/Implementation.cpp | 4 +--- slsSupportLib/include/ClientSocket.h | 1 + slsSupportLib/include/bit_utils.h | 4 ++-- slsSupportLib/include/sls_detector_defs.h | 5 +++-- slsSupportLib/include/versionAPI.h | 20 ++++++++--------- slsSupportLib/src/ClientSocket.cpp | 2 +- slsSupportLib/tests/test-bit_utils.cpp | 20 ++++++++--------- 12 files changed, 54 insertions(+), 51 deletions(-) mode change 100755 => 100644 slsSupportLib/include/ClientSocket.h diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index 8121f28c7..a54601d59 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -2048,11 +2048,12 @@ void *start_timer(void *arg) { int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1]; int ntotpixels = 256 * 256 * 4; - LOG(logDEBUG1, (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n " - "packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n " - "ntotpixels:%d\n", - dr, bytesPerPixel, tgEnable, datasize, packetsize, - numPacketsPerFrame, npixelsx, databytes, ntotpixels)); + LOG(logDEBUG1, + (" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n " + "packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n " + "ntotpixels:%d\n", + dr, bytesPerPixel, tgEnable, datasize, packetsize, numPacketsPerFrame, + npixelsx, databytes, ntotpixels)); // Generate data char imageData[databytes * 2]; @@ -2181,7 +2182,8 @@ void *start_timer(void *arg) { usleep(eiger_virtual_transmission_delay_right); sendUDPPacket(1, packetData2, packetsize); } - LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes, (long long unsigned int)(frameNr + iframes))); + LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes, + (long long unsigned int)(frameNr + iframes))); clock_gettime(CLOCK_REALTIME, &end); int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec)); diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c index 82bf3028d..0476d35a9 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c @@ -1818,7 +1818,8 @@ int configureASICVetoReference(int chipIndex, int *gainIndices, int *values) { ("Unknown gain index %d for channel %d\n", gainIndices[i], i)); return FAIL; } - revValues[NCHAN - 1 - i] |= gainValue; // reversed list, so NCHAN - 1 - i + revValues[NCHAN - 1 - i] |= + gainValue; // reversed list, so NCHAN - 1 - i LOG(logDEBUG2, ("Values[%d]: 0x%x\n", i, revValues[i])); } diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h index f9cfe119c..330e53b04 100644 --- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h +++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h @@ -137,17 +137,17 @@ enum PLLINDEX { READOUT_PLL, SYSTEM_PLL }; #define ASIC_ADC_MAX_VAL (0x7F) #define ASIC_GLOBAL_SETT_MAX_BITS (6) -#define ASIC_EXT_MEMCTRL_OFST (0) -#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST) -#define ASIC_EXT_TIMING_OFST (1) -#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST) -#define ASIC_CONT_MODE_OFST (2) -#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST) -#define ASIC_FILTER_OFST (3) -#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST) -#define ASIC_FILTER_MAX_VALUE (3) -#define ASIC_CDS_GAIN_OFST (5) -#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST) +#define ASIC_EXT_MEMCTRL_OFST (0) +#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST) +#define ASIC_EXT_TIMING_OFST (1) +#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST) +#define ASIC_CONT_MODE_OFST (2) +#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST) +#define ASIC_FILTER_OFST (3) +#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST) +#define ASIC_FILTER_MAX_VALUE (3) +#define ASIC_CDS_GAIN_OFST (5) +#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST) /* Struct Definitions */ typedef struct udp_header_struct { diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index aae4e5f3d..f44461b97 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -1,7 +1,7 @@ #include "CmdProxy.h" -#include "bit_utils.h" #include "TimeHelper.h" #include "ToString.h" +#include "bit_utils.h" #include "container_utils.h" #include "logger.h" #include "sls_detector_defs.h" diff --git a/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp b/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp index 6bcb09a98..4e08946ff 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-rx.cpp @@ -36,7 +36,7 @@ TEST_CASE("rx_version", "[.cmd][.rx][.new]") { TEST_CASE("rx_start", "[.cmd][.rx][.new]") { Detector det; CmdProxy proxy(&det); - det.setFileWrite(false); //avoid writing or error on file creation + det.setFileWrite(false); // avoid writing or error on file creation // PUT only command REQUIRE_THROWS(proxy.Call("rx_start", {}, -1, GET)); { @@ -70,7 +70,7 @@ TEST_CASE("rx_stop", "[.cmd][.rx][.new]") { TEST_CASE("rx_status", "[.cmd][.rx][.new]") { Detector det; - det.setFileWrite(false); //avoid writing or error on file creation + det.setFileWrite(false); // avoid writing or error on file creation CmdProxy proxy(&det); det.startReceiver(); { @@ -91,7 +91,7 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") { CmdProxy proxy(&det); // This ensures 0 caught frames - det.setFileWrite(false); //avoid writing or error on file creation + det.setFileWrite(false); // avoid writing or error on file creation det.startReceiver(); det.stopReceiver(); { @@ -113,7 +113,7 @@ TEST_CASE("rx_framescaught", "[.cmd][.rx][.new]") { TEST_CASE("rx_missingpackets", "[.cmd][.rx][.new]") { Detector det; - det.setFileWrite(false); //avoid writing or error on file creation + det.setFileWrite(false); // avoid writing or error on file creation CmdProxy proxy(&det); { // some missing packets diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index d1778d2f3..246aa4e7f 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -22,9 +22,7 @@ /** cosntructor & destructor */ -Implementation::Implementation(const detectorType d) { - setDetectorType(d); -} +Implementation::Implementation(const detectorType d) { setDetectorType(d); } Implementation::~Implementation() { delete generalData; diff --git a/slsSupportLib/include/ClientSocket.h b/slsSupportLib/include/ClientSocket.h old mode 100755 new mode 100644 index 9aafb647c..d342097cb --- a/slsSupportLib/include/ClientSocket.h +++ b/slsSupportLib/include/ClientSocket.h @@ -16,6 +16,7 @@ class ClientSocket : public DataSocket { void *retval, size_t retval_size); std::string readErrorMessage(); + private: void readReply(int &ret, void *retval, size_t retval_size); struct sockaddr_in serverAddr {}; diff --git a/slsSupportLib/include/bit_utils.h b/slsSupportLib/include/bit_utils.h index 8043c3dad..c3530ae11 100644 --- a/slsSupportLib/include/bit_utils.h +++ b/slsSupportLib/include/bit_utils.h @@ -1,11 +1,11 @@ #pragma once -#include #include +#include namespace sls { template std::vector getSetBits(T val) { constexpr size_t bitsPerByte = 8; - constexpr size_t numBits = sizeof(T)*bitsPerByte; + constexpr size_t numBits = sizeof(T) * bitsPerByte; std::bitset bs(val); std::vector set_bits; set_bits.reserve(bs.count()); diff --git a/slsSupportLib/include/sls_detector_defs.h b/slsSupportLib/include/sls_detector_defs.h index 770ed514a..5163e4b8f 100644 --- a/slsSupportLib/include/sls_detector_defs.h +++ b/slsSupportLib/include/sls_detector_defs.h @@ -135,8 +135,9 @@ class slsDetectorDefs { } sls_detector_header; #ifdef __cplusplus - //For sending and receiving data - static_assert(sizeof(detectorType) == sizeof(int), "enum and int differ in size"); + // For sending and receiving data + static_assert(sizeof(detectorType) == sizeof(int), + "enum and int differ in size"); #define MAX_NUM_PACKETS 512 using sls_bitset = std::bitset; using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8]; diff --git a/slsSupportLib/include/versionAPI.h b/slsSupportLib/include/versionAPI.h index 94157b1db..67d6cd136 100644 --- a/slsSupportLib/include/versionAPI.h +++ b/slsSupportLib/include/versionAPI.h @@ -1,12 +1,12 @@ /** API versions */ -#define GITBRANCH "developer" -#define APILIB 0x200810 -#define APIRECEIVER 0x200810 -#define APIGUI 0x200804 -#define APICTB 0x200810 -#define APIGOTTHARD 0x200810 +#define GITBRANCH "developer" +#define APILIB 0x200810 +#define APIRECEIVER 0x200810 +#define APIGUI 0x200804 +#define APICTB 0x200810 +#define APIGOTTHARD 0x200810 #define APIGOTTHARD2 0x200810 -#define APIJUNGFRAU 0x200810 -#define APIMYTHEN3 0x200810 -#define APIMOENCH 0x200810 -#define APIEIGER 0x200810 +#define APIJUNGFRAU 0x200810 +#define APIMYTHEN3 0x200810 +#define APIMOENCH 0x200810 +#define APIEIGER 0x200810 diff --git a/slsSupportLib/src/ClientSocket.cpp b/slsSupportLib/src/ClientSocket.cpp index 7dda44e7d..de0e4c16e 100644 --- a/slsSupportLib/src/ClientSocket.cpp +++ b/slsSupportLib/src/ClientSocket.cpp @@ -101,7 +101,7 @@ void ClientSocket::readReply(int &ret, void *retval, size_t retval_size) { } } -std::string ClientSocket::readErrorMessage(){ +std::string ClientSocket::readErrorMessage() { std::string error_msg(MAX_STR_LENGTH, '\0'); Receive(&error_msg[0], error_msg.size()); return error_msg; diff --git a/slsSupportLib/tests/test-bit_utils.cpp b/slsSupportLib/tests/test-bit_utils.cpp index adf3768d7..fb2b19353 100644 --- a/slsSupportLib/tests/test-bit_utils.cpp +++ b/slsSupportLib/tests/test-bit_utils.cpp @@ -1,39 +1,39 @@ +#include "bit_utils.h" #include "catch.hpp" #include -#include "bit_utils.h" -TEST_CASE("Get set bits from 0"){ +TEST_CASE("Get set bits from 0") { auto vec = sls::getSetBits(0); REQUIRE(vec.empty()); } -TEST_CASE("Get set bits from 1"){ +TEST_CASE("Get set bits from 1") { auto vec = sls::getSetBits(1); REQUIRE(vec.size() == 1); REQUIRE(vec[0] == 0); } -TEST_CASE("Get set bits from 2"){ +TEST_CASE("Get set bits from 2") { auto vec = sls::getSetBits(2ul); REQUIRE(vec.size() == 1); REQUIRE(vec[0] == 1); } -TEST_CASE("Get set bits from 3"){ +TEST_CASE("Get set bits from 3") { auto vec = sls::getSetBits(3u); REQUIRE(vec.size() == 2); REQUIRE(vec[0] == 0); REQUIRE(vec[1] == 1); } -TEST_CASE("All bits set"){ +TEST_CASE("All bits set") { uint8_t val = -1; auto vec = sls::getSetBits(val); - REQUIRE(vec == std::vector{0,1,2,3,4,5,6,7}); + REQUIRE(vec == std::vector{0, 1, 2, 3, 4, 5, 6, 7}); } -TEST_CASE("Get set bits from 523"){ - //0b1000001011 == 523 +TEST_CASE("Get set bits from 523") { + // 0b1000001011 == 523 auto vec = sls::getSetBits(523); - REQUIRE(vec == std::vector{0,1,3,9}); + REQUIRE(vec == std::vector{0, 1, 3, 9}); }