Commit 7eaeb1f6 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by Sebastien Petitdemange

* Unified redundant DEB_ERROR/THROW_CTL_ERROR pairs

parent 25c8c4de
......@@ -23,18 +23,18 @@
#include "CtAcquisition.h"
#include "math.h"
#define CHECK_EXPOTIME(val) \
if (val < m_valid_ranges.min_exp_time) \
{ \
DEB_ERROR() << "Specified " << DEB_VAR1(val) << " too short: " \
<< DEB_VAR1(m_valid_ranges.min_exp_time); \
THROW_CTL_ERROR(InvalidValue) << "Exposure time too short"; \
} \
else if (val > m_valid_ranges.max_exp_time) \
{ \
DEB_ERROR() << "Specified " << DEB_VAR1(val) << " too long: " \
<< DEB_VAR1(m_valid_ranges.max_exp_time); \
THROW_CTL_ERROR(InvalidValue) << "Exposure time too long"; \
#define CHECK_EXPOTIME(val) \
if (val < m_valid_ranges.min_exp_time) \
{ \
THROW_CTL_ERROR(InvalidValue) \
<< "Specified exposure time " << DEB_VAR1(val) << " too short: " \
<< DEB_VAR1(m_valid_ranges.min_exp_time); \
} \
else if (val > m_valid_ranges.max_exp_time) \
{ \
THROW_CTL_ERROR(InvalidValue) \
<< "Specified exposure time " << DEB_VAR1(val) << " too long: " \
<< DEB_VAR1(m_valid_ranges.max_exp_time); \
}
using namespace lima;
......@@ -624,7 +624,9 @@ void CtAcquisition::setLatencyTime(double lat_time)
if (lat_time < m_valid_ranges.min_lat_time)
lat_time = m_valid_ranges.min_lat_time;
if (lat_time > m_valid_ranges.max_lat_time)
THROW_CTL_ERROR(InvalidValue) << "Latency time too long";
THROW_CTL_ERROR(InvalidValue)
<< "Specified latency time " << DEB_VAR1(lat_time) << " too long: "
<< DEB_VAR1(m_valid_ranges.max_lat_time);
m_inpars.latencyTime= lat_time;
}
......
......@@ -386,7 +386,7 @@ void CtControl::startAcq()
DEB_MEMBER_FUNCT();
if (!m_ready)
THROW_CTL_ERROR(Error) << "Run prepareAcq before starting acquisition";
THROW_CTL_ERROR(Error) << "Run prepareAcq before starting acquisition";
m_running = true;
TrigMode trigMode;
m_ct_acq->getTriggerMode(trigMode);
......@@ -399,7 +399,7 @@ void CtControl::startAcq()
HwInterface::Status hwStatus;
m_hw->getStatus(hwStatus);
if(hwStatus.det != DetIdle)
THROW_CTL_ERROR(Error) << "Try to restart before detector is ready";
THROW_CTL_ERROR(Error) << "Try to restart before detector is ready";
//m_ready = false after the last image is triggerred
int nbFrames4Acq;
......@@ -585,9 +585,9 @@ void CtControl::ReadBaseImage(Data &aReturnData,long frameNumber,
if (frameNumber < 0) {
frameNumber = lastFrame - (readBlockLen - 1);
if (frameNumber < 0)
THROW_CTL_ERROR(Error) << "Frame(s) not available yet";
THROW_CTL_ERROR(Error) << "Frame(s) not available yet";
} else if (frameNumber + readBlockLen - 1 > lastFrame)
THROW_CTL_ERROR(Error) << "Frame(s) not available yet";
THROW_CTL_ERROR(Error) << "Frame(s) not available yet";
aLock.unlock();
m_ct_buffer->getFrame(aReturnData,frameNumber,readBlockLen);
......@@ -597,7 +597,7 @@ void CtControl::ReadBaseImage(Data &aReturnData,long frameNumber,
int roiHeight = img_dim.getSize().getHeight() * readBlockLen;
if((roiWidth * roiHeight) >
(aReturnData.dimensions[0] * aReturnData.dimensions[1]))
THROW_CTL_ERROR(Error) << "Roi dim > HwBuffer dim";
THROW_CTL_ERROR(Error) << "Roi dim > HwBuffer dim";
aReturnData.dimensions[0] = roiWidth;
aReturnData.dimensions[1] = roiHeight;
......@@ -841,10 +841,8 @@ void CtControl::registerImageStatusCallback(ImageStatusCallback& cb)
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(&cb, m_img_status_cb);
if (m_img_status_cb) {
DEB_ERROR() << "ImageStatusCallback already registered";
THROW_CTL_ERROR(InvalidValue) << "ImageStatusCallback already registered";
}
if (m_img_status_cb)
THROW_CTL_ERROR(InvalidValue) << "ImageStatusCallback already registered";
cb.setImageStatusCallbackGen(this);
m_img_status_cb = &cb;
......@@ -855,10 +853,8 @@ void CtControl::unregisterImageStatusCallback(ImageStatusCallback& cb)
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR2(&cb, m_img_status_cb);
if (m_img_status_cb != &cb) {
DEB_ERROR() << "ImageStatusCallback not registered";
THROW_CTL_ERROR(InvalidValue) << "ImageStatusCallback not registered";
}
if (m_img_status_cb != &cb)
THROW_CTL_ERROR(InvalidValue) << "ImageStatusCallback not registered";
m_img_status_cb = NULL;
cb.setImageStatusCallbackGen(NULL);
......
......@@ -655,10 +655,7 @@ void CtVideo::registerImageCallback(ImageCallback &cb)
DEB_PARAM() << DEB_VAR2(&cb, m_image_callback);
if(m_image_callback)
{
DEB_ERROR() << "ImageCallback already registered";
THROW_CTL_ERROR(InvalidValue) << "ImageCallback already registered";
}
THROW_CTL_ERROR(InvalidValue) << "ImageCallback already registered";
m_image_callback = &cb;
}
......@@ -670,10 +667,7 @@ void CtVideo::unregisterImageCallback(ImageCallback &cb)
AutoMutex aLock(m_cond.mutex());
DEB_PARAM() << DEB_VAR2(&cb, m_image_callback);
if(m_image_callback != &cb)
{
DEB_ERROR() << "ImageCallback not registered";
THROW_CTL_ERROR(InvalidValue) << "ImageCallback not registered";
}
THROW_CTL_ERROR(InvalidValue) << "ImageCallback not registered";
m_image_callback = NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment