mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
Cmddacs (#189)
Moved dacs to it's own command for command line. Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
@ -213,6 +213,7 @@ enum detFuncs {
|
||||
F_SET_BAD_CHANNELS,
|
||||
F_RECONFIGURE_UDP,
|
||||
F_VALIDATE_UDP_CONFIG,
|
||||
F_GET_BURSTS_LEFT,
|
||||
|
||||
NUM_DET_FUNCTIONS,
|
||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||
@ -529,7 +530,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_SET_BAD_CHANNELS: return "F_SET_BAD_CHANNELS";
|
||||
case F_RECONFIGURE_UDP: return "F_RECONFIGURE_UDP";
|
||||
case F_VALIDATE_UDP_CONFIG: return "F_VALIDATE_UDP_CONFIG";
|
||||
|
||||
case F_GET_BURSTS_LEFT: return "F_GET_BURSTS_LEFT";
|
||||
|
||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||
|
||||
|
@ -51,4 +51,7 @@ implementation should not be used in a performance critical place.
|
||||
std::vector<std::string> split(const std::string &strToSplit, char delimeter);
|
||||
|
||||
std::string RemoveUnit(std::string &str);
|
||||
|
||||
bool is_int(const std::string& s);
|
||||
} // namespace sls
|
||||
|
||||
|
@ -3,11 +3,10 @@
|
||||
#define APILIB 0x200810
|
||||
#define APIRECEIVER 0x200810
|
||||
#define APIGUI 0x200804
|
||||
|
||||
#define APICTB 0x200910
|
||||
#define APIMOENCH 0x200910
|
||||
#define APIMYTHEN3 0x200923
|
||||
#define APIGOTTHARD 0x200917
|
||||
#define APIJUNGFRAU 0x200917
|
||||
#define APIEIGER 0x200918
|
||||
#define APIMYTHEN3 0x200923
|
||||
#define APIGOTTHARD2 0x200924
|
||||
|
@ -686,41 +686,41 @@ template <> defs::readoutMode StringTo(const std::string &s) {
|
||||
}
|
||||
|
||||
template <> defs::dacIndex StringTo(const std::string &s) {
|
||||
if (s == "dac 0")
|
||||
if (s == "dac 0" || s == "0")
|
||||
return defs::DAC_0;
|
||||
if (s == "dac 1")
|
||||
if (s == "dac 1" || s == "1")
|
||||
return defs::DAC_1;
|
||||
if (s == "dac 2")
|
||||
if (s == "dac 2" || s == "2")
|
||||
return defs::DAC_2;
|
||||
if (s == "dac 3")
|
||||
if (s == "dac 3" || s == "3")
|
||||
return defs::DAC_3;
|
||||
if (s == "dac 4")
|
||||
if (s == "dac 4" || s == "4")
|
||||
return defs::DAC_4;
|
||||
if (s == "dac 5")
|
||||
if (s == "dac 5"|| s == "5")
|
||||
return defs::DAC_5;
|
||||
if (s == "dac 6")
|
||||
if (s == "dac 6"|| s == "6")
|
||||
return defs::DAC_6;
|
||||
if (s == "dac 7")
|
||||
if (s == "dac 7"|| s == "7")
|
||||
return defs::DAC_7;
|
||||
if (s == "dac 8")
|
||||
if (s == "dac 8"|| s == "8")
|
||||
return defs::DAC_8;
|
||||
if (s == "dac 9")
|
||||
if (s == "dac 9"|| s == "9")
|
||||
return defs::DAC_9;
|
||||
if (s == "dac 10")
|
||||
if (s == "dac 10"|| s == "10")
|
||||
return defs::DAC_10;
|
||||
if (s == "dac 11")
|
||||
if (s == "dac 11"|| s == "11")
|
||||
return defs::DAC_11;
|
||||
if (s == "dac 12")
|
||||
if (s == "dac 12"|| s == "12")
|
||||
return defs::DAC_12;
|
||||
if (s == "dac 13")
|
||||
if (s == "dac 13"|| s == "13")
|
||||
return defs::DAC_13;
|
||||
if (s == "dac 14")
|
||||
if (s == "dac 14"|| s == "14")
|
||||
return defs::DAC_14;
|
||||
if (s == "dac 15")
|
||||
if (s == "dac 15"|| s == "15")
|
||||
return defs::DAC_15;
|
||||
if (s == "dac 16")
|
||||
if (s == "dac 16"|| s == "16")
|
||||
return defs::DAC_16;
|
||||
if (s == "dac 17")
|
||||
if (s == "dac 17"|| s == "17")
|
||||
return defs::DAC_17;
|
||||
if (s == "vsvp")
|
||||
return defs::VSVP;
|
||||
|
@ -30,4 +30,10 @@ std::string RemoveUnit(std::string &str) {
|
||||
return unit;
|
||||
}
|
||||
|
||||
bool is_int(const std::string &s) {
|
||||
return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) {
|
||||
return !std::isdigit(c);
|
||||
}) == s.end();
|
||||
}
|
||||
|
||||
}; // namespace sls
|
@ -66,4 +66,14 @@ TEST_CASE("Many characters in a row") {
|
||||
REQUIRE(std::string(str) == "someeequite::ongstring");
|
||||
}
|
||||
|
||||
TEST_CASE("Check is string is integer"){
|
||||
|
||||
REQUIRE(sls::is_int("75"));
|
||||
REQUIRE(sls::is_int("11675"));
|
||||
REQUIRE_FALSE(sls::is_int("7.5"));
|
||||
REQUIRE_FALSE(sls::is_int("hej"));
|
||||
REQUIRE_FALSE(sls::is_int("7a"));
|
||||
REQUIRE_FALSE(sls::is_int(""));
|
||||
}
|
||||
|
||||
// TEST_CASE("concat things not being strings")
|
Reference in New Issue
Block a user