mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-20 16:48:01 +02:00
cleanup
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
@ -9,7 +10,7 @@
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
|
||||
int dummyCallback(detectorData *d, int p, void *) {
|
||||
inline int dummyCallback(detectorData *d, int p, void *) {
|
||||
std::cout << "got data " << p << std::endl;
|
||||
return 0;
|
||||
};
|
||||
@ -17,8 +18,6 @@ int dummyCallback(detectorData *d, int p, void *) {
|
||||
class multiSlsDetectorClient {
|
||||
public:
|
||||
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector = nullptr) {
|
||||
std::string answer;
|
||||
|
||||
int id = -1, pos = -1, iv = 0;
|
||||
bool verify = true, update = true;
|
||||
char cmd[100] = "";
|
||||
@ -71,9 +70,11 @@ class multiSlsDetectorClient {
|
||||
if (iv != 2) {
|
||||
pos = -1;
|
||||
} // remove the %d- and %d:
|
||||
if (!strlen(cmd)) {
|
||||
if (strlen(cmd) == 0u) {
|
||||
strcpy(cmd, argv[0]);
|
||||
} // special commands
|
||||
}
|
||||
|
||||
// special commands
|
||||
std::string scmd = cmd; // free without calling multiSlsDetector constructor
|
||||
if (scmd == "free") {
|
||||
multiSlsDetector::freeSharedMemory(id, pos);
|
||||
@ -106,11 +107,11 @@ class multiSlsDetectorClient {
|
||||
|
||||
// call multi detector command line
|
||||
multiSlsDetectorCommand myCmd(myDetector);
|
||||
answer = myCmd.executeLine(argc, argv, action, pos);
|
||||
std::string answer = myCmd.executeLine(argc, argv, action, pos);
|
||||
|
||||
if (action != slsDetectorDefs::READOUT_ACTION) {
|
||||
std::cout << argv[0] << " ";
|
||||
}
|
||||
std::cout << answer << std::endl;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
@ -15,11 +15,7 @@
|
||||
class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||
|
||||
public:
|
||||
|
||||
|
||||
multiSlsDetectorCommand(multiSlsDetector *det) : slsDetectorCommand(det) {myDet=det;};
|
||||
|
||||
|
||||
explicit multiSlsDetectorCommand(multiSlsDetector *det) : slsDetectorCommand(det) {myDet=det;};
|
||||
/* /\** */
|
||||
/* executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing */
|
||||
/* \param narg number of arguments */
|
||||
@ -28,10 +24,8 @@ public:
|
||||
/* \returns answer string */
|
||||
/* *\/ */
|
||||
|
||||
std::string executeLine(int narg, char *args[], int action, int id=-1) { \
|
||||
std::string s; \
|
||||
s=slsDetectorCommand::executeLine(narg,args,action, id); \
|
||||
return s;
|
||||
std::string executeLine(int narg, char *args[], int action, int id=-1) override {
|
||||
return slsDetectorCommand::executeLine(narg,args,action, id);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -48,11 +42,7 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user