removing multiSlsDetectorCommand and using namespace std

This commit is contained in:
Erik Frojdh
2019-01-17 14:45:51 +01:00
parent c05829031f
commit b07492be6f
5 changed files with 24 additions and 79 deletions

View File

@ -4,7 +4,7 @@
#include "detectorData.h"
#include "logger.h"
#include "multiSlsDetectorClient.h"
#include "multiSlsDetectorCommand.h"
#include "slsDetectorCommand.h"
#include "slsDetector.h"
#include "sls_detector_exceptions.h"
#include "utilities.h"

View File

@ -6,7 +6,7 @@
#include "container_utils.h"
#include "string_utils.h"
#include "multiSlsDetector.h"
#include "multiSlsDetectorCommand.h"
#include "slsDetectorCommand.h"
#include "sls_detector_exceptions.h"
#include <cstdlib>
@ -87,7 +87,7 @@ class multiSlsDetectorClient {
}
// call multi detector command line
multiSlsDetectorCommand myCmd(detPtr);
slsDetectorCommand myCmd(detPtr);
std::string answer = myCmd.executeLine(parser.n_arguments()+1, parser.argv().data(), action_, parser.detector_id());
if (parser.multi_id()!=0)

View File

@ -1,51 +0,0 @@
#ifndef MULTI_SLS_DETECTOR_COMMAND_H
#define MULTI_SLS_DETECTOR_COMMAND_H
#include "slsDetector.h"
#include "multiSlsDetector.h"
#include "slsDetectorCommand.h"
/** @short This class handles the command line I/Os, help etc. of the text clients */
class multiSlsDetectorCommand : public slsDetectorCommand {
public:
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 */
/* \param args array of string arguments */
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
/* \returns answer string */
/* *\/ */
std::string executeLine(int narg, char *args[], int action, int id=-1) override {
return slsDetectorCommand::executeLine(narg,args,action, id);
};
/**
* calls executeLine with PUT_ACTION
*/
std::string putCommand(int narg, char *args[], int pos=-1){\
return executeLine(narg, args,slsDetectorDefs::PUT_ACTION,pos);\
};
/**
* calls executeLine with GET_ACTION
*/
std::string getCommand(int narg, char *args[], int pos=-1){\
return executeLine(narg, args,slsDetectorDefs::GET_ACTION,pos);\
};
private:
multiSlsDetector *myDet;
};
#endif

View File

@ -1,13 +1,9 @@
#include "slsDetectorUsers.h"
#include "detectorData.h"
#include "multiSlsDetectorCommand.h"
#include "multiSlsDetectorClient.h"
using namespace std;
int slsDetectorUsers::getNumberOfDetectors() {
@ -33,7 +29,7 @@ int slsDetectorUsers::getDetectorSize(int &x, int &y, int &nx, int &ny, int detP
return nx*ny;
}
string slsDetectorUsers::getDetectorType(int detPos){
std::string slsDetectorUsers::getDetectorType(int detPos){
return detector.sgetDetectorsType(detPos);
}
int slsDetectorUsers::setOnline(int const online, int detPos){
@ -44,19 +40,19 @@ int slsDetectorUsers::setReceiverOnline(int const online, int detPos){
return detector.setReceiverOnline(online, detPos);
}
int slsDetectorUsers::readConfigurationFile(string const fname){
int slsDetectorUsers::readConfigurationFile(const std::string& fname){
return detector.readConfigurationFile(fname);
}
int slsDetectorUsers::writeConfigurationFile(string const fname){
int slsDetectorUsers::writeConfigurationFile(const std::string& fname){
return detector.writeConfigurationFile(fname);
}
int slsDetectorUsers::retrieveDetectorSetup(string const fname){
int slsDetectorUsers::retrieveDetectorSetup(const std::string& fname){
return detector.retrieveDetectorSetup(fname);
}
int slsDetectorUsers::dumpDetectorSetup(string const fname){
int slsDetectorUsers::dumpDetectorSetup(const std::string& fname){
return detector.dumpDetectorSetup(fname);
}
@ -266,19 +262,19 @@ int slsDetectorUsers::setReceiverFifoDepth(int i, int detPos) {
return detector.setReceiverFifoDepth(i, detPos);
}
string slsDetectorUsers::getFilePath(int detPos){
std::string slsDetectorUsers::getFilePath(int detPos){
return detector.getFilePath(detPos);
}
string slsDetectorUsers::setFilePath(string s, int detPos){
std::string slsDetectorUsers::setFilePath(const std::string& s, int detPos){
return detector.setFilePath(s, detPos);
}
string slsDetectorUsers::getFileName(int detPos){
std::string slsDetectorUsers::getFileName(int detPos){
return detector.getFileName(detPos);
}
string slsDetectorUsers::setFileName(string s, int detPos){
std::string slsDetectorUsers::setFileName(const std::string& s, int detPos){
return detector.setFileName(s, detPos);
}
@ -328,14 +324,14 @@ int slsDetectorUsers::setClientDataStreamingInPort(int i, int detPos){
return detector.getClientStreamingPort(detPos);
}
string slsDetectorUsers::setReceiverDataStreamingOutIP(string ip, int detPos){
std::string slsDetectorUsers::setReceiverDataStreamingOutIP(const std::string& ip, int detPos){
if (ip.length()) {
detector.setReceiverDataStreamingOutIP(ip, detPos);
}
return detector.getReceiverStreamingIP(detPos);
}
string slsDetectorUsers::setClientDataStreamingInIP(string ip, int detPos){
std::string slsDetectorUsers::setClientDataStreamingInIP(const std::string& ip, int detPos){
if (ip.length()) {
detector.setClientDataStreamingInIP(ip, detPos);
}

View File

@ -14,7 +14,7 @@
class detectorData;
class multiSlsDetectorCommand;
#include "multiSlsDetector.h"
#include <cstdint>
@ -153,28 +153,28 @@ public:
* @param fname configuration file name
* @return OK or FAIL
*/
int readConfigurationFile(std::string const fname);
int readConfigurationFile(const std::string& fname);
/**
* Write current configuration to a file (for one time detector setup)
* @param fname configuration file name
* @returns OK or FAIL
*/
int writeConfigurationFile(std::string const fname);
int writeConfigurationFile(const std::string& fname);
/**
* Loads the detector setup from file (current measurement setup)
* @param fname file to read from
* @returns OK or FAIL
*/
int retrieveDetectorSetup(std::string const fname);
int retrieveDetectorSetup(const std::string& fname);
/**
* Saves the detector setup to file (currentmeasurement setup)
* @param fname file to write to
* @returns OK or FAIL
*/
int dumpDetectorSetup(std::string const fname);
int dumpDetectorSetup(const std::string& fname);
/**
* Get detector firmware version
@ -594,7 +594,7 @@ public:
* @param s file directory
* @returns file dir
*/
std::string setFilePath(std::string s, int detPos = -1);
std::string setFilePath(const std::string& s, int detPos = -1);
/**
* Returns file name prefix
@ -609,7 +609,7 @@ public:
* @param s file name prefix
* @returns file name prefix
*/
std::string setFileName(std::string s, int detPos = -1);
std::string setFileName(const std::string& s, int detPos = -1);
/**
* Returns file index
@ -705,7 +705,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns receiver streaming out ZMQ IP
*/
std::string setReceiverDataStreamingOutIP(std::string ip="", int detPos = -1);
std::string setReceiverDataStreamingOutIP(const std::string& ip="", int detPos = -1);
/**
* (advanced users)
@ -715,7 +715,7 @@ public:
* @param detPos -1 for all detectors in list or specific detector position
* @returns client streaming in ZMQ IP
*/
std::string setClientDataStreamingInIP(std::string ip="", int detPos = -1);
std::string setClientDataStreamingInIP(const std::string& ip = "", int detPos = -1);
/**
* Enable gap pixels in receiver (Eiger for 8,16 and 32 bit mode)