Commit 347889d6 authored by Roberto Arturo Homs-Regojo's avatar Roberto Arturo Homs-Regojo

Merge remote branch 'remotes/origin/master'

parents a93a23b5 c2297813
......@@ -81,4 +81,4 @@
url = git://github.com/esrf-bliss/Lima-camera-rayonixhs
[submodule "camera/andor3"]
path = camera/andor3
url = git://github.com:esrf-bliss/Lima-camera-andor3.git
url = git://github.com/esrf-bliss/Lima-camera-andor3.git
Subproject commit abf42bc7b60fd61731facc46cb2ac23201414c11
Subproject commit e50b74fa3f09573ae7dfdc0367399c8c3a3142ab
Subproject commit 5cdcbebed023677d78a0ebbd046bdaabf6fc9d84
Subproject commit 9a9f9d76d02690f9de3ac098634d7e8ae5062fcc
Subproject commit 7254a9edc9cc53cc6817e303c4ee7aa193395fb9
Subproject commit 88d5ca852c80b9179040fc0808f1fdd86ce1294c
......@@ -57,7 +57,7 @@ class LIMACORE_API Event
Timestamp rel_timestamp;
Event();
Event(Layer l, Severity s, Domain d, Code c, std::string e);
Event(Layer l, Severity s, Domain d, Code c,const std::string &e);
virtual ~Event();
virtual std::string getMsgStr();
......
......@@ -51,7 +51,7 @@ using namespace lima;
Timestamp rel_timestamp;
Event();
Event(Layer l, Severity s, Domain d, Code c, std::string e);
Event(Layer l, Severity s, Domain d, Code c, const std::string &e);
virtual ~Event();
virtual std::string getMsgStr();
......
......@@ -34,7 +34,7 @@ Event::Event()
abs_timestamp = Timestamp::now();
}
Event::Event(Layer l, Severity s, Domain d, Code c, string e)
Event::Event(Layer l, Severity s, Domain d, Code c, const string &e)
: layer(l), severity(s), domain(d), code(c), desc(e)
{
abs_timestamp = Timestamp::now();
......
......@@ -205,6 +205,8 @@ namespace lima
return d1.frameNumber < d2.frameNumber;
}
};
class SoftOpErrorHandler;
class _LastBaseImageReadyCallback;
friend class _LastBaseImageReadyCallback;
class _LastImageReadyCallback;
......@@ -254,6 +256,7 @@ namespace lima
bool m_display_active_flag;
#endif
ImageStatusCallback *m_img_status_cb;
SoftOpErrorHandler* m_soft_op_error_handler;
inline bool _checkOverrun(Data&);
inline void _calcAcqStatus();
......
......@@ -169,6 +169,12 @@ namespace lima {
void setEndCallback(TaskEventCallback *);
// --- internal common header
void resetInternalCommonHeader();
void addToInternalCommonHeader(const HeaderValue& value);
template<class T>
void addToInternalCommonHeader(const std::string &key,
const T&);
// --- statistic
void getWriteTimeStatistic(std::list<double>&, int stream_idx=0) const;
......@@ -325,6 +331,7 @@ namespace lima {
Stream **m_stream;
HeaderMap m_common_header;
HeaderMap m_internal_common_header;
FrameHeaderMap m_frame_headers;
FrameMap m_frame_datas;
......@@ -470,6 +477,19 @@ namespace lima {
os << "< (" << value.first << "," << value.second << ") >";
return os;
}
template<class T>
void CtSaving::addToInternalCommonHeader(const std::string &key,
const T& obj)
{
AutoMutex aLock(m_cond.mutex());
std::ostringstream str;
str << obj;
const std::string& value = str.str();
HeaderValue anEntry(key,value);
m_internal_common_header.insert(anEntry);
}
} // namespace lima
#endif // CTSAVING_H
......@@ -112,7 +112,21 @@ private:
CtControl &_ctrl;
};
class CtControl::SoftOpErrorHandler : public TaskMgr::EventCallback
{
public:
SoftOpErrorHandler(CtControl &ctr) : m_ct(ctr) {}
virtual void error(Data&,const char *errmsg)
{
Event *anEvent = new Event(Control,Event::Error,Event::Processing,
Event::Default,errmsg);
CtEvent *eventMgr = m_ct.event();
eventMgr->reportEvent(anEvent);
}
private:
CtControl& m_ct;
};
CtControl::CtControl(HwInterface *hw) :
m_hw(hw),
......@@ -148,6 +162,8 @@ CtControl::CtControl(HwInterface *hw) :
#endif
m_op_int = new SoftOpInternalMgr();
m_op_ext = new SoftOpExternalMgr();
m_soft_op_error_handler = new SoftOpErrorHandler(*this);
}
CtControl::~CtControl()
......@@ -174,6 +190,8 @@ CtControl::~CtControl()
delete m_op_int;
delete m_op_ext;
delete m_soft_op_error_handler;
}
void CtControl::setApplyPolicy(ApplyPolicy policy)
......@@ -207,6 +225,9 @@ void CtControl::prepareAcq()
throw LIMA_CTL_EXC(Error,"Configuration not finished");
resetStatus(false);
//Clear common header
m_ct_saving->resetInternalCommonHeader();
DEB_TRACE() << "Apply hardware bin/roi";
m_ct_image->applyHard();
......@@ -568,6 +589,7 @@ bool CtControl::newFrameReady(Data& fdata)
aLock.unlock();
TaskMgr *mgr = new TaskMgr();
mgr->setEventCallback(m_soft_op_error_handler);
mgr->setInputData(fdata);
int internal_stage = 0;
......
......@@ -22,6 +22,7 @@
#include "CtImage.h"
#include "CtAcquisition.h"
#include "CtSaving.h"
using namespace lima;
......@@ -881,6 +882,24 @@ void CtImage::applyHard()
}
m_hw->apply();
//Add operation into internal header
CtSaving* saving = m_ct.saving();
Bin bin;getBin(bin);
if(!bin.isOne())
saving->addToInternalCommonHeader("binning",bin);
Roi roi;getRoi(roi);
if(!roi.isEmpty())
saving->addToInternalCommonHeader("roi",roi);
Flip flip;getFlip(flip);
if(flip.x || flip.y)
saving->addToInternalCommonHeader("flip",flip);
RotationMode rMode;getRotation(rMode);
if(rMode != Rotation_0)
saving->addToInternalCommonHeader("rotation",rMode);
}
bool CtImage::applySoft(SoftOpInternalMgr *op)
......
......@@ -957,6 +957,8 @@ void CtSaving::removeAllFrameHeaders()
void CtSaving::_getCommonHeader(HeaderMap &header)
{
header.insert(m_internal_common_header.begin(),
m_internal_common_header.end());
header.insert(m_common_header.begin(),m_common_header.end());
}
void CtSaving::_takeHeader(FrameHeaderMap::iterator& headerIter,
......@@ -1005,6 +1007,18 @@ void CtSaving::setEndCallback(TaskEventCallback *aCbkPt)
m_end_cbk->ref();
}
void CtSaving::resetInternalCommonHeader()
{
AutoMutex aLock(m_cond.mutex());
m_internal_common_header.clear();
}
void CtSaving::addToInternalCommonHeader(const HeaderValue& value)
{
AutoMutex aLock(m_cond.mutex());
m_internal_common_header.insert(value);
}
bool CtSaving::_controlIsFault()
{
DEB_MEMBER_FUNCT();
......
Subproject commit a5733137c6c38180db09e043419f62dd109ef2ec
Subproject commit 124cff5e1c2accc86071fe217e379b77fcb8af82
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