gui: crashing when using roi fixed

This commit is contained in:
2018-09-20 18:10:10 +02:00
parent 235002cdd4
commit 9f84bf7175
10 changed files with 70 additions and 50 deletions

View File

@ -31,7 +31,7 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
* @param ajh additional json header
* @param sm pointer to silent mode
*/
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI*>* r,
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
uint64_t* fi, int* fd, char* ajh, bool* sm);
/**
@ -175,7 +175,7 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
uint32_t* dynamicRange;
/** ROI */
std::vector<ROI*>* roi;
std::vector<ROI>* roi;
/** adc Configured */
int adcConfigured;

View File

@ -160,17 +160,17 @@ public:
* Set ROI
* @param i ROI
*/
virtual void SetROI(std::vector<slsReceiverDefs::ROI*> i) {
virtual void SetROI(std::vector<slsReceiverDefs::ROI> i) {
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
};
/**
* Get Adc configured
* @param index thread index for debugging purposes
* @param i ROI
* @param i pointer to a vector of ROI pointers
* @returns adc configured
*/
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI*> i) const{
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
return 0;
};
@ -323,7 +323,7 @@ private:
* Set ROI
* @param i ROI
*/
virtual void SetROI(std::vector<slsReceiverDefs::ROI*> i) {
virtual void SetROI(std::vector<slsReceiverDefs::ROI> i) {
// all adcs
if(!i.size()) {
nPixelsX = 1280;
@ -364,23 +364,22 @@ private:
/**
* Get Adc configured
* @param index thread index for debugging purposes
* @param i ROI
* @param i pointer to a vector of ROI
* @returns adc configured
*/
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI*> i) const{
virtual const int GetAdcConfigured(int index, std::vector<slsReceiverDefs::ROI>* i) const{
int adc = -1;
// single adc
if(i.size()) {
if(i->size()) {
// gotthard can have only one adc per detector enabled (or all)
// so just looking at the first roi is enough (more not possible at the moment)
//if its for 1 adc or general
if ((i[0]->xmin == 0) && (i[0]->xmax == nChip * nChan))
if ((i->at(0).xmin == 0) && (i->at(0).xmax == nChip * nChan))
adc = -1;
else {
//adc = mid value/numchans also for only 1 roi
adc = ((((i[0]->xmax) + (i[0]->xmin))/2)/
adc = ((((i->at(0).xmax) + (i->at(0).xmin))/2)/
(nChan * nChipsPerAdc));
if((adc < 0) || (adc > 4)) {
FILE_LOG(logWARNING) << index << ": Deleting ROI. "
@ -389,6 +388,7 @@ private:
}
}
}
FILE_LOG(logINFO) << "Adc Configured: " << adc;
return adc;
};

View File

@ -185,7 +185,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* Get ROI
* @return index of adc enabled, else -1 if all enabled
*/
std::vector<ROI*> getROI() const;
std::vector<ROI> getROI() const;
/**
* Get the Frequency of Frames Sent to GUI
@ -452,7 +452,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* @param i ROI
* @return OK or FAIL
*/
int setROI(const std::vector<ROI*> i);
int setROI(const std::vector<ROI> i);
/**
* Set the Frequency of Frames Sent to GUI
@ -786,7 +786,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
//***acquisition parameters***
/* ROI */
std::vector<ROI*> roi;
std::vector<ROI> roi;
/** Frequency of Frames sent to GUI */
uint32_t frameToGuiFrequency;
/** Timer of Frames sent to GUI when frequency is 0 */

View File

@ -276,7 +276,7 @@ class UDPInterface {
* Get ROI
* @return index of adc enabled, else -1 if all enabled
*/
virtual std::vector<slsReceiverDefs::ROI*> getROI() const = 0;
virtual std::vector<slsReceiverDefs::ROI> getROI() const = 0;
/**
* Get the Frequency of Frames Sent to GUI
@ -541,7 +541,7 @@ class UDPInterface {
* @param i ROI
* @return OK or FAIL
*/
virtual int setROI(const std::vector<slsReceiverDefs::ROI*> i) = 0;
virtual int setROI(const std::vector<slsReceiverDefs::ROI> i) = 0;
/**
* Set the Frequency of Frames Sent to GUI

View File

@ -77,7 +77,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
* @param i ROI
* @return OK or FAIL
*/
int setROI(const std::vector<ROI*> i);
int setROI(const std::vector<ROI> i);
/**
* Set the Frequency of Frames Sent to GUI