Class OutputArchive

Class Documentation

class OutputArchive

A multi-catalog archive object used to save table::io::Persistable objects.

OutputArchive should generally be used directly only by objects that do not themselves inherit from Persistable, but contain many objects that do (such as Exposure). It provides an interface for adding objects to the archive (put()), transforming them into catalogs that can be retrieved directly or written to a FITS file. The first catalog is an index that indicates which rows of the subsequent catalogs correspond to each object.

See getIndexCatalog() for a more detailed description of the index.

Unnamed Group

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 InputArchive.

If permissive is true and obj->isPersistable() is false, the object will not be saved but 0 will be returned instead of throwing an exception.

If the given pointer is null, the returned ID is always 0, which may be used to retrieve null pointers from an InputArchive.

It is expected that the shared_ptr form will usually be used, as Persistables are typically held by shared_ptr. We also provide a const reference overload for temporaries as well as a const raw pointer overload for temporaries that may be null.

If the shared_ptr form is used and the given pointer has already been saved, it will not be written again and the same ID will be returned as the first time it was saved.

Provides no exception safety for the archive itself - if the object being saved (or any nested object) throws an exception, the archive may be in an inconsistent state and should not be saved. The objects being saved are never modified during persistence, even when exceptions are thrown.

int put(Persistable const *obj, bool permissive = false)
int put(Persistable const &obj, bool permissive = false)

Public Functions

OutputArchive()

Construct an empty OutputArchive containing no objects.

OutputArchive(OutputArchive const &other)

Copy-construct an OutputArchive. Saved objects are not deep-copied.

OutputArchive(OutputArchive &&other)
OutputArchive &operator=(OutputArchive const &other)

Assign from another OutputArchive. Saved objects are not deep-copied.

OutputArchive &operator=(OutputArchive &&other)
~OutputArchive()
BaseCatalog const &getIndexCatalog() const

Return the index catalog that specifies where objects are stored in the data catalogs.

BaseCatalog const &getCatalog(int n) const

Return the nth catalog. Catalog 0 is always the index catalog.

int countCatalogs() const

Return the total number of catalogs, including the index.

void writeFits(fits::Fits &fitsfile) const

Write the archive to an already-open FITS object.

Always appends new HDUs.

Parameters
  • [in] fitsfile: Open FITS object to write to.

Friends

friend lsst::afw::table::io::OutputArchive::OutputArchiveHandle