23#ifndef AFW_TABLE_SortedCatalog_h_INCLUDED
24#define AFW_TABLE_SortedCatalog_h_INCLUDED
41template <
typename RecordT>
47 using Table =
typename Record::Table;
102 template <
typename InputIterator>
113 template <
typename OtherRecordT>
127 return io::FitsReader::apply<SortedCatalogT>(filename, hdu, flags);
142 return io::FitsReader::apply<SortedCatalogT>(manager, hdu, flags);
153 return io::FitsReader::apply<SortedCatalogT>(fitsfile, flags);
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
Lifetime-management for memory that goes into FITS memory files.
A custom container class for records, based on std::vector.
iterator find(typename Field< T >::Value const &value, Key< T > const &key)
Return an iterator to the record with the given value.
CatalogIterator< typename Internal::iterator > iterator
CatalogIterator< typename Internal::const_iterator > const_iterator
CatalogT< RecordT > subset(ndarray::Array< bool const, 1 > const &mask) const
Return the subset of a catalog corresponding to the True values of the given mask array.
void sort(Key< T > const &key)
Sort the catalog in-place by the field with the given key.
bool isSorted(Key< T > const &key) const
Return true if the catalog is in ascending order according to the given key.
Defines the fields and offsets for a table.
Custom catalog class for record/table subclasses that are guaranteed to have an ID,...
bool isSorted() const
Return true if the vector is in ascending ID order.
typename Base::const_iterator const_iterator
typename Base::iterator iterator
SortedCatalogT(SortedCatalogT &&)=default
SortedCatalogT & operator=(SortedCatalogT &&)=default
SortedCatalogT & operator=(SortedCatalogT const &)=default
SortedCatalogT subset(std::ptrdiff_t startd, std::ptrdiff_t stopd, std::ptrdiff_t step) const
Shallow copy a subset of another SortedCatalog.
iterator find(RecordId id)
Return an iterator to the record with the given ID.
SortedCatalogT(std::shared_ptr< Table > const &table, InputIterator first, InputIterator last, bool deep=false)
Construct a vector from a table and an iterator range.
static SortedCatalogT readFits(fits::Fits &fitsfile, int flags=0)
Read a FITS binary table from a file object already at the correct extension.
~SortedCatalogT()=default
SortedCatalogT(SortedCatalogT const &)=default
const_iterator find(RecordId id) const
SortedCatalogT(std::shared_ptr< Table > const &table=std::shared_ptr< Table >())
Construct a vector from a table (or nothing).
SortedCatalogT< RecordT > subset(ndarray::Array< bool const, 1 > const &mask) const
Return the subset of a catalog corresponding to the True values of the given mask array.
static SortedCatalogT readFits(fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU, int flags=0)
Read a FITS binary table from a RAM file.
void sort()
Sort the vector in-place by ID.
SortedCatalogT(Base const &other)
typename Record::Table Table
static SortedCatalogT readFits(std::string const &filename, int hdu=fits::DEFAULT_HDU, int flags=0)
Read a FITS binary table from a regular file.
SortedCatalogT(SortedCatalogT< OtherRecordT > const &other)
Shallow copy constructor from a container containing a related record type.
SortedCatalogT(Schema const &schema)
Construct a vector from a schema, creating a table with Table::make(schema).
const int DEFAULT_HDU
Specify that the default HDU should be read.