lsst.meas.base  16.0-13-gd9b1b71+3
Transform.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 /*
3  * LSST Data Management System
4  * Copyright 2008-2015 AURA/LSST.
5  *
6  * This product includes software developed by the
7  * LSST Project (http://www.lsst.org/).
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the LSST License Statement and
20  * the GNU General Public License along with this program. If not,
21  * see <http://www.lsstcorp.org/LegalNotices/>.
22  */
23 
24 #ifndef LSST_MEAS_BASE_Transform_h_INCLUDED
25 #define LSST_MEAS_BASE_Transform_h_INCLUDED
26 
32 #include <string>
33 #include "lsst/afw/geom.h"
34 #include "lsst/afw/image.h"
35 #include "lsst/afw/table.h"
36 #include "lsst/pex/exceptions.h"
37 
38 namespace lsst {
39 namespace meas {
40 namespace base {
41 
86 public:
87  explicit BaseTransform(std::string const& name) : _name(name) {}
88  virtual ~BaseTransform() {}
89  virtual void operator()(afw::table::SourceCatalog const& inputCatalog,
90  afw::table::BaseCatalog& outputCatalog, afw::geom::SkyWcs const& wcs,
91  afw::image::Calib const& calib) const = 0;
92 
93 protected:
101  void checkCatalogSize(afw::table::BaseCatalog const& cat1, afw::table::BaseCatalog const& cat2) const {
102  if (cat1.size() != cat2.size()) {
103  throw LSST_EXCEPT(pex::exceptions::LengthError, "Catalog size mismatch");
104  }
105  }
107 };
108 
109 } // namespace base
110 } // namespace meas
111 } // namespace lsst
112 
113 #endif // !LSST_MEAS_BASE_Transform_h_INCLUDED
Key< int > calib
BaseTransform(std::string const &name)
Definition: Transform.h:87
STL class.
table::Key< table::Array< std::uint8_t > > wcs
#define LSST_EXCEPT(type,...)
Abstract base class for all C++ measurement transformations.
Definition: Transform.h:85
size_type size() const
void checkCatalogSize(afw::table::BaseCatalog const &cat1, afw::table::BaseCatalog const &cat2) const
Ensure that catalogs have the same size.
Definition: Transform.h:101
virtual void operator()(afw::table::SourceCatalog const &inputCatalog, afw::table::BaseCatalog &outputCatalog, afw::geom::SkyWcs const &wcs, afw::image::Calib const &calib) const =0