Skip to content
Snippets Groups Projects
Commit c1e3e528 authored by Langella Olivier's avatar Langella Olivier
Browse files

simplify MsRun store

parent fd6163c2
No related branches found
No related tags found
No related merge requests found
......@@ -46,10 +46,10 @@ XicWindow::XicWindow(ProjectWindow *parent):
ui->xic_precision->setPrecision(pappso::Precision::fromString(precision_str));
_detect_zivy.setSmoothingHalfEdgeWindows(settings.value("xic/zivy_smoothing", "1").toInt());
_detect_zivy.setMinMaxHalfEdgeWindows(settings.value("xic/zivy_minmax_half_window", "3").toInt());
_detect_zivy.setMinMaxHalfEdgeWindows(settings.value("xic/zivy_minmax_half_window", "4").toInt());
_detect_zivy.setMaxMinHalfEdgeWindows(settings.value("xic/zivy_maxmin_half_window", "2").toInt());
_detect_zivy.setDetectionThresholdOnMinmax(settings.value("xic/zivy_minmax_threshold", "5000").toDouble());
_detect_zivy.setDetectionThresholdOnMaxmin(settings.value("xic/zivy_maxmin_threshold", "3000").toDouble());
_detect_zivy.setDetectionThresholdOnMinmax(settings.value("xic/zivy_minmax_threshold", "50000").toDouble());
_detect_zivy.setDetectionThresholdOnMaxmin(settings.value("xic/zivy_maxmin_threshold", "30000").toDouble());
#if QT_VERSION >= 0x050000
......
......@@ -43,25 +43,25 @@ MsRunStore::~MsRunStore()
}
MsRunSp MsRunStore::getInstance(const MsRun * p_msrun) {
MsRunSp p_xtfile;
for (auto & msrun_pair :_map_msrun) {
if (msrun_pair.second.get() == p_msrun) {
return msrun_pair.second;
}
auto it = std::find_if(_map_msrun.begin(), _map_msrun.end(), [p_msrun] (const MsRunSp & msrun_sp) {return msrun_sp.get()== p_msrun;});
if (it != _map_msrun.end()) {
return (*it);
}
MsRunSp p_xtfile;
return p_xtfile;
}
MsRunSp MsRunStore::getInstance(const QString & location) {
std::map< QString, MsRunSp >::iterator it = _map_msrun.find(location);
auto it = std::find_if(_map_msrun.begin(), _map_msrun.end(), [location] (const MsRunSp & msrun_sp) {return msrun_sp.get()->getFilename()==location;});
if (it != _map_msrun.end()) {
return it->second;
return *it;
}
else {
MsRunSp p_xtfile = std::make_shared<MsRun>(location);
p_xtfile.get()->setXmlId(QString("samp%1").arg(pappso::Utils::getLexicalOrderedString(_map_msrun.size())));
_map_msrun.insert(std::pair< QString, MsRunSp >(location, p_xtfile));
p_xtfile.get()->setXmlId(QString("msrun%1").arg(pappso::Utils::getLexicalOrderedString(_map_msrun.size()+1)));
p_xtfile.get()->setFilename(location);
_map_msrun.push_back( p_xtfile);
return p_xtfile;
}
......@@ -69,10 +69,10 @@ MsRunSp MsRunStore::getInstance(const QString & location) {
}
std::vector<MsRunSp> MsRunStore::getMsRunList() const {
std::vector<MsRunSp> msrun_list;
for (auto & msrun_pair :_map_msrun) {
msrun_list.push_back(msrun_pair.second);
}
return msrun_list;
const std::vector<MsRunSp> & MsRunStore::getMsRunList() const {
//std::vector<MsRunSp> msrun_list;
// for (auto & msrun_pair :_map_msrun) {
// msrun_list.push_back(msrun_pair.second);
// }
return _map_msrun;
}
......@@ -45,9 +45,9 @@ public:
MsRunSp getInstance(const QString & location);
MsRunSp getInstance(const MsRun * p_msrun);
std::vector<MsRunSp> getMsRunList() const;
const std::vector<MsRunSp> & getMsRunList() const;
private:
std::map<QString, MsRunSp> _map_msrun;
std::vector<MsRunSp> _map_msrun;
};
#endif // MSRUNSTORE_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment