lsst.meas.algorithms  22.0.1-29-g401bd7c4+74af3d55eb
KernelPsfFactory.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
17 
18 namespace lsst {
19 namespace meas {
20 namespace algorithms {
21 
29 
30  static KernelPsfPersistenceHelper const& get();
31 
32  // No copying
35 
36  // No moving
39 
40 private:
42 };
43 
54 template <typename T = KernelPsf, typename K = afw::math::Kernel>
56 public:
58  afw::table::io::CatalogVector const& catalogs) const {
60  LSST_ARCHIVE_ASSERT(catalogs.size() == 1u);
61  LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
62  afw::table::BaseRecord const& record = catalogs.front().front();
63  LSST_ARCHIVE_ASSERT(record.getSchema() == keys.schema);
64  // make_shared cannot be used here because
65  // the KernelPsf constructor that takes shared_ptr<Kernel> is protected
66  return std::shared_ptr<T>(new T(archive.get<K>(record.get(keys.kernel)), record.get(keys.averagePosition)));
67  }
68 
69  KernelPsfFactory(std::string const& name) : afw::table::io::PersistableFactory(name) {}
70 };
71 
72 } // namespace algorithms
73 } // namespace meas
74 } // namespace lsst
table::Key< std::string > name
#define LSST_ARCHIVE_ASSERT(EXPR)
Field< T >::Value get(Key< T > const &key) const
std::shared_ptr< Persistable > get(int id) const
PersistableFactory(std::string const &name)
A PersistableFactory for KernelPsf and its subclasses.
KernelPsfFactory(std::string const &name)
virtual std::shared_ptr< afw::table::io::Persistable > read(afw::table::io::InputArchive const &archive, afw::table::io::CatalogVector const &catalogs) const
def keys(self)
A read-only singleton struct containing the schema and key used in persistence for KernelPsf.
KernelPsfPersistenceHelper(KernelPsfPersistenceHelper &&)=delete
KernelPsfPersistenceHelper(const KernelPsfPersistenceHelper &)=delete
static KernelPsfPersistenceHelper const & get()
Definition: KernelPsf.cc:55
KernelPsfPersistenceHelper & operator=(KernelPsfPersistenceHelper &&)=delete
KernelPsfPersistenceHelper & operator=(const KernelPsfPersistenceHelper &)=delete