Alexandria  2.14.1
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 Photometry::PhotometryConstIterator::PhotometryConstIterator(
34  const std::vector<string>::const_iterator& filters_iter,
36  : m_filters_iter{filters_iter}, m_values_iter{values_iter} { }
37 
39  ++m_filters_iter;
40  ++m_values_iter;
41  return *this;
42 }
43 
45  return *m_values_iter;
46 }
47 
49  return m_filters_iter == other.m_filters_iter;
50 }
51 
53  return m_filters_iter != other.m_filters_iter;
54 }
55 
57  return *m_filters_iter;
58 }
59 
60 //-----------------------------------------------------------------------------
61 // find the value and error in the map for a specific filter name
62 // return a ptr to a ValuePair(value, error) and null pointer otherwise
64 {
65 
66  unique_ptr<FluxErrorPair> flux_found_ptr {};
67  auto filter_iter = m_filter_name_vector_ptr->begin();
68  auto photometry_iter = m_value_vector.begin();
69  while (filter_iter != m_filter_name_vector_ptr->end()) {
70  if (*filter_iter == filter_name) {
71  break;
72  }
73  ++filter_iter;
74  ++photometry_iter;
75  }
76  if (filter_iter != m_filter_name_vector_ptr->end()) {
77  flux_found_ptr = unique_ptr<FluxErrorPair>{new FluxErrorPair{*photometry_iter} };
78  }
79 
80  return flux_found_ptr;
81 } // Eof Photometry::find
82 
83 
84 } // namespace SourceCatalog
85 } // end of namespace Euclid
bool operator!=(const PhotometryConstIterator &other) const
Definition: Photometry.cpp:52
bool operator==(const PhotometryConstIterator &other) const
Definition: Photometry.cpp:48
std::vector< std::string >::const_iterator m_filters_iter
Definition: Photometry.h:86
std::unique_ptr< FluxErrorPair > find(std::string filter_name) const
Return a photometry measurement through the specified filter. The current implementation of this meth...
Definition: Photometry.cpp:63
STL class.
STL class.
std::shared_ptr< std::vector< std::string > > m_filter_name_vector_ptr
Shared pointer to the common list of filter names.
Definition: Photometry.h:152
std::vector< FluxErrorPair > m_value_vector
The photometry map.
Definition: Photometry.h:155