removed pointer in multiSlsDetectorClient

This commit is contained in:
Erik Frojdh
2019-01-16 10:56:51 +01:00
parent fe09f6d062
commit 68545f2b26
3 changed files with 34 additions and 36 deletions

View File

@ -26,8 +26,12 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
# set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
# set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=thread")
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
set (CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
find_package(Qt4)
find_package(Qwt 6)

View File

@ -20,7 +20,7 @@ class multiSlsDetectorClient {
public:
multiSlsDetectorClient(int argc, char *argv[], int action, multiSlsDetector *myDetector=NULL) { \
std::string answer; \
multiSlsDetectorCommand *myCmd; \
// multiSlsDetectorCommand *myCmd;
int id = -1, pos = -1, iv = 0; \
bool verify = true, update = true; \
int del = 0; \
@ -122,18 +122,19 @@ public:
std::cout << "position is out of bounds." << std::endl; \
return; \
} \
// call multi detector command line
myCmd=new multiSlsDetectorCommand(myDetector); \
try { \
answer=myCmd->executeLine(argc, argv, action, pos); \
try {
// call multi detector command line
multiSlsDetectorCommand myCmd(myDetector); \
answer=myCmd.executeLine(argc, argv, action, pos); \
} catch (const SlsDetectorPackageExceptions & e) { \
/*std::cout << e.GetMessage() << std::endl; */ \
delete myCmd; \
if (del) delete myDetector; \
return; \
} catch (...) { \
std::cout << " caught exception" << std::endl; \
delete myCmd; \
\
if (del) delete myDetector; \
return; \
} \
@ -141,7 +142,7 @@ public:
std::cout << argv[0] << " " ; \
} \
std::cout << answer<< std::endl; \
delete myCmd; \
\
if (del) delete myDetector; \
};

View File

@ -1,40 +1,33 @@
#include "multiSlsDetectorClient.h"
#include "gitInfoLib.h"
#include "multiSlsDetectorClient.h"
#include <cstdlib>
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; ++i ) {
if (!(strcmp (argv[i],"--version")) || !(strcmp (argv[i],"-v"))) {
int64_t tempval = GITDATE;
std::cout << argv[0] << " " << GITBRANCH << " (0x" << std::hex << tempval << ")" << std::endl;
return 0;
}
}
int main(int argc, char *argv[]) {
for (int i = 1; i < argc; ++i) {
if (!(strcmp(argv[i], "--version")) || !(strcmp(argv[i], "-v"))) {
int64_t tempval = GITDATE;
std::cout << argv[0] << " " << GITBRANCH << " (0x" << std::hex << tempval << ")" << std::endl;
return 0;
}
}
#ifdef PUT
int action=slsDetectorDefs::PUT_ACTION;
int action = slsDetectorDefs::PUT_ACTION;
#endif
#ifdef GET
int action=slsDetectorDefs::GET_ACTION;
int action = slsDetectorDefs::GET_ACTION;
#endif
#ifdef READOUT
int action=slsDetectorDefs::READOUT_ACTION;
int action = slsDetectorDefs::READOUT_ACTION;
#endif
#ifdef HELP
int action=slsDetectorDefs::HELP_ACTION;
int action = slsDetectorDefs::HELP_ACTION;
#endif
if (argc>1)
multiSlsDetectorClient(argc-1, argv+1, action);
else
multiSlsDetectorClient(argc-1, argv, action);
if (argc > 1)
argv++;
multiSlsDetectorClient(argc - 1, argv, action);
}