lsst.meas.algorithms  13.0-24-g22030a45
KernelPsfFactory.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 
13 #include "lsst/afw/table/io/InputArchive.h"
14 #include "lsst/afw/table/io/OutputArchive.h"
15 #include "lsst/afw/table/io/CatalogVector.h"
16 #include "lsst/afw/table/aggregates.h"
17 
18 namespace lsst { namespace meas { namespace algorithms {
19 
24  afw::table::Schema schema;
25  afw::table::Key<int> kernel;
26  afw::table::PointKey<double> averagePosition;
27 
28  static KernelPsfPersistenceHelper const & get();
29 
30  // No copying
33 
34  // No moving
37 
38 private:
40 };
41 
52 template <typename T=KernelPsf, typename K=afw::math::Kernel>
53 class KernelPsfFactory : public afw::table::io::PersistableFactory {
54 public:
55 
56  virtual PTR(afw::table::io::Persistable)
57  read(afw::table::io::InputArchive const & archive, afw::table::io::CatalogVector const & catalogs) const {
59  LSST_ARCHIVE_ASSERT(catalogs.size() == 1u);
60  LSST_ARCHIVE_ASSERT(catalogs.front().size() == 1u);
61  afw::table::BaseRecord const & record = catalogs.front().front();
62  LSST_ARCHIVE_ASSERT(record.getSchema() == keys.schema);
63  return PTR(T)(
64  new T(
65  archive.get<K>(record.get(keys.kernel)),
66  record.get(keys.averagePosition)
67  )
68  );
69  }
70 
71  KernelPsfFactory(std::string const & name) : afw::table::io::PersistableFactory(name) {}
72 
73 };
74 
75 }}} // namespace lsst::afw::detection
A read-only singleton struct containing the schema and key used in persistence for KernelPsf...
KernelPsfFactory(std::string const &name)
static KernelPsfPersistenceHelper const & get()
Definition: KernelPsf.cc:41
KernelPsfPersistenceHelper & operator=(const KernelPsfPersistenceHelper &)=delete
A PersistableFactory for KernelPsf and its subclasses.