/** Add peaks presenter @param presenter : Subject peaks presenter */ void CompositePeaksPresenter::addPeaksPresenter(PeaksPresenter_sptr presenter) { if (this->size() == 10) { throw std::invalid_argument("Maximum number of PeaksWorkspaces that can be " "simultaneously displayed is 10."); } // Look for the same presenter added twice. auto result_it = std::find(m_subjects.begin(), m_subjects.end(), presenter); // Only add a peaks presenter if the contents are different. The presenter may // be different, but manage the same workspace set. if (result_it == m_subjects.end() && presenter->contentsDifferent(this)) { m_subjects.push_back(presenter); presenter->registerOwningPresenter(this); } }
/** Add peaks presenter @param presenter : Subject peaks presenter */ void CompositePeaksPresenter::addPeaksPresenter(PeaksPresenter_sptr presenter) { if(this->size() == 10) { throw std::invalid_argument("Maximum number of PeaksWorkspaces that can be simultaneously displayed is 10."); } auto result_it = std::find(m_subjects.begin(), m_subjects.end(), presenter); if(result_it == m_subjects.end()) { m_subjects.push_back(presenter); presenter->registerOwningPresenter(this); } }