Alexandria
2.14.1
Please provide a description of the project.
SourceCatalog
src
lib
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
26
#include "
SourceCatalog/SourceAttributes/Photometry.h
"
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,
35
const
std::vector<FluxErrorPair>::const_iterator
& values_iter)
36
: m_filters_iter{filters_iter}, m_values_iter{values_iter} { }
37
38
auto
Photometry::PhotometryConstIterator::operator ++
() ->
const_iterator
& {
39
++m_filters_iter;
40
++m_values_iter;
41
return
*
this
;
42
}
43
44
auto
Photometry::PhotometryConstIterator::operator *
() -> reference {
45
return
*m_values_iter;
46
}
47
48
bool
Photometry::PhotometryConstIterator::operator ==
(
const
const_iterator
& other)
const
{
49
return
m_filters_iter == other.
m_filters_iter
;
50
}
51
52
bool
Photometry::PhotometryConstIterator::operator !=
(
const
const_iterator
& other)
const
{
53
return
m_filters_iter != other.
m_filters_iter
;
54
}
55
56
const
string
&
Photometry::PhotometryConstIterator::filterName
()
const
{
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
63
unique_ptr<FluxErrorPair>
Photometry::find
(
string
filter_name)
const
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
Euclid::SourceCatalog::Photometry::m_filter_name_vector_ptr
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
STL class.
Euclid::SourceCatalog::FluxErrorPair
Definition:
Photometry.h:41
Euclid::SourceCatalog::Photometry::PhotometryConstIterator
Definition:
Photometry.h:75
Photometry.h
Euclid::SourceCatalog::Photometry::find
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
Euclid::SourceCatalog::Photometry::PhotometryConstIterator::m_filters_iter
std::vector< std::string >::const_iterator m_filters_iter
Definition:
Photometry.h:86
Euclid::SourceCatalog::Photometry::PhotometryConstIterator::operator!=
bool operator!=(const PhotometryConstIterator &other) const
Definition:
Photometry.cpp:52
Euclid::SourceCatalog::Photometry::m_value_vector
std::vector< FluxErrorPair > m_value_vector
The photometry map.
Definition:
Photometry.h:155
Euclid::SourceCatalog::Photometry::PhotometryConstIterator::filterName
const std::string & filterName() const
Definition:
Photometry.cpp:56
Euclid::SourceCatalog::Photometry::PhotometryConstIterator::operator==
bool operator==(const PhotometryConstIterator &other) const
Definition:
Photometry.cpp:48
Euclid::SourceCatalog::Photometry::PhotometryConstIterator::operator++
PhotometryConstIterator & operator++()
Definition:
Photometry.cpp:38
std::vector::begin
T begin(T... args)
std
STL namespace.
std::vector::end
T end(T... args)
Euclid::SourceCatalog::Photometry::PhotometryConstIterator::operator*
reference operator*()
Definition:
Photometry.cpp:44
std::unique_ptr
STL class.
Euclid
Definition:
InstOrRefHolder.h:29
Generated by
1.8.17