LSSTApplications  20.0.0
LSSTDataManagementBasePackage
OutputArchive.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #ifndef AFW_TABLE_IO_OutputArchive_h_INCLUDED
3 #define AFW_TABLE_IO_OutputArchive_h_INCLUDED
4 
5 #include "lsst/base.h"
7 
8 namespace lsst {
9 namespace afw {
10 namespace table {
11 
12 class Schema;
13 class BaseRecord;
14 template <typename RecordT>
15 class CatalogT;
16 typedef CatalogT<BaseRecord> BaseCatalog;
17 
18 namespace io {
19 
20 class Persistable;
21 class OutputArchiveHandle;
22 
34 class OutputArchive final {
35 public:
36  friend class OutputArchiveHandle;
37 
39  OutputArchive();
40 
44 
48 
49  // (trivial) destructor must be defined in the source for pimpl idiom.
51 
53 
80  int put(std::shared_ptr<Persistable const> obj, bool permissive = false);
81  int put(Persistable const * obj, bool permissive = false);
82  int put(Persistable const & obj, bool permissive = false) { return put(&obj, permissive); }
84 
89  BaseCatalog const& getIndexCatalog() const;
90 
92  BaseCatalog const& getCatalog(int n) const;
93 
95  int countCatalogs() const;
96 
104  void writeFits(fits::Fits& fitsfile) const;
105 
106 private:
107  class Impl;
108 
109  std::shared_ptr<Impl> _impl;
110 };
111 
118 class OutputArchiveHandle final {
119 public:
127 
132  void saveEmpty();
133 
140  void saveCatalog(BaseCatalog const& catalog);
141 
144  int put(Persistable const* obj, bool permissive = false);
145  int put(std::shared_ptr<Persistable const> obj, bool permissive = false);
146  int put(Persistable const & obj, bool permissive = false) { return put(&obj, permissive); }
148 
150 
151  // No copying
154 
155  // No moving
158 
159 private:
160  friend class OutputArchive::Impl;
161 
162  OutputArchiveHandle(int id, std::string const& name, std::string const& module,
164 
165  int _id;
166  int _catPersistable;
167  std::string _name;
168  std::string _module;
170 };
171 } // namespace io
172 } // namespace table
173 } // namespace afw
174 } // namespace lsst
175 
176 #endif // !AFW_TABLE_IO_OutputArchive_h_INCLUDED
schema
table::Schema schema
Definition: Amplifier.cc:115
std::string
STL class.
lsst::afw::table::io::OutputArchive::put
int put(Persistable const &obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
Definition: OutputArchive.h:82
std::shared_ptr
STL class.
lsst::afw::table::io::OutputArchive::operator=
OutputArchive & operator=(OutputArchive const &other)
Assign from another OutputArchive. Saved objects are not deep-copied.
Definition: OutputArchive.cc:163
lsst::afw::table::io::OutputArchive::Impl
Definition: OutputArchive.cc:37
lsst::afw::table::io::OutputArchive::~OutputArchive
~OutputArchive()
lsst::afw::table::io::OutputArchiveHandle::OutputArchiveHandle
OutputArchiveHandle(OutputArchiveHandle &&)=delete
lsst::afw::table::io::OutputArchive::getCatalog
BaseCatalog const & getCatalog(int n) const
Return the nth catalog. Catalog 0 is always the index catalog.
Definition: OutputArchive.cc:190
lsst::afw::table::io::OutputArchive::put
int put(std::shared_ptr< Persistable const > obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
Definition: OutputArchive.cc:180
lsst::afw::table::io::OutputArchiveHandle
An object passed to Persistable::write to allow it to persist itself.
Definition: OutputArchive.h:118
lsst::afw::fits::Fits
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:297
lsst::afw::table::io::OutputArchiveHandle::saveCatalog
void saveCatalog(BaseCatalog const &catalog)
Save a catalog in the archive.
Definition: OutputArchive.cc:211
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::table::io::OutputArchiveHandle::~OutputArchiveHandle
~OutputArchiveHandle()
Definition: OutputArchive.cc:232
lsst::afw::table::Schema
Defines the fields and offsets for a table.
Definition: Schema.h:50
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
lsst::afw::table::io::OutputArchiveHandle::operator=
OutputArchiveHandle & operator=(const OutputArchiveHandle &)=delete
lsst::afw::table::io::OutputArchiveHandle::put
int put(Persistable const &obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
Definition: OutputArchive.h:146
lsst::afw::table::io::OutputArchiveHandle::makeCatalog
BaseCatalog makeCatalog(Schema const &schema)
Return a new, empty catalog with the given schema.
Definition: OutputArchive.cc:207
lsst::afw::table::io::OutputArchive::writeFits
void writeFits(fits::Fits &fitsfile) const
Write the archive to an already-open FITS object.
Definition: OutputArchive.cc:203
other
ItemVariant const * other
Definition: Schema.cc:56
lsst::afw::table::io::OutputArchiveHandle::saveEmpty
void saveEmpty()
Indicate that the object being persisted has no state, and hence will never call makeCatalog() or sav...
Definition: OutputArchive.cc:209
lsst::afw::table::io::OutputArchive
A multi-catalog archive object used to save table::io::Persistable objects.
Definition: OutputArchive.h:34
base.h
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
lsst::afw::table::io::Persistable
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
lsst::afw::table::BaseCatalog
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:71
Persistable.h
lsst::afw::table::io::OutputArchiveHandle::put
int put(Persistable const *obj, bool permissive=false)
Save an object to the archive and return a unique ID that can be used to retrieve it from an InputArc...
Definition: OutputArchive.cc:216
lsst::afw::table::io::OutputArchiveHandle::OutputArchiveHandle
OutputArchiveHandle(const OutputArchiveHandle &)=delete
lsst::afw::table::io::OutputArchive::OutputArchive
OutputArchive()
Construct an empty OutputArchive containing no objects.
Definition: OutputArchive.cc:157
lsst::afw::table::CatalogT< BaseRecord >
lsst::meas::modelfit.psf.psfContinued.module
module
Definition: psfContinued.py:42
lsst::afw::table::io::OutputArchiveHandle::operator=
OutputArchiveHandle & operator=(OutputArchiveHandle &&)=delete
lsst::afw::table::io::OutputArchive::countCatalogs
int countCatalogs() const
Return the total number of catalogs, including the index.
Definition: OutputArchive.cc:201
lsst::afw::table::io::OutputArchive::getIndexCatalog
BaseCatalog const & getIndexCatalog() const
Return the index catalog that specifies where objects are stored in the data catalogs.
Definition: OutputArchive.cc:188