mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
Introduced pattern class
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
#include "sls/Result.h"
|
||||
#include "sls/network_utils.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
#include "sls/Pattern.h"
|
||||
#include <chrono>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@ -15,6 +16,7 @@ class DetectorImpl;
|
||||
class MacAddr;
|
||||
class IpAddr;
|
||||
|
||||
|
||||
// Free function to avoid dependence on class
|
||||
// and avoid the option to free another objects
|
||||
// shm by mistake
|
||||
@ -1459,7 +1461,7 @@ class Detector {
|
||||
|
||||
/** [CTB][Moench][Mythen3] Loads pattern parameters structure directly to
|
||||
* server */
|
||||
void setPattern(const defs::patternParameters *pat, Positions pos = {});
|
||||
void setPattern(const Pattern& pat, Positions pos = {});
|
||||
|
||||
/** [CTB][Moench][Mythen3] [Ctb][Moench][Mythen3] Saves pattern to file
|
||||
* (ascii). \n [Ctb][Moench] Also executes pattern.*/
|
||||
|
42
slsDetectorSoftware/include/sls/Pattern.h
Normal file
42
slsDetectorSoftware/include/sls/Pattern.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <memory>
|
||||
namespace sls {
|
||||
#endif
|
||||
|
||||
// Common C/C++ structure to handle pattern data
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint64_t word[MAX_PATTERN_LENGTH];
|
||||
uint64_t ioctrl;
|
||||
uint32_t limits[2];
|
||||
// loop0 start, loop0 stop .. loop2 start, loop2 stop
|
||||
uint32_t loop[6];
|
||||
uint32_t nloop[3];
|
||||
uint32_t wait[3];
|
||||
uint64_t waittime[3];
|
||||
} patternParameters;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
class Pattern{
|
||||
patternParameters* pat = new patternParameters{};
|
||||
|
||||
public:
|
||||
Pattern();
|
||||
~Pattern();
|
||||
Pattern(const Pattern& other);
|
||||
bool operator==(const Pattern& other) const;
|
||||
bool operator!=(const Pattern& other) const;
|
||||
patternParameters* data();
|
||||
patternParameters* data() const;
|
||||
constexpr size_t size() const noexcept{ return sizeof(patternParameters);}
|
||||
void validate() const;
|
||||
void load(const std::string &fname);
|
||||
std::string str() const { return {}; }
|
||||
|
||||
};
|
||||
|
||||
} //namespace sls
|
||||
#endif
|
Reference in New Issue
Block a user