LSSTApplications  11.0-13-gbb96280,12.1+18,12.1+7,12.1-1-g14f38d3+72,12.1-1-g16c0db7+5,12.1-1-g5961e7a+84,12.1-1-ge22e12b+23,12.1-11-g06625e2+4,12.1-11-g0d7f63b+4,12.1-19-gd507bfc,12.1-2-g7dda0ab+38,12.1-2-gc0bc6ab+81,12.1-21-g6ffe579+2,12.1-21-gbdb6c2a+4,12.1-24-g941c398+5,12.1-3-g57f6835+7,12.1-3-gf0736f3,12.1-37-g3ddd237,12.1-4-gf46015e+5,12.1-5-g06c326c+20,12.1-5-g648ee80+3,12.1-5-gc2189d7+4,12.1-6-ga608fc0+1,12.1-7-g3349e2a+5,12.1-7-gfd75620+9,12.1-9-g577b946+5,12.1-9-gc4df26a+10
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 { namespace afw { namespace table {
9 
10 class Schema;
11 class BaseRecord;
12 template <typename RecordT> class CatalogT;
13 typedef CatalogT<BaseRecord> BaseCatalog;
14 
15 namespace io {
16 
17 class Persistable;
18 class OutputArchiveHandle;
19 
32 public:
33 
34  friend class OutputArchiveHandle;
35 
37  OutputArchive();
38 
40  OutputArchive(OutputArchive const & other);
41 
43  OutputArchive & operator=(OutputArchive const & other);
44 
45  // (trivial) destructor must be defined in the source for pimpl idiom.
47 
49 
71  int put(Persistable const * obj, bool permissive=false);
72  int put(CONST_PTR(Persistable) obj, bool permissive=false) { return put(obj.get(), permissive); }
74 
79  BaseCatalog const & getIndexCatalog() const;
80 
82  BaseCatalog const & getCatalog(int n) const;
83 
85  int countCatalogs() const;
86 
94  void writeFits(fits::Fits & fitsfile) const;
95 
96 private:
97 
98  class Impl;
99 
100  PTR(Impl) _impl;
101 };
102 
110 public:
111 
118  BaseCatalog makeCatalog(Schema const & schema);
119 
126  void saveCatalog(BaseCatalog const & catalog);
127 
129 
134  int put(Persistable const * obj, bool permissive=false);
135  int put(CONST_PTR(Persistable) obj, bool permissive=false) { return put(obj.get(), permissive); }
137 
138  ~OutputArchiveHandle();
139 
140  // No copying
141  OutputArchiveHandle (const OutputArchiveHandle&) = delete;
142  OutputArchiveHandle& operator=(const OutputArchiveHandle&) = delete;
143 
144  // No moving
145  OutputArchiveHandle (OutputArchiveHandle&&) = delete;
146  OutputArchiveHandle& operator=(OutputArchiveHandle&&) = delete;
147 
148 private:
149 
150  friend class OutputArchive::Impl;
151 
153  int id, std::string const & name, std::string const & module,
154  PTR(OutputArchive::Impl) impl
155  );
156 
157  int _id;
159  std::string _name;
160  std::string _module;
161  PTR(OutputArchive::Impl) _impl;
162 };
163 
164 }}}} // namespace lsst::afw::table::io
165 
166 #endif // !AFW_TABLE_IO_OutputArchive_h_INCLUDED
int countCatalogs() const
Return the total number of catalogs, including the index.
Defines the fields and offsets for a table.
Definition: Schema.h:44
OutputArchive & operator=(OutputArchive const &other)
Assign from another OutputArchive. Saved objects are not deep-copied.
table::Key< std::string > name
Definition: ApCorrMap.cc:71
int put(boost::shared_ptr< Persistable const > obj, bool permissive=false)
Save a nested Persistable to the same archive.
CatalogT< BaseRecord > BaseCatalog
Definition: fwd.h:61
An object passed to Persistable::write to allow it to persist itself.
A custom container class for records, based on std::vector.
Definition: Catalog.h:95
afw::table::Schema schema
Definition: GaussianPsf.cc:41
BaseCatalog const & getIndexCatalog() const
Return the index catalog that specifies where objects are stored in the data catalogs.
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...
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Definition: fits.h:202
A base class for objects that can be persisted via afw::table::io Archive classes.
Definition: Persistable.h:72
A multi-catalog archive object used to save table::io::Persistable objects.
Definition: OutputArchive.h:31
metadata import lsst afw display as afwDisplay n
void writeFits(fits::Fits &fitsfile) const
Write the archive to an already-open FITS object.
boost::shared_ptr< Impl > _impl
Definition: OutputArchive.h:98
BaseCatalog const & getCatalog(int n) const
Return the nth catalog. Catalog 0 is always the index catalog.
OutputArchive()
Construct an empty OutputArchive containing no objects.
#define PTR(...)
Definition: base.h:41
int put(boost::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.h:72
#define CONST_PTR(...)
A shared pointer to a const object.
Definition: base.h:47
Basic LSST definitions.