LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
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:
126  BaseCatalog makeCatalog(Schema const& schema);
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
152  OutputArchiveHandle(const OutputArchiveHandle&) = delete;
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
Defines the fields and offsets for a table.
Definition: Schema.h:50
int countCatalogs() const
Return the total number of catalogs, including the index.
OutputArchive & operator=(OutputArchive const &other)
Assign from another OutputArchive. Saved objects are not deep-copied.
OutputArchive()
Construct an empty OutputArchive containing no objects.
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:71
An object passed to Persistable::write to allow it to persist itself.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:296
BaseCatalog const & getIndexCatalog() const
Return the index catalog that specifies where objects are stored in the data catalogs.
STL class.
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:74
A multi-catalog archive object used to save table::io::Persistable objects.
Definition: OutputArchive.h:34
void writeFits(fits::Fits &fitsfile) const
Write the archive to an already-open FITS object.
A base class for image defects.
table::Schema schema
Definition: Camera.cc:161
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...
ItemVariant const * other
Definition: Schema.cc:56
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
Basic LSST definitions.
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...
BaseCatalog const & getCatalog(int n) const
Return the nth catalog. Catalog 0 is always the index catalog.