lsst.afw  15.0-29-ga12a2b06e
Classes | Public Types | Public Member Functions | List of all members
lsst::afw::table::io::FitsSchemaInputMapper Class Reference

A class that describes a mapping from a FITS binary table to an afw::table Schema. More...

#include <FitsSchemaInputMapper.h>

Classes

class  Impl
 

Public Types

typedef FitsSchemaItem Item
 

Public Member Functions

 FitsSchemaInputMapper (daf::base::PropertyList &metadata, bool stripMetadata)
 Construct a mapper from a PropertyList of FITS header values, stripping recognized keys if desired. More...
 
 FitsSchemaInputMapper (FitsSchemaInputMapper const &)
 
 FitsSchemaInputMapper (FitsSchemaInputMapper &&)
 
FitsSchemaInputMapper & operator= (FitsSchemaInputMapper const &)
 
FitsSchemaInputMapper & operator= (FitsSchemaInputMapper &&)
 
 ~FitsSchemaInputMapper ()
 
void setArchive (std::shared_ptr< InputArchive > archive)
 Set the Archive to an externally-provided one, overriding any that may have been read. More...
 
bool readArchive (afw::fits::Fits &fits)
 Set the Archive by reading from the HDU specified by the AR_HDU header entry. More...
 
bool hasArchive () const
 Return true if the mapper has an InputArchive. More...
 
Item const * find (std::string const &ttype) const
 Find an item with the given column name (ttype), returning nullptr if no such column exists. More...
 
Item const * find (int column) const
 Find an item with the given column number, returning nullptr if no such column exists. More...
 
void erase (Item const *item)
 Remove the given item (which should have been retrieved via find()) from the mapping, preventing it from being included in the regular fields added by finalize(). More...
 
void erase (std::string const &ttype)
 Remove the item with the given column name (ttype) from the mapping, preventing it from being included in the regular fields added by finalize(). More...
 
void erase (int column)
 Remove the item at the given column position from the mapping, preventing it from being included in the regular fields added by finalize(). More...
 
void customize (std::unique_ptr< FitsColumnReader > reader)
 Customize a mapping by providing a FitsColumnReader instance that will be invoked by readRecords(). More...
 
Schema finalize ()
 Map any remaining items into regular Schema items, and return the final Schema. More...
 
void readRecord (BaseRecord &record, afw::fits::Fits &fits, std::size_t row)
 Fill a record from a FITS binary table row. More...
 

Detailed Description

A class that describes a mapping from a FITS binary table to an afw::table Schema.

A FitsSchemaInputMapper is created every time a FITS binary table is read into an afw::table catalog, allowing limited customization of the mapping between on-disk FITS table columns an in-memory fields by subclasses of BaseTable.

The object is constructed from a daf::base::PropertyList that represents the FITS header, which is used to populate a custom container of FitsSchemaItems. These can then be retrieved by name or column number via the find() methods, allowing the user to create custom readers for columns or groups of columns via addColumnReader(). They can also be removed from the "regular" fields via the erase() method. Those regular fields are filled in by the finalize() method, which automatically generates mappings for any FitsSchemaItems that have not been removed by calls to erase(). Once finalize() has been called, readRecord() may be called repeatedly to read FITS rows into record objects according to the mapping that has been defined.

Definition at line 63 of file FitsSchemaInputMapper.h.

Member Typedef Documentation

◆ Item

Definition at line 65 of file FitsSchemaInputMapper.h.

Constructor & Destructor Documentation

◆ FitsSchemaInputMapper() [1/3]

lsst::afw::table::io::FitsSchemaInputMapper::FitsSchemaInputMapper ( daf::base::PropertyList &  metadata,
bool  stripMetadata 
)

Construct a mapper from a PropertyList of FITS header values, stripping recognized keys if desired.

Definition at line 93 of file FitsSchemaInputMapper.cc.

◆ FitsSchemaInputMapper() [2/3]

lsst::afw::table::io::FitsSchemaInputMapper::FitsSchemaInputMapper ( FitsSchemaInputMapper const &  )
default

◆ FitsSchemaInputMapper() [3/3]

lsst::afw::table::io::FitsSchemaInputMapper::FitsSchemaInputMapper ( FitsSchemaInputMapper &&  )
default

◆ ~FitsSchemaInputMapper()

lsst::afw::table::io::FitsSchemaInputMapper::~FitsSchemaInputMapper ( )
default

Member Function Documentation

◆ customize()

void lsst::afw::table::io::FitsSchemaInputMapper::customize ( std::unique_ptr< FitsColumnReader >  reader)

Customize a mapping by providing a FitsColumnReader instance that will be invoked by readRecords().

Definition at line 355 of file FitsSchemaInputMapper.cc.

◆ erase() [1/3]

void lsst::afw::table::io::FitsSchemaInputMapper::erase ( Item const *  item)

Remove the given item (which should have been retrieved via find()) from the mapping, preventing it from being included in the regular fields added by finalize().

Definition at line 333 of file FitsSchemaInputMapper.cc.

◆ erase() [2/3]

void lsst::afw::table::io::FitsSchemaInputMapper::erase ( std::string const &  ttype)

Remove the item with the given column name (ttype) from the mapping, preventing it from being included in the regular fields added by finalize().

Definition at line 339 of file FitsSchemaInputMapper.cc.

◆ erase() [3/3]

void lsst::afw::table::io::FitsSchemaInputMapper::erase ( int  column)

Remove the item at the given column position from the mapping, preventing it from being included in the regular fields added by finalize().

Definition at line 346 of file FitsSchemaInputMapper.cc.

◆ finalize()

Schema lsst::afw::table::io::FitsSchemaInputMapper::finalize ( )

Map any remaining items into regular Schema items, and return the final Schema.

This method must be called before any calls to readRecords().

Definition at line 716 of file FitsSchemaInputMapper.cc.

◆ find() [1/2]

FitsSchemaItem const * lsst::afw::table::io::FitsSchemaInputMapper::find ( std::string const &  ttype) const

Find an item with the given column name (ttype), returning nullptr if no such column exists.

The returned pointer is owned by the mapper object, and should not be deleted. It is invalidated by calls to either erase() or finalize().

Definition at line 317 of file FitsSchemaInputMapper.cc.

◆ find() [2/2]

FitsSchemaItem const * lsst::afw::table::io::FitsSchemaInputMapper::find ( int  column) const

Find an item with the given column number, returning nullptr if no such column exists.

The returned pointer is owned by the mapper object, and should not be deleted. It is invalidated by calls to either erase() or finalize().

Definition at line 325 of file FitsSchemaInputMapper.cc.

◆ hasArchive()

bool lsst::afw::table::io::FitsSchemaInputMapper::hasArchive ( ) const

Return true if the mapper has an InputArchive.

Definition at line 315 of file FitsSchemaInputMapper.cc.

◆ operator=() [1/2]

FitsSchemaInputMapper & lsst::afw::table::io::FitsSchemaInputMapper::operator= ( FitsSchemaInputMapper const &  )
default

◆ operator=() [2/2]

FitsSchemaInputMapper & lsst::afw::table::io::FitsSchemaInputMapper::operator= ( FitsSchemaInputMapper &&  )
default

◆ readArchive()

bool lsst::afw::table::io::FitsSchemaInputMapper::readArchive ( afw::fits::Fits &  fits)

Set the Archive by reading from the HDU specified by the AR_HDU header entry.

Returns true on success, false if there is no AR_HDU entry.

Definition at line 299 of file FitsSchemaInputMapper.cc.

◆ readRecord()

void lsst::afw::table::io::FitsSchemaInputMapper::readRecord ( BaseRecord &  record,
afw::fits::Fits &  fits,
std::size_t  row 
)

Fill a record from a FITS binary table row.

Definition at line 790 of file FitsSchemaInputMapper.cc.

◆ setArchive()

void lsst::afw::table::io::FitsSchemaInputMapper::setArchive ( std::shared_ptr< InputArchive >  archive)

Set the Archive to an externally-provided one, overriding any that may have been read.

Definition at line 297 of file FitsSchemaInputMapper.cc.


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