lsst.afw  16.0-9-gdf7162dbc+1
CoaddInputs.cc
Go to the documentation of this file.
1 // -*- LSST-C++ -*- // fixed format comment for emacs
2 /*
3  * LSST Data Management System
4  * Copyright 2008, 2009, 2010 LSST Corporation.
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 
27 
28 namespace lsst {
29 namespace afw {
30 namespace image {
31 
32 namespace {
33 
34 class CoaddInputsFactory : public table::io::PersistableFactory {
35 public:
36  virtual std::shared_ptr<table::io::Persistable> read(InputArchive const& archive,
37  CatalogVector const& catalogs) const {
38  LSST_ARCHIVE_ASSERT(catalogs.size() == 2);
39  std::shared_ptr<CoaddInputs> result = std::make_shared<CoaddInputs>();
40  result->visits = table::ExposureCatalog::readFromArchive(archive, catalogs.front());
41  result->ccds = table::ExposureCatalog::readFromArchive(archive, catalogs.back());
42  return result;
43  }
44 
45  CoaddInputsFactory(std::string const& name) : table::io::PersistableFactory(name) {}
46 };
47 
48 CoaddInputsFactory registration("CoaddInputs");
49 
50 } // namespace
51 
52 CoaddInputs::CoaddInputs() : visits(), ccds() {}
53 
54 CoaddInputs::CoaddInputs(table::Schema const& visitSchema, table::Schema const& ccdSchema)
55  : visits(visitSchema), ccds(ccdSchema) {}
56 
58  : visits(visits_), ccds(ccds_) {}
59 
60 CoaddInputs::CoaddInputs(CoaddInputs const&) = default;
64 CoaddInputs::~CoaddInputs() = default;
65 
66 bool CoaddInputs::isPersistable() const { return true; }
67 
68 std::string CoaddInputs::getPersistenceName() const { return "CoaddInputs"; }
69 
70 std::string CoaddInputs::getPythonModule() const { return "lsst.afw.image"; }
71 
73  visits.writeToArchive(handle, true); // true == permissive - just ignore Psfs, Wcss that can't be saved
74  ccds.writeToArchive(handle, true);
75 }
76 } // namespace image
77 } // namespace afw
78 } // namespace lsst
Defines the fields and offsets for a table.
Definition: Schema.h:48
table::ExposureCatalog visits
Definition: CoaddInputs.h:50
An object passed to Persistable::write to allow it to persist itself.
#define LSST_ARCHIVE_ASSERT(EXPR)
An assertion macro used to validate the structure of an InputArchive.
Definition: Persistable.h:48
CoaddInputs & operator=(CoaddInputs const &)
virtual std::string getPythonModule() const
Return the fully-qualified Python module that should be imported to guarantee that its factory is reg...
Definition: CoaddInputs.cc:70
CoaddInputs()
Default constructor.
Definition: CoaddInputs.cc:52
A simple Persistable struct containing ExposureCatalogs that record the inputs to a coadd...
Definition: CoaddInputs.h:48
STL class.
A base class for image defects.
std::unique_ptr< SchemaItem< U > > result
Definition: Schema.cc:194
virtual void write(OutputArchiveHandle &handle) const
Write the object to one or more catalogs.
Definition: CoaddInputs.cc:72
static ExposureCatalogT readFromArchive(io::InputArchive const &archive, BaseCatalog const &catalog)
Convenience input function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:428
Custom catalog class for ExposureRecord/Table.
Definition: Exposure.h:63
void writeToArchive(io::OutputArchiveHandle &handle, bool ignoreUnpersistable=true) const
Convenience output function for Persistables that contain an ExposureCatalog.
Definition: Exposure.cc:416
virtual bool isPersistable() const
Whether the object is in fact persistable - in this case, always true.
Definition: CoaddInputs.cc:66
table::ExposureCatalog ccds
Definition: CoaddInputs.h:51
virtual std::string getPersistenceName() const
Return the unique name used to persist this object and look up its factory.
Definition: CoaddInputs.cc:68