From e19ca7f7772949dee2a7172cfdb638a21c141205 Mon Sep 17 00:00:00 2001 From: bergamaschi Date: Tue, 22 May 2012 12:25:51 +0000 Subject: [PATCH] Based on the multiSlsDetectorClient class git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@400 951219d9-93cf-4727-9268-0efd64621fa3 --- .../slsDetectorClient/Makefile | 2 +- .../slsDetectorClient/sls_detector_client.cpp | 129 +++--------------- 2 files changed, 23 insertions(+), 108 deletions(-) diff --git a/slsDetectorSoftware/slsDetectorClient/Makefile b/slsDetectorSoftware/slsDetectorClient/Makefile index ce5fa710b..9e67912a7 100644 --- a/slsDetectorSoftware/slsDetectorClient/Makefile +++ b/slsDetectorSoftware/slsDetectorClient/Makefile @@ -1,6 +1,6 @@ CFLAGS= -DC_ONLY #FLAGS=-DVERBOSE -INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis +INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis LIBS= -L../slsDetectorSoftware/ LDFLAG= -lSlsDetector -lpthread diff --git a/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp b/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp index 79934504b..bed9b9848 100644 --- a/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp +++ b/slsDetectorSoftware/slsDetectorClient/sls_detector_client.cpp @@ -1,10 +1,4 @@ -#include -#include - - -#include "multiSlsDetector.h" -#include "slsDetector.h" -#include "slsDetectorCommand.h" +#include "multiSlsDetectorClient.h" #include @@ -13,110 +7,31 @@ using namespace std; int main(int argc, char *argv[]) { - - - int id=-1, iv=0; - char *c; - string answer; - char cmd[100]; - int action; - slsDetectorUtils *myDetector; - slsDetectorCommand *myCmd; - - - -#ifdef READOUT - action=slsDetectorDefs::READOUT_ACTION; -#elif PUT - action=slsDetectorDefs::PUT_ACTION; -#elif GET - action=slsDetectorDefs::GET_ACTION; -#elif HELP - action=slsDetectorDefs::HELP_ACTION; -#endif -#ifdef VERBOSE - for (int ia=0; ia1){ - - - - iv=sscanf(argv[1],"%d%s",&id, cmd); - if (id>=0) { - if (iv==2) { - if (cmd[0]=='-') { -#ifdef VERBOSE - cout << "Using multiSlsDetector id=" << id << endl; -#endif - myDetector=new multiSlsDetector(id); - argv[1]=cmd+1; - } else if (cmd[0]==':') { -#ifdef VERBOSE - cout << "Using slsDetector id=" << id << endl; -#endif - myDetector=new slsDetector(id); - argv[1]=cmd+1; - } else { - cout << "Wrong syntax: no channels starts with integer number "<1) + cl=new multiSlsDetectorClient(argc-1, argv+1, action); + else + cl=new multiSlsDetectorClient(argc-1, argv, action); - -#ifdef PUT - if (argc<3) { - cout << "Wrong usage - should be: "<< argv[0] <<" " << argv[1]<< " arg" << endl; - //cout << slsDetectorCommand::helpLine(argc-1, argv+1, action); - cout << endl; - return -1; - } -#endif - myCmd=new slsDetectorCommand(myDetector); - - if (argc<2) { - answer=myCmd->executeLine(argc-1, argv, action); - } else { - answer=myCmd->executeLine(argc-1, argv+1, action); - cout << argv[1] << " " ; - } - cout << answer<< endl; - - - return 0; + delete cl; } +