conflict merge fix

This commit is contained in:
2021-07-22 11:53:00 +02:00
23 changed files with 371 additions and 78 deletions

View File

@ -38,7 +38,8 @@ std::string ToString(const defs::burstMode s);
std::string ToString(const defs::timingSourceType s);
std::string ToString(const defs::M3_GainCaps s);
std::string ToString(const defs::portPosition s);
std::string ToString(const defs::EthernetInterface s);
std::string ToString(const defs::ethernetInterface s);
std::string ToString(const defs::vetoAlgorithm s);
std::string ToString(const slsDetectorDefs::xy &coord);
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
@ -302,7 +303,8 @@ template <> defs::burstMode StringTo(const std::string &s);
template <> defs::timingSourceType StringTo(const std::string &s);
template <> defs::M3_GainCaps StringTo(const std::string &s);
template <> defs::portPosition StringTo(const std::string &s);
template <> defs::EthernetInterface StringTo(const std::string &s);
template <> defs::ethernetInterface StringTo(const std::string &s);
template <> defs::vetoAlgorithm StringTo(const std::string &s);
template <> uint32_t StringTo(const std::string &s);
template <> uint64_t StringTo(const std::string &s);

View File

@ -404,16 +404,18 @@ typedef struct {
enum portPosition { LEFT, RIGHT, TOP, BOTTOM };
#ifdef __cplusplus
enum class EthernetInterface {
enum class ethernetInterface {
#else
enum EthernetInterface {
enum ethernetInterface {
#endif
NONE = 0,
I3GBE = 1 << 1,
I10GBE = 1 << 2,
I3GBE = 1 << 0,
I10GBE = 1 << 1,
ALL = I3GBE | I10GBE
};
enum vetoAlgorithm { DEFAULT_ALGORITHM };
#ifdef __cplusplus
/** scan structure */
@ -507,16 +509,18 @@ typedef struct {
#ifdef __cplusplus
};
inline slsDetectorDefs::EthernetInterface
operator|( const slsDetectorDefs::EthernetInterface &a,
const slsDetectorDefs::EthernetInterface &b) {
return slsDetectorDefs::EthernetInterface(static_cast<int32_t>(a) |
inline slsDetectorDefs::ethernetInterface
operator|(const slsDetectorDefs::ethernetInterface &a,
const slsDetectorDefs::ethernetInterface &b) {
return slsDetectorDefs::ethernetInterface(static_cast<int32_t>(a) |
static_cast<int32_t>(b));
};
inline slsDetectorDefs::EthernetInterface operator&( const slsDetectorDefs::EthernetInterface &a,
const slsDetectorDefs::EthernetInterface &b) {
return slsDetectorDefs::EthernetInterface(static_cast<int32_t>(a) & static_cast<int32_t>(b));
inline slsDetectorDefs::ethernetInterface
operator&(const slsDetectorDefs::ethernetInterface &a,
const slsDetectorDefs::ethernetInterface &b) {
return slsDetectorDefs::ethernetInterface(static_cast<int32_t>(a) &
static_cast<int32_t>(b));
};
#endif
@ -594,7 +598,7 @@ struct detParameters {
#ifdef __cplusplus
struct sls_detector_module {
#else
typedef struct {
typedef struct {
#endif
int serialnumber; /**< is the module serial number */
int nchan; /**< is the number of channels on the module*/

View File

@ -228,6 +228,8 @@ enum detFuncs {
F_SET_DATASTREAM,
F_GET_VETO_STREAM,
F_SET_VETO_STREAM,
F_GET_VETO_ALGORITHM,
F_SET_VETO_ALGORITHM,
NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
@ -562,6 +564,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_DATASTREAM: return "F_SET_DATASTREAM";
case F_GET_VETO_STREAM: return "F_GET_VETO_STREAM";
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM";
case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -5,7 +5,7 @@
#define APIGUI 0x210225
#define APICTB 0x210621
#define APIGOTTHARD 0x210621
#define APIGOTTHARD2 0x210715
#define APIGOTTHARD2 0x210721
#define APIJUNGFRAU 0x210714
#define APIMYTHEN3 0x210621
#define APIMOENCH 0x210621

View File

@ -555,18 +555,18 @@ std::string ToString(const defs::portPosition s) {
}
}
std::string ToString(const defs::EthernetInterface s) {
std::string ToString(const defs::ethernetInterface s) {
std::ostringstream os;
std::string rs;
switch (s) {
case defs::EthernetInterface::NONE:
case defs::ethernetInterface::NONE:
return std::string("none");
default:
if ((s & defs::EthernetInterface::I3GBE) !=
defs::EthernetInterface::NONE)
if ((s & defs::ethernetInterface::I3GBE) !=
defs::ethernetInterface::NONE)
os << "3gbe, ";
if ((s & defs::EthernetInterface::I10GBE) !=
defs::EthernetInterface::NONE)
if ((s & defs::ethernetInterface::I10GBE) !=
defs::ethernetInterface::NONE)
os << "10gbe, ";
auto rs = os.str();
rs.erase(rs.end() - 2, rs.end());
@ -574,6 +574,15 @@ std::string ToString(const defs::EthernetInterface s) {
}
}
std::string ToString(const defs::vetoAlgorithm s) {
switch (s) {
case defs::DEFAULT_ALGORITHM:
return std::string("default");
default:
return std::string("Unknown");
}
}
const std::string &ToString(const std::string &s) { return s; }
template <> defs::detectorType StringTo(const std::string &s) {
@ -942,17 +951,23 @@ template <> defs::portPosition StringTo(const std::string &s) {
throw sls::RuntimeError("Unknown port position " + s);
}
template <> defs::EthernetInterface StringTo(const std::string &s) {
template <> defs::ethernetInterface StringTo(const std::string &s) {
std::string rs = s;
if (s.find(',') != std::string::npos)
rs.erase(rs.find(','));
if (rs == "none")
return defs::EthernetInterface::NONE;
return defs::ethernetInterface::NONE;
if (rs == "3gbe")
return defs::EthernetInterface::I3GBE;
return defs::ethernetInterface::I3GBE;
if (rs == "10gbe")
return defs::EthernetInterface::I10GBE;
throw sls::RuntimeError("Unknown EthernetInterface type " + s);
return defs::ethernetInterface::I10GBE;
throw sls::RuntimeError("Unknown ethernetInterface type " + s);
}
template <> defs::vetoAlgorithm StringTo(const std::string &s) {
if (s == "default")
return defs::DEFAULT_ALGORITHM;
throw sls::RuntimeError("Unknown veto algorithm " + s);
}
template <> uint32_t StringTo(const std::string &s) {

View File

@ -324,10 +324,10 @@ TEST_CASE("Print a member of patternParameters") {
REQUIRE(ToString(pat->limits) == "[4, 100]");
}
TEST_CASE("EthernetInterface") {
REQUIRE(ToString(sls::defs::EthernetInterface::NONE) == "none");
REQUIRE(ToString(sls::defs::EthernetInterface::I10GBE) == "10gbe");
REQUIRE(ToString(sls::defs::EthernetInterface::I3GBE) == "3gbe");
REQUIRE(ToString(sls::defs::EthernetInterface::I3GBE |
sls::defs::EthernetInterface::I10GBE) == "3gbe, 10gbe");
TEST_CASE("ethernetInterface") {
REQUIRE(ToString(sls::defs::ethernetInterface::NONE) == "none");
REQUIRE(ToString(sls::defs::ethernetInterface::I10GBE) == "10gbe");
REQUIRE(ToString(sls::defs::ethernetInterface::I3GBE) == "3gbe");
REQUIRE(ToString(sls::defs::ethernetInterface::I3GBE |
sls::defs::ethernetInterface::I10GBE) == "3gbe, 10gbe");
}