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 <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -9,7 +10,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
int dummyCallback(detectorData *d, int p, void *) {
|
inline int dummyCallback(detectorData *d, int p, void *) {
|
||||||
std::cout << "got data " << p << std::endl;
|
std::cout << "got data " << p << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
@ -17,8 +18,6 @@ int dummyCallback(detectorData *d, int p, void *) {
|
|||||||
class multiSlsDetectorClient {
|
class multiSlsDetectorClient {
|
||||||
public:
|
public:
|
||||||
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector = nullptr) {
|
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector = nullptr) {
|
||||||
std::string answer;
|
|
||||||
|
|
||||||
int id = -1, pos = -1, iv = 0;
|
int id = -1, pos = -1, iv = 0;
|
||||||
bool verify = true, update = true;
|
bool verify = true, update = true;
|
||||||
char cmd[100] = "";
|
char cmd[100] = "";
|
||||||
@ -71,9 +70,11 @@ class multiSlsDetectorClient {
|
|||||||
if (iv != 2) {
|
if (iv != 2) {
|
||||||
pos = -1;
|
pos = -1;
|
||||||
} // remove the %d- and %d:
|
} // remove the %d- and %d:
|
||||||
if (!strlen(cmd)) {
|
if (strlen(cmd) == 0u) {
|
||||||
strcpy(cmd, argv[0]);
|
strcpy(cmd, argv[0]);
|
||||||
} // special commands
|
}
|
||||||
|
|
||||||
|
// special commands
|
||||||
std::string scmd = cmd; // free without calling multiSlsDetector constructor
|
std::string scmd = cmd; // free without calling multiSlsDetector constructor
|
||||||
if (scmd == "free") {
|
if (scmd == "free") {
|
||||||
multiSlsDetector::freeSharedMemory(id, pos);
|
multiSlsDetector::freeSharedMemory(id, pos);
|
||||||
@ -106,11 +107,11 @@ class multiSlsDetectorClient {
|
|||||||
|
|
||||||
// call multi detector command line
|
// call multi detector command line
|
||||||
multiSlsDetectorCommand myCmd(myDetector);
|
multiSlsDetectorCommand myCmd(myDetector);
|
||||||
answer = myCmd.executeLine(argc, argv, action, pos);
|
std::string answer = myCmd.executeLine(argc, argv, action, pos);
|
||||||
|
|
||||||
if (action != slsDetectorDefs::READOUT_ACTION) {
|
if (action != slsDetectorDefs::READOUT_ACTION) {
|
||||||
std::cout << argv[0] << " ";
|
std::cout << argv[0] << " ";
|
||||||
}
|
}
|
||||||
std::cout << answer << std::endl;
|
std::cout << answer << std::endl;
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
@ -15,11 +15,7 @@
|
|||||||
class multiSlsDetectorCommand : public slsDetectorCommand {
|
class multiSlsDetectorCommand : public slsDetectorCommand {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
explicit multiSlsDetectorCommand(multiSlsDetector *det) : slsDetectorCommand(det) {myDet=det;};
|
||||||
|
|
||||||
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 */
|
/* 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 */
|
/* \param narg number of arguments */
|
||||||
@ -28,10 +24,8 @@ public:
|
|||||||
/* \returns answer string */
|
/* \returns answer string */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
|
|
||||||
std::string executeLine(int narg, char *args[], int action, int id=-1) { \
|
std::string executeLine(int narg, char *args[], int action, int id=-1) override {
|
||||||
std::string s; \
|
return slsDetectorCommand::executeLine(narg,args,action, id);
|
||||||
s=slsDetectorCommand::executeLine(narg,args,action, id); \
|
|
||||||
return s;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,11 +42,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user