LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Private Attributes | Friends | List of all members
lsst::afw::table::io::OutputArchive Class Reference

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

#include <OutputArchive.h>

Public Member Functions

 OutputArchive ()
 Construct an empty OutputArchive containing no objects. More...
 
 OutputArchive (OutputArchive const &other)
 Copy-construct an OutputArchive. Saved objects are not deep-copied. More...
 
OutputArchiveoperator= (OutputArchive const &other)
 Assign from another OutputArchive. Saved objects are not deep-copied. More...
 
 ~OutputArchive ()
 
BaseCatalog const & getIndexCatalog () const
 Return the index catalog that specifies where objects are stored in the data catalogs. More...
 
BaseCatalog const & getCatalog (int n) const
 Return the nth catalog. Catalog 0 is always the index catalog. More...
 
int countCatalogs () const
 Return the total number of catalogs, including the index. More...
 
void writeFits (fits::Fits &fitsfile) const
 Write the archive to an already-open FITS object. More...
 
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 InputArchive. More...
 
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 InputArchive. More...
 

Private Attributes

boost::shared_ptr< Impl > _impl
 

Friends

class OutputArchiveHandle
 

Detailed Description

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.

Definition at line 33 of file OutputArchive.h.

Constructor & Destructor Documentation

lsst::afw::table::io::OutputArchive::OutputArchive ( )

Construct an empty OutputArchive containing no objects.

lsst::afw::table::io::OutputArchive::OutputArchive ( OutputArchive const &  other)

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

lsst::afw::table::io::OutputArchive::~OutputArchive ( )

Member Function Documentation

int lsst::afw::table::io::OutputArchive::countCatalogs ( ) const

Return the total number of catalogs, including the index.

BaseCatalog const& lsst::afw::table::io::OutputArchive::getCatalog ( int  n) const

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

BaseCatalog const& lsst::afw::table::io::OutputArchive::getIndexCatalog ( ) const

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

OutputArchive& lsst::afw::table::io::OutputArchive::operator= ( OutputArchive const &  other)

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

int lsst::afw::table::io::OutputArchive::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 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 has already been saved, it will not be written again and the same ID will be returned as the first time it was saved.

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 CONST_PTR form will usually be used, as Persistables are typically held by PTR. But we expose the lower-level raw-pointer form so users aren't forced to clone objects before persisting them if they don't already have a PTR.

The implementation of 'put' does not provide any exception safety; if the object being saved (or any nested object) throws an exception, the entire archive may be in an inconsistent state and should not be saved.

int lsst::afw::table::io::OutputArchive::put ( boost::shared_ptr< Persistable const >  obj,
bool  permissive = false 
)
inline

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 has already been saved, it will not be written again and the same ID will be returned as the first time it was saved.

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 CONST_PTR form will usually be used, as Persistables are typically held by PTR. But we expose the lower-level raw-pointer form so users aren't forced to clone objects before persisting them if they don't already have a PTR.

The implementation of 'put' does not provide any exception safety; if the object being saved (or any nested object) throws an exception, the entire archive may be in an inconsistent state and should not be saved.

Definition at line 74 of file OutputArchive.h.

74 { return put(obj.get(), permissive); }
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...
void lsst::afw::table::io::OutputArchive::writeFits ( fits::Fits fitsfile) const

Write the archive to an already-open FITS object.

Always appends new HDUs.

Parameters
[in]fitsfileOpen FITS object to write to.

Friends And Related Function Documentation

friend class OutputArchiveHandle
friend

Definition at line 36 of file OutputArchive.h.

Member Data Documentation

boost::shared_ptr< Impl > lsst::afw::table::io::OutputArchive::_impl
private

Definition at line 100 of file OutputArchive.h.


The documentation for this class was generated from the following file: