sanitizer on, gui:removed qfuture, client: not implemented made specific as to what is not

This commit is contained in:
maliakal_d 2020-03-06 15:41:15 +01:00
parent a2e019ff36
commit 0a596c689b
8 changed files with 28 additions and 39 deletions

4
cmk.sh
View File

@ -187,8 +187,8 @@ fi
#Debug #Debug
if [ $DEBUG -eq 1 ]; then if [ $DEBUG -eq 1 ]; then
CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug " # CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug "
# CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON " CMAKE_POST+=" -DCMAKE_BUILD_TYPE=Debug -DSLS_USE_SANITIZER=ON "
echo "Debug Option enabled" echo "Debug Option enabled"
fi fi

View File

@ -12,7 +12,6 @@ class detectorData;
#include "Detector.h" #include "Detector.h"
class QResizeEvent; class QResizeEvent;
#include <QFutureWatcher>
#include <mutex> #include <mutex>
@ -64,11 +63,11 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
private slots: private slots:
void SetSaveFileName(QString val); void SetSaveFileName(QString val);
void AcquireFinished(); void AcquireThread();
void UpdatePlot(); void UpdatePlot();
signals: signals:
void StartAcquireSignal();
void AcquireFinishedSignal(); void AcquireFinishedSignal();
void AbortSignal(); void AbortSignal();
void UpdateSignal(); void UpdateSignal();
@ -81,7 +80,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
void DetachHists(); void DetachHists();
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer); static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer); static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
std::string AcquireThread();
void AcquisitionFinished(double currentProgress, int detectorStatus); void AcquisitionFinished(double currentProgress, int detectorStatus);
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex); void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL); void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
@ -102,7 +100,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
SlsQtH1D * gainhist1d{nullptr}; SlsQtH1D * gainhist1d{nullptr};
SlsQt2DPlot *plot2d{nullptr}; SlsQt2DPlot *plot2d{nullptr};
SlsQt2DPlot *gainplot2d{nullptr}; SlsQt2DPlot *gainplot2d{nullptr};
QFutureWatcher<std::string> *acqResultWatcher;
bool is1d{true}; bool is1d{true};
bool isRunning{false}; bool isRunning{false};

View File

@ -26,7 +26,7 @@ class SlsQt2DHist: public QwtRasterData{
double x_width,y_width; double x_width,y_width;
int nx,ny,nb; int nx,ny,nb;
double *data; double *data{nullptr};
double z_min,z_mean,z_max; double z_min,z_mean,z_max;
bool z_mean_has_been_calculated; bool z_mean_has_been_calculated;

View File

@ -55,9 +55,11 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
SlsQt2DPlot::~SlsQt2DPlot() { SlsQt2DPlot::~SlsQt2DPlot() {
if (d_spectrogram) { if (d_spectrogram) {
d_spectrogram->detach(); d_spectrogram->detach();
//delete d_spectrogram;
} }
if (hist) if (hist) {
delete hist; delete hist;
}
if (colorMapLinearScale) if (colorMapLinearScale)
delete colorMapLinearScale; delete colorMapLinearScale;
if (colorMapLogScale) if (colorMapLogScale)

View File

@ -13,7 +13,6 @@
#include <QtConcurrentRun> #include <QtConcurrentRun>
#include <QResizeEvent> #include <QResizeEvent>
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) { qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) {
setupUi(this); setupUi(this);
SetupWidgetWindow(); SetupWidgetWindow();
@ -91,15 +90,12 @@ void qDrawPlot::SetupWidgetWindow() {
SetupPlots(); SetupPlots();
SetDataCallBack(true); SetDataCallBack(true);
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this); det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
// future watcher to watch result of AcquireThread only because it uses signals/slots to handle acquire exception
acqResultWatcher = new QFutureWatcher<std::string>();
Initialization(); Initialization();
} }
void qDrawPlot::Initialization() { void qDrawPlot::Initialization() {
connect(this, SIGNAL(UpdateSignal()), this, SLOT(UpdatePlot())); connect(this, SIGNAL(UpdateSignal()), this, SLOT(UpdatePlot()));
connect(acqResultWatcher, SIGNAL(finished()), this, SLOT(AcquireFinished())); connect(this, SIGNAL(StartAcquireSignal()), this, SLOT(AcquireThread()));
} }
void qDrawPlot::SetupPlots() { void qDrawPlot::SetupPlots() {
@ -640,16 +636,19 @@ void qDrawPlot::StartAcquisition() {
xyRangeChanged = true; xyRangeChanged = true;
} }
// acquisition in another thread emit StartAcquireSignal();
QFuture<std::string> future = QtConcurrent::run(this, &qDrawPlot::AcquireThread);
acqResultWatcher->setFuture(future);
FILE_LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot"; FILE_LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot";
} }
void qDrawPlot::AcquireFinished() { void qDrawPlot::AcquireThread() {
FILE_LOG(logDEBUG) << "Acquisition Finished"; FILE_LOG(logDEBUG) << "Acquire Thread";
std::string mess = acqResultWatcher->result(); std::string mess;
try {
det->acquire();
} catch (const std::exception &e) {
mess = std::string(e.what());
}
FILE_LOG(logINFO) << "Acquisition Finished";
// exception in acquire will not call acquisition finished call back, so handle it // exception in acquire will not call acquisition finished call back, so handle it
if (!mess.empty()) { if (!mess.empty()) {
FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess; FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
@ -665,16 +664,6 @@ void qDrawPlot::AcquireFinished() {
FILE_LOG(logDEBUG) << "End of Acquisition Finished"; FILE_LOG(logDEBUG) << "End of Acquisition Finished";
} }
std::string qDrawPlot::AcquireThread() {
FILE_LOG(logDEBUG) << "Acquire Thread";
try {
det->acquire();
} catch (const std::exception &e) {
return std::string(e.what());
}
return std::string("");
}
void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer) { void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer) {
((qDrawPlot *)this_pointer)->AcquisitionFinished(currentProgress, detectorStatus); ((qDrawPlot *)this_pointer)->AcquisitionFinished(currentProgress, detectorStatus);
FILE_LOG(logDEBUG) << "Acquisition Finished Call back successful"; FILE_LOG(logDEBUG) << "Acquisition Finished Call back successful";
@ -786,6 +775,7 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
} else { } else {
Get2dData(rawData); Get2dData(rawData);
} }
delete [] rawData;
FILE_LOG(logDEBUG) << "End of Get Data"; FILE_LOG(logDEBUG) << "End of Get Data";
emit UpdateSignal(); emit UpdateSignal();

View File

@ -492,7 +492,7 @@ std::string CmdProxy::ClockFrequency(int action) {
} else { } else {
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC); defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) { if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
throw sls::RuntimeError("Not implemented for this detector."); throw sls::RuntimeError("clkfreq not implemented for this detector.");
} }
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -526,7 +526,7 @@ std::string CmdProxy::ClockPhase(int action) {
} else { } else {
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC); defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) { if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
throw sls::RuntimeError("Not implemented for this detector."); throw sls::RuntimeError("clkphase not implemented for this detector.");
} }
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
if (args.size() == 1) { if (args.size() == 1) {
@ -576,7 +576,7 @@ std::string CmdProxy::MaxClockPhaseShift(int action) {
} else { } else {
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC); defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) { if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
throw sls::RuntimeError("Not implemented for this detector."); throw sls::RuntimeError("maxclkphaseshift not implemented for this detector.");
} }
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {
@ -603,7 +603,7 @@ std::string CmdProxy::ClockDivider(int action) {
} else { } else {
defs::detectorType type = det->getDetectorType().squash(defs::GENERIC); defs::detectorType type = det->getDetectorType().squash(defs::GENERIC);
if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) { if (type != defs::GOTTHARD2 && type != defs::MYTHEN3) {
throw sls::RuntimeError("Not implemented for this detector."); throw sls::RuntimeError("clkdiv not implemented for this detector.");
} }
if (action == defs::GET_ACTION) { if (action == defs::GET_ACTION) {
if (args.size() != 1) { if (args.size() != 1) {

View File

@ -1083,7 +1083,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
} }
break; break;
default: default:
throw RuntimeError("Not implemented for this detector"); throw RuntimeError("programfpga not implemented for this detector");
} }
FILE_LOG(logINFO) FILE_LOG(logINFO)

View File

@ -2920,7 +2920,7 @@ int slsDetector::enableGapPixels(int val) {
int slsDetector::setTrimEn(const std::vector<int>& energies) { int slsDetector::setTrimEn(const std::vector<int>& energies) {
if (shm()->myDetectorType != EIGER) { if (shm()->myDetectorType != EIGER) {
throw RuntimeError("Not implemented for this detector."); throw RuntimeError("setTrimEn not implemented for this detector.");
} }
if (energies.size() > MAX_TRIMEN) { if (energies.size() > MAX_TRIMEN) {
std::ostringstream os; std::ostringstream os;
@ -2935,7 +2935,7 @@ int slsDetector::setTrimEn(const std::vector<int>& energies) {
std::vector<int> slsDetector::getTrimEn() { std::vector<int> slsDetector::getTrimEn() {
if (shm()->myDetectorType != EIGER) { if (shm()->myDetectorType != EIGER) {
throw RuntimeError("Not implemented for this detector."); throw RuntimeError("getTrimEn not implemented for this detector.");
} }
return std::vector<int>(shm()->trimEnergies.begin(), return std::vector<int>(shm()->trimEnergies.begin(),
shm()->trimEnergies.end()); shm()->trimEnergies.end());