Commit c0a5dc18 authored by seb's avatar seb
Browse files

insert Debug in all Control layer


git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@192 45c4679d-1946-429d-baad-37912b19538b
parent 6f13d7f5
......@@ -114,7 +114,7 @@ namespace lima
<< "accMaxExpoTime=" << params.accMaxExpoTime << ", "
<< "concatNbFrames=" << params.concatNbFrames << ", "
<< "latencyTime=" << params.latencyTime << ", "
<< "triggerMode=" << params.triggerMode << ", "
<< "triggerMode=" << params.triggerMode
<< ">";
return os;
}
......
......@@ -12,57 +12,74 @@
namespace lima {
class CtBufferFrameCB : public HwFrameCallback
{
class CtBufferFrameCB : public HwFrameCallback
{
DEB_CLASS_NAMESPC(DebModControl,"BufferFrameCB","Control");
public:
CtBufferFrameCB(CtControl *ct): m_ct(ct) {}
protected:
bool newFrameReady(const HwFrameInfoType& frame_info);
private:
CtControl *m_ct;
};
class CtBuffer
{
DEB_CLASS_NAMESPC(DebModControl,"Buffer","Control");
public:
struct Parameters
{
DEB_CLASS_NAMESPC(DebModControl,"Buffer::Parameters","Control");
public:
CtBufferFrameCB(CtControl *ct): m_ct(ct) {}
protected:
bool newFrameReady(const HwFrameInfoType& frame_info);
private:
CtControl *m_ct;
};
Parameters();
void reset();
BufferMode mode;
long nbBuffers;
short maxMemory;
};
class CtBuffer {
CtBuffer(HwInterface *hw);
~CtBuffer();
public:
struct Parameters {
Parameters();
void reset();
BufferMode mode;
long nbBuffers;
short maxMemory;
};
CtBuffer(HwInterface *hw);
~CtBuffer();
void setPars(Parameters pars);
void getPars(Parameters& pars) const;
void setPars(Parameters pars);
void getPars(Parameters& pars) const;
void setMode(BufferMode mode);
void getMode(BufferMode& mode) const;
void setMode(BufferMode mode);
void getMode(BufferMode& mode) const;
void setNumber(long nb_buffers);
void getNumber(long& nb_buffers) const;
void setNumber(long nb_buffers);
void getNumber(long& nb_buffers) const;
void setMaxMemory(short max_memory);
void getMaxMemory(short& max_memory) const;
void setMaxMemory(short max_memory);
void getMaxMemory(short& max_memory) const;
void registerFrameCallback(CtControl *ct);
void unregisterFrameCallback();
void registerFrameCallback(CtControl *ct);
void unregisterFrameCallback();
void getFrame(Data&,int frameNumber);
void getFrame(Data&,int frameNumber);
void setup(CtControl *ct);
void setup(CtControl *ct);
static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&);
private:
static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&);
private:
HwBufferCtrlObj *m_hw_buffer;
CtBufferFrameCB *m_frame_cb;
Parameters m_pars;
HwBufferCtrlObj *m_hw_buffer;
CtBufferFrameCB *m_frame_cb;
Parameters m_pars;
};
};
inline std::ostream& operator<<(std::ostream &os,
const CtBuffer::Parameters &params)
{
os << "<"
<< "mode=" << params.mode << ", "
<< "nbBuffers=" << params.nbBuffers << ", "
<< "maxMemory=" << params.maxMemory << ", "
<< ">";
return os;
}
} // namespace lima
#endif // CTBUFFER_H
......@@ -10,9 +10,9 @@
#include "Data.h"
namespace lima {
namespace lima
{
class CtDebug;
class CtAcquisition;
class CtImage;
class CtBuffer;
......@@ -23,7 +23,9 @@ namespace lima {
class SoftOpExternalMgr;
class CtControl {
friend class CtBufferFrameCB;
DEB_CLASS_NAMESPC(DebModControl,"Control","Control");
friend class CtBufferFrameCB;
public:
enum ApplyPolicy {
......@@ -34,6 +36,8 @@ namespace lima {
struct ImageStatus {
DEB_CLASS_NAMESPC(DebModControl,"Control::ImageStatus","Control");
public:
ImageStatus();
void reset();
......@@ -56,10 +60,6 @@ namespace lima {
CtImage* image() { return m_ct_image; }
CtBuffer* buffer() { return m_ct_buffer; }
void setDebug(short level);
void getDebug(short& level) const;
void setApplyPolicy(ApplyPolicy policy);
void getApplyPolicy(ApplyPolicy &policy) const;
......@@ -104,7 +104,6 @@ namespace lima {
CtAcquisition *m_ct_acq;
CtImage *m_ct_image;
CtBuffer *m_ct_buffer;
CtDebug *m_ct_debug;
SoftOpInternalMgr *m_op_int;
SoftOpExternalMgr *m_op_ext;
......@@ -119,7 +118,18 @@ namespace lima {
bool m_ready;
bool m_autosave;
};
inline std::ostream& operator<<(std::ostream &os,
const CtControl::ImageStatus &status)
{
os << "<"
<< "LastImageAcquired=" << status.LastImageAcquired << ", "
<< "LastBaseImageReady=" << status.LastBaseImageReady << ", "
<< "LastImageReady=" << status.LastImageReady << ", "
<< "LastImageSaved=" << status.LastImageSaved << ", "
<< "LastCounterReady=" << status.LastCounterReady
<< ">";
return os;
}
} // namespace lima
#endif // CTCONTROL_H
#ifndef CTDEBUG_H
#define CTDEBUG_H
#include <string>
#include <iostream>
namespace lima {
class CtDebug {
public:
CtDebug(std::string class_name);
~CtDebug();
void setLevel(short level) { m_level= level; }
void getLevel(short& level) const { level= m_level; }
inline void trace(std::string func_name, std::string message)
{ print(0x01, func_name, "INFO", message); }
inline void warning(std::string func_name, std::string message)
{ print(0x02, func_name, "WARNING", message); }
inline void error(std::string func_name, std::string message)
{ print(0x04, func_name, "ERROR", message); }
private:
void print(short level, std::string func_name, std::string type, std::string message);
std::string m_class_name;
short m_level;
};
} // namespace lima
#endif // CTDEBUG_H
......@@ -8,138 +8,152 @@
namespace lima {
class CtImage;
class CtSwBinRoi {
public:
CtSwBinRoi(Size& size);
void setMaxSize(Size& size);
void setBin(const Bin& bin);
void setRoi(const Roi& roi);
void resetBin();
void resetRoi();
void reset();
const Bin& getBin() const { return m_bin; }
const Roi& getRoi() const { return m_roi; }
const Size& getSize();
bool apply(SoftOpInternalMgr *op);
private:
Size m_max_size, m_size;
Bin m_bin;
Roi m_roi, m_max_roi;
};
class CtHwBinRoi {
public:
CtHwBinRoi(HwInterface *hw, CtSwBinRoi *sw_bin_roi, Size& size);
~CtHwBinRoi();
bool hasBinCapability() { return m_has_bin; }
bool hasRoiCapability() { return m_has_roi; }
void setMaxSize(const Size& size);
void setBin(Bin& bin, bool round);
void setRoi(Roi& roi, bool round);
void resetBin();
void resetRoi();
void reset();
const Bin& getBin() const { return m_bin; }
const Roi& getRoi() const { return m_roi; }
const Size& getSize() const { return m_size; }
void apply();
private:
void _updateSize();
HwBinCtrlObj *m_hw_bin;
HwRoiCtrlObj *m_hw_roi;
CtSwBinRoi *m_sw_bin_roi;
bool m_has_bin, m_has_roi;
Size m_max_size, m_size;
Bin m_bin;
Roi m_roi, m_max_roi;
};
/* -- link probleme with this one !?
class CtMaxImageSizeCB : public HwMaxImageSizeCallback
{
public:
CtMaxImageSizeCB(CtImage *ct) : m_ct(ct) {}
protected:
void maxImageSizeChanged(const Size& size, ImageType image_type);
private:
CtImage *m_ct;
};
*/
class CtImage;
class CtSwBinRoi {
DEB_CLASS_NAMESPC(DebModControl,"Sofware BinRoi","Control");
public:
friend std::ostream& operator<<(std::ostream &os,const CtSwBinRoi &binroi);
CtSwBinRoi(Size& size);
void setMaxSize(Size& size);
void setBin(const Bin& bin);
void setRoi(const Roi& roi);
void resetBin();
void resetRoi();
void reset();
const Bin& getBin() const { return m_bin; }
const Roi& getRoi() const { return m_roi; }
const Size& getSize();
bool apply(SoftOpInternalMgr *op);
private:
Size m_max_size, m_size;
Bin m_bin;
Roi m_roi, m_max_roi;
};
class CtHwBinRoi {
DEB_CLASS_NAMESPC(DebModControl,"Hardware BinRoi","Control");
public:
CtHwBinRoi(HwInterface *hw, CtSwBinRoi *sw_bin_roi, Size& size);
~CtHwBinRoi();
bool hasBinCapability() { return m_has_bin; }
bool hasRoiCapability() { return m_has_roi; }
void setMaxSize(const Size& size);
void setBin(Bin& bin, bool round);
void setRoi(Roi& roi, bool round);
void resetBin();
void resetRoi();
void reset();
const Bin& getBin() const { return m_bin; }
const Roi& getRoi() const { return m_roi; }
const Size& getSize() const { return m_size; }
void apply();
private:
void _updateSize();
HwBinCtrlObj *m_hw_bin;
HwRoiCtrlObj *m_hw_roi;
CtSwBinRoi *m_sw_bin_roi;
bool m_has_bin, m_has_roi;
Size m_max_size, m_size;
Bin m_bin;
Roi m_roi, m_max_roi;
};
/* -- link probleme with this one !?
class CtMaxImageSizeCB : public HwMaxImageSizeCallback
{
public:
CtMaxImageSizeCB(CtImage *ct) : m_ct(ct) {}
protected:
void maxImageSizeChanged(const Size& size, ImageType image_type);
private:
CtImage *m_ct;
};
*/
class CtImage {
class CtImage {
DEB_CLASS_NAMESPC(DebModControl,"Image","Control");
public:
friend class CtMaxImageSizeCB;
enum ImageOpMode {
HardOnly,
SoftOnly,
HardAndSoft,
};
public:
friend class CtMaxImageSizeCB;
CtImage(HwInterface *hw);
~CtImage();
enum ImageOpMode {
HardOnly,
SoftOnly,
HardAndSoft,
};
void getMaxImageSize(Size& size) const;
void setMaxImage(const Size &size, ImageType type);
CtImage(HwInterface *hw);
~CtImage();
void getImageType(ImageType& type) const;
void getHwImageDim(FrameDim& dim) const;
void getImageDim(FrameDim& dim) const;
void getMaxImageSize(Size& size) const;
void setMaxImage(const Size &size, ImageType type);
// --- soft
void getSoft(CtSwBinRoi *& soft) const;
void getHard(CtHwBinRoi *& hard) const;
void getImageType(ImageType& type) const;
void getHwImageDim(FrameDim& dim) const;
void getImageDim(FrameDim& dim) const;
// --- wizard
void setMode(ImageOpMode mode);
void getMode(ImageOpMode& mode) const;
// --- soft
void getSoft(CtSwBinRoi *& soft) const;
void getHard(CtHwBinRoi *& hard) const;
void setRoi(Roi& roi);
void setBin(Bin& bin);
// --- wizard
void setMode(ImageOpMode mode);
void getMode(ImageOpMode& mode) const;
void setRoi(Roi& roi);
void setBin(Bin& bin);
void resetRoi();
void resetBin();
void resetRoi();
void resetBin();
// --- effective
void getRoi(Roi& roi) const;
void getBin(Bin& bin) const;
void reset();
void applyHard();
bool applySoft(SoftOpInternalMgr *op);
private:
void _setHSRoi(const Roi &roi);
void _setHSBin(const Bin &bin);
HwDetInfoCtrlObj *m_hw_det;
// HwFlipCtrlObj *m_hw_flip;
// CtMaxImageSizeCB *m_cb_size;
CtSwBinRoi *m_sw;
CtHwBinRoi *m_hw;
Size m_max_size;
ImageType m_img_type;
ImageOpMode m_mode;
};
// --- effective
void getRoi(Roi& roi) const;
void getBin(Bin& bin) const;
void reset();
void applyHard();
bool applySoft(SoftOpInternalMgr *op);
private:
void _setHSRoi(const Roi &roi);
void _setHSBin(const Bin &bin);
HwDetInfoCtrlObj *m_hw_det;
// HwFlipCtrlObj *m_hw_flip;
// CtMaxImageSizeCB *m_cb_size;
CtSwBinRoi *m_sw;
CtHwBinRoi *m_hw;
Size m_max_size;
ImageType m_img_type;
ImageOpMode m_mode;
};
inline std::ostream& operator<<(std::ostream &os,const CtSwBinRoi &binroi)
{
os << "<"
<< "m_max_size=" << binroi.m_max_size << ", "
<< "m_size=" << binroi.m_size << ", "
<< "m_bin=" << binroi.m_bin << ", "
<< "m_roi=" << binroi.m_roi << ", "
<< "m_max_roi=" << binroi.m_max_roi
<< ">";
return os;
}
} // namespace lima
#endif // CTIMAGE_H
......@@ -14,31 +14,41 @@ class TaskEventCallback;
namespace lima {
class CtSaving {
class CtSaving
{
DEB_CLASS_NAMESPC(DebModControl,"Saving","Control");
friend class CtControl;
public:
CtSaving(CtControl&);
~CtSaving();
enum FileFormat {
RAW,
EDF,
};
enum SavingMode {
Manual,
AutoFrame,
AutoHeader,
};
enum FileFormat
{
RAW,
EDF,
};
enum SavingMode
{
Manual,
AutoFrame,
AutoHeader,
};
enum OverwritePolicy {
Abort,
Overwrite,
Append,
};
struct Parameters {
enum OverwritePolicy
{
Abort,
Overwrite,
Append,
};
struct Parameters
{
DEB_CLASS_NAMESPC(DebModControl,"Saving parameters",
"Control");
public:
std::string directory;
std::string prefix;
std::string suffix;
......@@ -143,8 +153,35 @@ namespace lima {
void _takeHeader(std::map<long,HeaderMap>::iterator&, HeaderMap& header);
void _post_save_task(Data&,_SaveTask*);
void _save_finished(Data&);
};
};
inline std::ostream& operator<<(std::ostream &os,const CtSaving::Parameters &params)
{
os << "<"
<< "directory=" << params.directory << ", "
<< "prefix=" << params.prefix << ", "
<< "suffix=" << params.suffix << ", "
<< "nextNumber=" << params.nextNumber << ", "
<< "fileFormat=" << params.fileFormat << ", "
<< "savingMode=" << params.savingMode << ", "
<< "overwritePolicy=" << params.overwritePolicy << ", "
<< "framesPerFile=" << params.framesPerFile
<< ">";
return os;
}
inline std::ostream& operator<<(std::ostream &os,const CtSaving::HeaderMap &header)
{
os << "< ";
for(CtSaving::HeaderMap::const_iterator i = header.begin();
i != header.end();++i)
os << "(" << i->first << "," << i->second << ") ";
os << ">";
return os;
}
inline std::ostream& operator<<(std::ostream &os,const CtSaving::HeaderValue &value)
{
os << "< (" << value.first << "," << value.second << ") >";
return os;
}
} // namespace lima
#endif // CTSAVING_H
......@@ -34,9 +34,6 @@ using namespace lima;
CtImage* image();
CtBuffer* buffer();
void setDebug(short level);
void getDebug(short& level /Out/) const;
void setApplyPolicy(ApplyPolicy policy);
void getApplyPolicy(ApplyPolicy &policy /Out/) const;
......
......@@ -4,6 +4,9 @@ using namespace lima;
bool CtBufferFrameCB::newFrameReady(const HwFrameInfoType& frame_info)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(frame_info);