LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Results.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
3 /*
4  * LSST Data Management System
5  * Copyright 2008, 2009, 2010 LSST Corporation.
6  *
7  * This product includes software developed by the
8  * LSST Project (http://www.lsst.org/).
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the LSST License Statement and
21  * the GNU General Public License along with this program. If not,
22  * see <http://www.lsstcorp.org/LegalNotices/>.
23  */
24 
25 
33 #ifndef LSST_AP_RESULTS_H
34 #define LSST_AP_RESULTS_H
35 
36 #include <utility>
37 #include <vector>
38 
39 #include "boost/shared_ptr.hpp"
40 
41 #include "lsst/daf/base/Citizen.h"
43 
44 #include "Common.h"
45 
46 
48 namespace boost { namespace serialization {
49  class access;
50 }}
52 
53 
54 namespace lsst { namespace ap {
55 
56 namespace io {
57  // forward declarations for formatters
58  class MatchPairVectorFormatter;
59  class IdPairVectorFormatter;
60  class IdVectorFormatter;
61 }
62 
63 
65 class MatchPair {
66 
67 public :
68 
69  MatchPair() : _first(-1), _second(-1), _distance(0.0) {}
70 
71  MatchPair(boost::int64_t const first, boost::int64_t const second, double const distance) :
72  _first(first), _second(second), _distance(distance) {}
73 
74  boost::int64_t getFirst() const {
75  return _first;
76  }
77  boost::int64_t getSecond() const {
78  return _second;
79  }
80  double getDistance() const {
81  return _distance;
82  }
83 
84  void setFirst(boost::int64_t const first) {
85  _first = first;
86  }
87  void setSecond(boost::int64_t const second) {
88  _second = second;
89  }
90  void setDistance(double const distance) {
91  _distance = distance;
92  }
93 
94  bool operator==(MatchPair const & mp) const {
95  return _first == mp.getFirst() && _second == mp.getSecond();
96  }
97 
98  bool operator!=(MatchPair const & mp) const {
99  return !operator==(mp);
100  }
101 
102 private :
103 
104  boost::int64_t _first;
105  boost::int64_t _second;
106  double _distance;
107 
108  template <typename Archive>
109  void serialize(Archive & ar, unsigned int const version) {
110  ar & _first;
111  ar & _second;
112  ar & _distance;
113  }
114 
117 };
118 
119 
121 typedef std::pair<boost::int64_t, boost::int64_t> IdPair;
123 typedef std::vector<MatchPair> MatchPairVector;
125 typedef std::vector<IdPair> IdPairVector;
127 typedef std::vector<boost::int64_t> IdVector;
128 
129 
134 {
135 public :
136  typedef boost::shared_ptr<PersistableMatchPairVector> Ptr;
137 
141 
143  return _matchPairs;
144  }
145  MatchPairVector const & getMatchPairs() const {
146  return _matchPairs;
147  }
148  void setMatchPairs(MatchPairVector const & matchPairs) {
149  _matchPairs = matchPairs;
150  }
151 
152  bool operator==(MatchPairVector const & other) const;
153  bool operator==(PersistableMatchPairVector const & other) const {
154  return other == _matchPairs;
155  }
156 
157 private:
160 };
161 
162 
167 {
168 public :
169  typedef boost::shared_ptr<PersistableIdPairVector> Ptr;
170 
172  explicit PersistableIdPairVector(IdPairVector const &);
174 
176  return _idPairs;
177  }
178  IdPairVector const & getIdPairs() const {
179  return _idPairs;
180  }
181  void setIdPairs(IdPairVector const & idPairs) {
182  _idPairs = idPairs;
183  }
184 
185  bool operator==(IdPairVector const & other) const;
186  bool operator==(PersistableIdPairVector const & other) const {
187  return other == _idPairs;
188  }
189 
190 private:
193 };
194 
195 
200 {
201 public :
202  typedef boost::shared_ptr<PersistableIdVector> Ptr;
203 
205  explicit PersistableIdVector(IdVector const &);
207 
209  return _ids;
210  }
211  IdVector const & getIds() const {
212  return _ids;
213  }
214  void setIds(IdVector const & ids) {
215  _ids = ids;
216  }
217 
218  bool operator==(IdVector const & other) const;
219  bool operator==(PersistableIdVector const & other) const {
220  return other == _ids;
221  }
222 
223 private:
226 };
227 
228 
229 }} // end of namespace lsst::ap
230 
231 #endif // LSST_AP_RESULTS_H
232 
Formatter for IdPairVector instances.
Holds a pair of ids and the distance between the corresponding positions on the unit sphere...
Definition: Results.h:65
bool operator!=(MatchPair const &mp) const
Definition: Results.h:98
std::vector< boost::int64_t > IdVector
A list of integer ids.
Definition: Results.h:127
boost::int64_t getSecond() const
Definition: Results.h:77
void setFirst(boost::int64_t const first)
Definition: Results.h:84
IdVector const & getIds() const
Definition: Results.h:211
bool operator==(MatchPair const &mp) const
Definition: Results.h:94
boost::int64_t getFirst() const
Definition: Results.h:74
void setIds(IdVector const &ids)
Definition: Results.h:214
void serialize(Archive &ar, unsigned int const version)
Definition: Results.h:109
std::vector< MatchPair > MatchPairVector
A list of MatchPair instances.
Definition: Results.h:123
A persistable wrapper for a MatchPairVector.
Definition: Results.h:131
A persistable wrapper for an IdPairVector.
Definition: Results.h:164
LSST_PERSIST_FORMATTER(lsst::ap::io::IdVectorFormatter)
bool operator==(IdPairVector const &other) const
Definition: Results.cc:76
boost::shared_ptr< PersistableIdVector > Ptr
Definition: Results.h:202
bool operator==(PersistableMatchPairVector const &other) const
Definition: Results.h:153
void setSecond(boost::int64_t const second)
Definition: Results.h:87
LSST_PERSIST_FORMATTER(lsst::ap::io::MatchPairVectorFormatter)
bool operator==(PersistableIdPairVector const &other) const
Definition: Results.h:186
MatchPair(boost::int64_t const first, boost::int64_t const second, double const distance)
Definition: Results.h:71
bool operator==(IdVector const &other) const
Definition: Results.cc:100
std::pair< boost::int64_t, boost::int64_t > IdPair
Holds a pair of ids.
Definition: Results.h:121
boost::int64_t _second
Definition: Results.h:105
std::vector< IdPair > IdPairVector
A list of IdPair instances.
Definition: Results.h:125
IdPairVector const & getIdPairs() const
Definition: Results.h:178
IdPairVector & getIdPairs()
Definition: Results.h:175
friend class boost::serialization::access
Definition: Results.h:115
bool operator==(MatchPairVector const &other) const
Definition: Results.cc:52
void setDistance(double const distance)
Definition: Results.h:90
Master header file for the association pipeline.
LSST_PERSIST_FORMATTER(lsst::ap::io::IdPairVectorFormatter)
Formatter for MatchPairVector instances.
MatchPairVector const & getMatchPairs() const
Definition: Results.h:145
bool operator==(PersistableIdVector const &other) const
Definition: Results.h:219
MatchPairVector & getMatchPairs()
Definition: Results.h:142
Interface for Persistable base class.
boost::int64_t _first
Definition: Results.h:104
Base class for all persistable classes.
Definition: Persistable.h:74
boost::shared_ptr< PersistableMatchPairVector > Ptr
Definition: Results.h:136
Formatter for IdVector instances.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
Definition: Citizen.h:56
A persistable wrapper for an IdVector.
Definition: Results.h:197
void setMatchPairs(MatchPairVector const &matchPairs)
Definition: Results.h:148
void setIdPairs(IdPairVector const &idPairs)
Definition: Results.h:181
double getDistance() const
Definition: Results.h:80
boost::shared_ptr< PersistableIdPairVector > Ptr
Definition: Results.h:169