Alexandria  2.16
Please provide a description of the project.
Photometry.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
27 
28 using namespace std;
29 
30 namespace Euclid {
31 namespace SourceCatalog {
32 
33 //-----------------------------------------------------------------------------
34 // find the value and error in the map for a specific filter name
35 // return a ptr to a ValuePair(value, error) and null pointer otherwise
36 unique_ptr<FluxErrorPair> Photometry::find(string filter_name) const
37 {
38 
39  unique_ptr<FluxErrorPair> flux_found_ptr {};
40  auto filter_iter = m_filter_name_vector_ptr->begin();
41  auto photometry_iter = m_value_vector.begin();
42  while (filter_iter != m_filter_name_vector_ptr->end()) {
43  if (*filter_iter == filter_name) {
44  break;
45  }
46  ++filter_iter;
47  ++photometry_iter;
48  }
49  if (filter_iter != m_filter_name_vector_ptr->end()) {
50  flux_found_ptr = unique_ptr<FluxErrorPair>{new FluxErrorPair{*photometry_iter} };
51  }
52 
53  return flux_found_ptr;
54 } // Eof Photometry::find
55 
56 const std::shared_ptr<std::vector<std::string>>& Photometry::getFilterNames() const {
57  return m_filter_name_vector_ptr;
58 }
59 
60 } // namespace SourceCatalog
61 } // end of namespace Euclid
STL namespace.
STL class.