mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 21:37:13 +02:00
Setting pattern from memory (#218)
* ToString accepts c-style arrays * added patternParameters to python * fixed patwait time bug in validation * moved load from file function to patterParameters * server using patternparamters structure to get pattern Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
@ -181,6 +181,23 @@ std::string ToString(const std::map<KeyType, ValueType> &m) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a c style array
|
||||
*/
|
||||
template<typename T, size_t size>
|
||||
std::string ToString(const T(&arr)[size]){
|
||||
std::ostringstream os;
|
||||
os << '[';
|
||||
if (size){
|
||||
size_t i = 0;
|
||||
os << ToString(arr[i++]);
|
||||
for (; i<size; ++i)
|
||||
os << ", " << ToString(arr[i]);
|
||||
}
|
||||
os << ']';
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/**
|
||||
* For a container loop over all elements and call ToString on the element
|
||||
* Container<std::string> is excluded
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <bitset>
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#else
|
||||
// C includes
|
||||
@ -472,19 +473,36 @@ typedef struct {
|
||||
int gates{0};
|
||||
scanParameters scanParams{};
|
||||
} __attribute__((packed));
|
||||
#endif
|
||||
|
||||
|
||||
/** pattern structure */
|
||||
#ifdef __cplusplus
|
||||
struct patternParameters {
|
||||
uint64_t word[MAX_PATTERN_LENGTH]{};
|
||||
uint64_t patioctrl{0};
|
||||
uint32_t patlimits[2]{};
|
||||
uint32_t patloop[6]{};
|
||||
uint32_t patnloop[3]{};
|
||||
uint32_t patwait[3]{};
|
||||
uint64_t patwaittime[3]{};
|
||||
} __attribute__((packed));
|
||||
|
||||
#else
|
||||
typedef struct __attribute__((packed)){
|
||||
#endif
|
||||
uint64_t word[MAX_PATTERN_LENGTH];
|
||||
uint64_t patioctrl;
|
||||
uint32_t patlimits[2];
|
||||
uint32_t patloop[6];
|
||||
uint32_t patnloop[3];
|
||||
uint32_t patwait[3];
|
||||
uint64_t patwaittime[3];
|
||||
#ifdef __cplusplus
|
||||
public:
|
||||
patternParameters(){
|
||||
// Since the def has to be c compatible we can't use {} for the members
|
||||
memset(this, 0, sizeof(patternParameters));
|
||||
}
|
||||
void load(const std::string& fname);
|
||||
} __attribute__((packed));
|
||||
#else
|
||||
} patternParameters;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
protected:
|
||||
|
@ -3,10 +3,10 @@
|
||||
#define APILIB 0x201119
|
||||
#define APIRECEIVER 0x201119
|
||||
#define APIGUI 0x201119
|
||||
#define APICTB 0x201119
|
||||
#define APIGOTTHARD 0x201119
|
||||
#define APIGOTTHARD2 0x201119
|
||||
#define APIJUNGFRAU 0x201119
|
||||
#define APIMYTHEN3 0x201119
|
||||
#define APIMOENCH 0x201119
|
||||
#define APIEIGER 0x201119
|
||||
#define APICTB 0x201124
|
||||
#define APIGOTTHARD 0x201124
|
||||
#define APIGOTTHARD2 0x201124
|
||||
#define APIJUNGFRAU 0x201124
|
||||
#define APIMYTHEN3 0x201124
|
||||
#define APIMOENCH 0x201124
|
||||
#define APIEIGER 0x201124
|
||||
|
Reference in New Issue
Block a user