diff --git a/applications/tango/python b/applications/tango/python index b3dd3b88f..00f2b4718 160000 --- a/applications/tango/python +++ b/applications/tango/python @@ -1 +1 @@ -Subproject commit b3dd3b88f20e6e50d1623b5f9492e13940918768 +Subproject commit 00f2b47187546c371a76dc48d7b13de9fab48a1a diff --git a/common/include/lima/OrderedMap.h b/common/include/lima/OrderedMap.h index 5ffa5a367..f5e42f6ed 100644 --- a/common/include/lima/OrderedMap.h +++ b/common/include/lima/OrderedMap.h @@ -27,6 +27,7 @@ #include #include #include +#include namespace lima { diff --git a/control/software_operation/include/lima/SoftOpId.h b/control/software_operation/include/lima/SoftOpId.h index f73839bfe..b662baeb3 100644 --- a/control/software_operation/include/lima/SoftOpId.h +++ b/control/software_operation/include/lima/SoftOpId.h @@ -379,19 +379,6 @@ namespace lima SoftOpRoiCounter(); virtual ~SoftOpRoiCounter(); -#ifdef USE_DEPRECATED - /** Old way to manage roi's counters - * they are now deprecated, - * please use the new set of methods. - * will be removed in version 2. - */ - void add(const std::list &rois); - void set(const std::list &rois); - void get(std::list&) const; - void del(const std::list &roiIds); - void readCounters(int from,std::list &result) const; -#endif - /** New methods set */ void updateRois(const std::list&); void updateArcRois(const std::list&); @@ -411,7 +398,6 @@ namespace lima void removeRois(const std::list& names); void clearAllRois(); /* clear all roi */ - /** end of new set */ void clearCounterStatus(); int getCounterStatus() const; @@ -422,6 +408,9 @@ namespace lima void getBufferSize(int &size) const; /*override*/ bool isActive() const { return !m_task_manager.empty(); } + + void getOverflowThreshold(unsigned long long& threshold); + void setOverflowThreshold(unsigned long long threshold); protected: virtual bool addTo(TaskMgr&,int stage); @@ -445,6 +434,7 @@ namespace lima int m_history_size; Data m_mask; mutable Cond m_cond; + unsigned long long m_overflow_threshold; }; template @@ -479,85 +469,6 @@ namespace lima roi = ArcRoi(x,y,r1,r2,a1,a2); } -#ifdef USE_DEPRECATED -#define ROI_WARNING -#ifdef WIN32 -#pragma message ("deprecated use new methods set") -#else -#warning deprecated use new methods set -#endif - inline void SoftOpRoiCounter::add(const std::list &rois) - { - ROI_WARNING; - int nb_rois = m_task_manager.size(); - std::list local_rois; - std::list::const_iterator i, end = rois.end(); - for (i = rois.begin(); i != end; ++i, ++nb_rois) - { - RoiNameAndRoi roiname_roi(m_task_manager.getCompatName(nb_rois), *i); - local_rois.push_back(roiname_roi); - } - updateRois(local_rois); - } - inline void SoftOpRoiCounter::set(const std::list &rois) - { - clearAllRois(); - add(rois); - } - inline void SoftOpRoiCounter::get(std::list &rois) const - { - ROI_WARNING; - DEB_MEMBER_FUNCT(); - AutoMutex aLock(m_cond.mutex()); - - std::list names_rois; - getRois(names_rois); - if (int(names_rois.size()) != int(m_task_manager.size())) - THROW_CTL_ERROR(InvalidValue) << "You can't mixed old and new methods set"; - - std::vector v_rois; - v_rois.resize(names_rois.size()); - for(std::list::iterator i = names_rois.begin(); - i != names_rois.end(); ++i) - { - int roi_id; - if(!m_task_manager.getCompatId(i->first, roi_id)) - THROW_CTL_ERROR(InvalidValue) << "You can't mixed old and new methods set"; - v_rois[roi_id] = i->second; - } - for(std::vector::iterator i = v_rois.begin(); - i != v_rois.end();++i) - rois.push_back(*i); - } - inline void SoftOpRoiCounter::del(const std::list &roiIds) - { - ROI_WARNING; - AutoMutex aLock(m_cond.mutex()); - std::list rois_names; - for(std::list::const_iterator i = roiIds.begin(); - i != roiIds.end();++i) - rois_names.push_back(m_task_manager.getCompatName(*i)); - removeRois(rois_names); - } - inline void SoftOpRoiCounter::readCounters(int from, - std::list &result) const - { - ROI_WARNING; - DEB_MEMBER_FUNCT(); - std::list tmp_result; - readCounters(from,tmp_result); - for(std::list::iterator i = tmp_result.begin(); - i != tmp_result.end();++i) - { - int roi_id; - if(!m_task_manager.getCompatId(i->first, roi_id)) - THROW_CTL_ERROR(InvalidValue) << "You can't mixed old and new methods set"; - result.push_back(RoiIdAndResults(roi_id,i->second)); - } - } -#endif - - class LIMACORE_API SoftOpRoi2Spectrum : public SoftOpBaseClass { DEB_CLASS_NAMESPC(DebModControl,"SoftwareOperation","SoftOpRoi2Spectrum"); @@ -573,22 +484,6 @@ namespace lima SoftOpRoi2Spectrum(); virtual ~SoftOpRoi2Spectrum(); -#ifdef USE_DEPRECATED - /** Old way to manage roi2spectrum counters - * they are now deprecated, - * please use the new set of methods. - * will be removed in version 2. - */ - void add(const std::list &rois); - void set(const std::list &rois); - void get(std::list&) const; - void del(const std::list &roiIds); - void readCounters(int from,std::list &result) const; - void createImage(int roiId,int &from,Data &aData) const; - - void getRoiMode(std::list&) const; - void setRoiMode(int roiId,int mode); -#endif /** New methods set */ void updateRois(const std::list&); void getRois(std::list&) const; @@ -635,106 +530,6 @@ namespace lima //Data m_mask; mutable Cond m_cond; }; -#ifdef USE_DEPRECATED - inline void SoftOpRoi2Spectrum::add(const std::list &rois) - { - ROI_WARNING; - int nb_rois = m_task_manager.size(); - std::list local_rois; - for(std::list::const_iterator i = rois.begin(); - i != rois.end();++i,++nb_rois) - { - RoiNameAndRoi roiname_roi(m_task_manager.getCompatName(nb_rois), *i); - local_rois.push_back(roiname_roi); - } - updateRois(local_rois); - } - inline void SoftOpRoi2Spectrum::set(const std::list &rois) - { - clearAllRois(); - add(rois); - } - inline void SoftOpRoi2Spectrum::get(std::list &rois) const - { - ROI_WARNING; - DEB_MEMBER_FUNCT(); - std::vector v_rois; - v_rois.resize(m_task_manager.size()); - for(NameMapConstIterator i = m_task_manager.begin(); - i != m_task_manager.end();++i) - { - int roi_id; - if(!m_task_manager.getCompatId(i->first, roi_id)) - THROW_CTL_ERROR(InvalidValue) << "You can't mixed old and new methods set"; - int x,y,width,height; - i->second.second->getRoi(x,y,width,height); - v_rois[roi_id] = Roi(x,y,width,height); - } - for(std::vector::iterator i = v_rois.begin(); - i != v_rois.end();++i) - rois.push_back(*i); - } - inline void SoftOpRoi2Spectrum::del(const std::list &roiIds) - { - ROI_WARNING; - std::list rois_names; - for(std::list::const_iterator i = roiIds.begin(); - i != roiIds.end();++i) - rois_names.push_back(m_task_manager.getCompatName(*i)); - removeRois(rois_names); - } - inline void SoftOpRoi2Spectrum::readCounters(int from, - std::list &result) const - { - ROI_WARNING; - DEB_MEMBER_FUNCT(); - std::list tmp_result; - readCounters(from,tmp_result); - for(std::list::iterator i = tmp_result.begin(); - i != tmp_result.end();++i) - { - int roi_id; - if(!m_task_manager.getCompatId(i->first, roi_id)) - THROW_CTL_ERROR(InvalidValue) << "You can't mixed old and new methods set"; - result.push_back(RoiIdAndResults(roi_id,i->second)); - } - } - - inline void SoftOpRoi2Spectrum::createImage(int roiId, int& from, - Data& aData) const - { - ROI_WARNING; - createImage(m_task_manager.getCompatName(roiId), from, aData); - } - - inline void SoftOpRoi2Spectrum::getRoiMode(std::list& modes) const - { - ROI_WARNING; - DEB_MEMBER_FUNCT(); - std::vector v_modes; - v_modes.resize(m_task_manager.size()); - for(NameMapConstIterator i = m_task_manager.begin(); - i != m_task_manager.end();++i) - { - int roi_id; - if(!m_task_manager.getCompatId(i->first, roi_id)) - THROW_CTL_ERROR(InvalidValue) << "You can't mixed old and new methods set"; - v_modes.push_back(i->second.second->getMode()); - } - for(std::vector::iterator i = v_modes.begin(); - i != v_modes.end();++i) - modes.push_back(*i); - } - - inline void SoftOpRoi2Spectrum::setRoiMode(int roiId, int mode) - { - ROI_WARNING; - RoiNameAndMode name_mode(m_task_manager.getCompatName(roiId), mode); - std::list rois_modes(&name_mode, &name_mode + 1); - setRoiModes(rois_modes); - } -#endif - class LIMACORE_API SoftOpSoftRoi : public SoftOpBaseClass { diff --git a/control/software_operation/sip/SoftOpId.sip b/control/software_operation/sip/SoftOpId.sip index 243e4e222..9f59f5ae5 100644 --- a/control/software_operation/sip/SoftOpId.sip +++ b/control/software_operation/sip/SoftOpId.sip @@ -1000,6 +1000,9 @@ using namespace lima; void setBufferSize(int size); void getBufferSize(int &size /Out/) const; + + void getOverflowThreshold(unsigned long long& threshold /Out/); + void setOverflowThreshold(unsigned long long threshold); }; class SoftOpRoi2Spectrum diff --git a/control/software_operation/src/SoftOpId.cpp b/control/software_operation/src/SoftOpId.cpp index e5abb3e91..c8ce300e7 100644 --- a/control/software_operation/src/SoftOpId.cpp +++ b/control/software_operation/src/SoftOpId.cpp @@ -236,7 +236,8 @@ bool SoftOpMask::addTo(TaskMgr &aMgr,int stage) SoftOpRoiCounter::SoftOpRoiCounter() : SoftOpBaseClass(), - m_history_size(DEFAULT_HISTORY_SIZE) + m_history_size(DEFAULT_HISTORY_SIZE), + m_overflow_threshold(0) { m_task_manager.setCompatFormat("roi_%d"); } @@ -433,6 +434,20 @@ void SoftOpRoiCounter::_get_or_create(const std::string& roi_name, aCounterTaskPt = i->second.second; } } + +void SoftOpRoiCounter::getOverflowThreshold(unsigned long long& threshold) +{ + threshold = m_overflow_threshold; +} + +void SoftOpRoiCounter::setOverflowThreshold(unsigned long long threshold) +{ + AutoMutex aLock(m_cond.mutex()); + for(auto &i : m_task_manager) + i.second.first->setOverflowThreshold(threshold); + + m_overflow_threshold = threshold; +} //-------------------- ROI TO SPECTRUM -------------------- SoftOpRoi2Spectrum::SoftOpRoi2Spectrum() : diff --git a/third-party/Processlib b/third-party/Processlib index a8bf8431a..db6741275 160000 --- a/third-party/Processlib +++ b/third-party/Processlib @@ -1 +1 @@ -Subproject commit a8bf8431a026cc2c3a37dfb64fc4e1725655026e +Subproject commit db6741275cab63603d9c0f6008a44055511a5733