lsst.afw 23.0.0+60ce4897b0
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lsst::afw::table::CatalogT< RecordT > Class Template Reference

A custom container class for records, based on std::vector. More...

#include <Catalog.h>

Inheritance diagram for lsst::afw::table::CatalogT< RecordT >:
lsst::afw::table::SortedCatalogT< RecordT > lsst::afw::table::ExposureCatalogT< RecordT >

Public Types

using Record = RecordT
 
using Table = typename Record::Table
 
using ColumnView = typename Record::ColumnView
 
using value_type = RecordT
 
using reference = RecordT &
 
using pointer = std::shared_ptr< RecordT >
 
using size_type = typename Internal::size_type
 
using difference_type = typename Internal::difference_type
 
using iterator = CatalogIterator< typename Internal::iterator >
 
using const_iterator = CatalogIterator< typename Internal::const_iterator >
 

Public Member Functions

std::shared_ptr< TablegetTable () const
 Return the table associated with the catalog. More...
 
Schema getSchema () const
 Return the schema associated with the catalog's table. More...
 
 CatalogT (std::shared_ptr< Table > const &table=std::shared_ptr< Table >())
 Construct a catalog from a table (or nothing). More...
 
 CatalogT (Schema const &schema)
 Construct a catalog from a schema, creating a table with Table::make(schema). More...
 
template<typename InputIterator >
 CatalogT (std::shared_ptr< Table > const &table, InputIterator first, InputIterator last, bool deep=false)
 Construct a catalog from a table and an iterator range. More...
 
 CatalogT (CatalogT const &other)
 Shallow copy constructor. More...
 
 CatalogT (CatalogT &&other)
 
 ~CatalogT ()=default
 
template<typename OtherRecordT >
 CatalogT (CatalogT< OtherRecordT > const &other)
 Shallow copy constructor from a container containing a related record type. More...
 
CatalogToperator= (CatalogT const &other)
 Shallow assigment. More...
 
CatalogToperator= (CatalogT &&other)
 
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. More...
 
CatalogT< RecordT > subset (std::ptrdiff_t startd, std::ptrdiff_t stopd, std::ptrdiff_t step) const
 Returns a shallow copy of a subset of this Catalog. More...
 
void writeFits (std::string const &filename, std::string const &mode="w", int flags=0) const
 Write a FITS binary table to a regular file. More...
 
void writeFits (fits::MemFileManager &manager, std::string const &mode="w", int flags=0) const
 Write a FITS binary table to a RAM file. More...
 
void writeFits (fits::Fits &fitsfile, int flags=0) const
 Write a FITS binary table to an open file object. More...
 
ColumnView getColumnView () const
 Return a ColumnView of this catalog's records. More...
 
bool isContiguous () const
 Return true if all records are contiguous. More...
 
iterator begin ()
 Iterator access. More...
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
bool empty () const
 Return true if the catalog has no records. More...
 
size_type size () const
 Return the number of elements in the catalog. More...
 
size_type max_size () const
 Return the maximum number of elements allowed in a catalog. More...
 
size_type capacity () const
 Return the capacity of the catalog. More...
 
void reserve (size_type n)
 Increase the capacity of the catalog to the given size. More...
 
void resize (size_type n)
 Change the size of the catalog, removing or adding empty records as needed. More...
 
reference operator[] (size_type i) const
 Return the record at index i. More...
 
reference at (size_type i) const
 Return the record at index i (throws std::out_of_range). More...
 
reference front () const
 Return the first record. More...
 
reference back () const
 Return the last record. More...
 
std::shared_ptr< RecordT > const get (size_type i) const
 Return a pointer to the record at index i. More...
 
void set (size_type i, std::shared_ptr< RecordT > const &p)
 Set the record at index i to a pointer. More...
 
template<typename InputIterator >
void assign (InputIterator first, InputIterator last, bool deep=false)
 Replace the contents of the table with an iterator range. More...
 
void push_back (Record const &r)
 Add a copy of the given record to the end of the catalog. More...
 
void push_back (std::shared_ptr< RecordT > const &p)
 Add the given record to the end of the catalog without copying. More...
 
std::shared_ptr< RecordT > addNew ()
 Create a new record, add it to the end of the catalog, and return a pointer to it. More...
 
void pop_back ()
 Remove the last record in the catalog. More...
 
CatalogT copy () const
 Deep-copy the catalog using a cloned table. More...
 
template<typename InputIterator >
void insert (iterator pos, InputIterator first, InputIterator last, bool deep=false)
 Insert an iterator range into the table. More...
 
template<typename InputIterator >
void insert (SchemaMapper const &mapper, iterator pos, InputIterator first, InputIterator last)
 Insert a range of records into the catalog by copying them with a SchemaMapper. More...
 
iterator insert (iterator pos, Record const &r)
 Insert a copy of the given record at the given position. More...
 
iterator insert (iterator pos, std::shared_ptr< RecordT > const &p)
 Insert the given record at the given position without copying. More...
 
iterator erase (iterator pos)
 Erase the record pointed to by pos, and return an iterator the next record. More...
 
iterator erase (iterator first, iterator last)
 Erase the records in the range [first, last). More...
 
void swap (CatalogT &other) noexcept
 Shallow swap of two catalogs. More...
 
void clear ()
 Remove all records from the catalog. More...
 
template<typename T >
bool isSorted (Key< T > const &key) const
 Return true if the catalog is in ascending order according to the given key. More...
 
template<typename Compare >
bool isSorted (Compare cmp) const
 Return true if the catalog is in ascending order according to the given predicate. More...
 
template<typename T >
void sort (Key< T > const &key)
 Sort the catalog in-place by the field with the given key. More...
 
template<typename Compare >
void sort (Compare cmp)
 Sort the catalog in-place by the field with the given predicate. More...
 
template<typename T >
iterator find (typename Field< T >::Value const &value, Key< T > const &key)
 Return an iterator to the record with the given value. More...
 
template<typename T >
const_iterator find (typename Field< T >::Value const &value, Key< T > const &key) const
 
template<typename T >
iterator lower_bound (typename Field< T >::Value const &value, Key< T > const &key)
 Performed binary searches on sorted fields. More...
 
template<typename T >
const_iterator lower_bound (typename Field< T >::Value const &value, Key< T > const &key) const
 
template<typename T >
iterator upper_bound (typename Field< T >::Value const &value, Key< T > const &key)
 
template<typename T >
const_iterator upper_bound (typename Field< T >::Value const &value, Key< T > const &key) const
 
template<typename T >
std::pair< iterator, iteratorequal_range (typename Field< T >::Value const &value, Key< T > const &key)
 
template<typename T >
std::pair< const_iterator, const_iteratorequal_range (typename Field< T >::Value const &value, Key< T > const &key) const
 
InternalgetInternal ()
 Return a reference to the internal vector-of-shared_ptr. More...
 
Internal const & getInternal () const
 
template<typename T >
std::pair< typename CatalogT< RecordT >::iterator, typename CatalogT< RecordT >::iteratorequal_range (typename Field< T >::Value const &value, Key< T > const &key)
 
template<typename T >
std::pair< typename CatalogT< RecordT >::const_iterator, typename CatalogT< RecordT >::const_iteratorequal_range (typename Field< T >::Value const &value, Key< T > const &key) const
 

Static Public Member Functions

static CatalogT readFits (std::string const &filename, int hdu=fits::DEFAULT_HDU, int flags=0)
 Read a FITS binary table from a regular file. More...
 
static CatalogT readFits (fits::MemFileManager &manager, int hdu=fits::DEFAULT_HDU, int flags=0)
 Read a FITS binary table from a RAM file. More...
 
static CatalogT readFits (fits::Fits &fitsfile, int flags=0)
 Read a FITS binary table from a file object already at the correct extension. More...
 

Detailed Description

template<typename RecordT>
class lsst::afw::table::CatalogT< RecordT >

A custom container class for records, based on std::vector.

CatalogT wraps a std::vector<std::shared_ptr<RecordT>> in an interface that looks more like a std::vector<RecordT>; its iterators and accessors return references or const references, rather than pointers, making them easier to use. It also holds a table, which is used to allocate new records and determine the schema, but no checking is done to ensure that records added to the catalog use the same table or indeed have the same schema.

Because a CatalogT is holds shared_ptrs internally, many of its operations can be either shallow or deep, with new deep copies allocated by the catalog's table object. New records can be also be inserted by pointer (shallow) or by value (deep).

The constness of records is determined by the constness of the first template parameter to CatalogT; a container instance is always either const or non-const in that respect (like smart pointers). Also like smart pointers, const member functions (and by extension, const_iterators) do not allow the underlying pointers to be changed, while non-const member functions and iterators do.

CatalogT does not permit empty (null) pointers as elements. As a result, CatalogT has no resize member function.

CatalogT has a very different interface in Python; it mimics Python's list instead of C++'s std::vector. It is also considerably simpler, because it doesn't need to deal with iterator ranges or the distinction between references and shared_ptrs to records. See the Python docstring for more information.

Definition at line 98 of file Catalog.h.

Member Typedef Documentation

◆ ColumnView

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::ColumnView = typename Record::ColumnView

Definition at line 104 of file Catalog.h.

◆ const_iterator

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::const_iterator = CatalogIterator<typename Internal::const_iterator>

Definition at line 112 of file Catalog.h.

◆ difference_type

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::difference_type = typename Internal::difference_type

Definition at line 110 of file Catalog.h.

◆ iterator

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::iterator = CatalogIterator<typename Internal::iterator>

Definition at line 111 of file Catalog.h.

◆ pointer

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::pointer = std::shared_ptr<RecordT>

Definition at line 108 of file Catalog.h.

◆ Record

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::Record = RecordT

Definition at line 102 of file Catalog.h.

◆ reference

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::reference = RecordT &

Definition at line 107 of file Catalog.h.

◆ size_type

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::size_type = typename Internal::size_type

Definition at line 109 of file Catalog.h.

◆ Table

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::Table = typename Record::Table

Definition at line 103 of file Catalog.h.

◆ value_type

template<typename RecordT >
using lsst::afw::table::CatalogT< RecordT >::value_type = RecordT

Definition at line 106 of file Catalog.h.

Constructor & Destructor Documentation

◆ CatalogT() [1/6]

template<typename RecordT >
lsst::afw::table::CatalogT< RecordT >::CatalogT ( std::shared_ptr< Table > const &  table = std::shared_ptr<Table>())
inlineexplicit

Construct a catalog from a table (or nothing).

A table is always initialized with a minimal schema.

Definition at line 125 of file Catalog.h.

◆ CatalogT() [2/6]

template<typename RecordT >
lsst::afw::table::CatalogT< RecordT >::CatalogT ( Schema const &  schema)
inlineexplicit

Construct a catalog from a schema, creating a table with Table::make(schema).

Definition at line 134 of file Catalog.h.

◆ CatalogT() [3/6]

template<typename RecordT >
template<typename InputIterator >
lsst::afw::table::CatalogT< RecordT >::CatalogT ( std::shared_ptr< Table > const &  table,
InputIterator  first,
InputIterator  last,
bool  deep = false 
)
inline

Construct a catalog from a table and an iterator range.

If deep is true, new records will be created using table->copyRecord before being inserted. If deep is false, records will be not be copied, but they must already be associated with the given table. The table itself is never deep-copied.

The iterator must dereference to a record reference or const reference rather than a pointer, but should be implicitly convertible to a record pointer as well (see CatalogIterator).

Definition at line 147 of file Catalog.h.

◆ CatalogT() [4/6]

template<typename RecordT >
lsst::afw::table::CatalogT< RecordT >::CatalogT ( CatalogT< RecordT > const &  other)
inline

Shallow copy constructor.

Definition at line 153 of file Catalog.h.

◆ CatalogT() [5/6]

template<typename RecordT >
lsst::afw::table::CatalogT< RecordT >::CatalogT ( CatalogT< RecordT > &&  other)
inline

Definition at line 155 of file Catalog.h.

◆ ~CatalogT()

template<typename RecordT >
lsst::afw::table::CatalogT< RecordT >::~CatalogT ( )
default

◆ CatalogT() [6/6]

template<typename RecordT >
template<typename OtherRecordT >
lsst::afw::table::CatalogT< RecordT >::CatalogT ( CatalogT< OtherRecordT > const &  other)
inline

Shallow copy constructor from a container containing a related record type.

This conversion only succeeds if OtherRecordT is convertible to RecordT and OtherTable is convertible to Table.

Definition at line 166 of file Catalog.h.

Member Function Documentation

◆ addNew()

template<typename RecordT >
std::shared_ptr< RecordT > lsst::afw::table::CatalogT< RecordT >::addNew ( )
inline

Create a new record, add it to the end of the catalog, and return a pointer to it.

Definition at line 490 of file Catalog.h.

◆ assign()

template<typename RecordT >
template<typename InputIterator >
void lsst::afw::table::CatalogT< RecordT >::assign ( InputIterator  first,
InputIterator  last,
bool  deep = false 
)
inline

Replace the contents of the table with an iterator range.

Delegates to insert(); look there for more information.

Definition at line 475 of file Catalog.h.

◆ at()

template<typename RecordT >
reference lsst::afw::table::CatalogT< RecordT >::at ( size_type  i) const
inline

Return the record at index i (throws std::out_of_range).

Definition at line 455 of file Catalog.h.

◆ back()

template<typename RecordT >
reference lsst::afw::table::CatalogT< RecordT >::back ( ) const
inline

Return the last record.

Definition at line 461 of file Catalog.h.

◆ begin() [1/2]

template<typename RecordT >
iterator lsst::afw::table::CatalogT< RecordT >::begin ( )
inline

Iterator access.

See also
CatalogIterator

Definition at line 401 of file Catalog.h.

◆ begin() [2/2]

template<typename RecordT >
const_iterator lsst::afw::table::CatalogT< RecordT >::begin ( ) const
inline

Definition at line 403 of file Catalog.h.

◆ capacity()

template<typename RecordT >
size_type lsst::afw::table::CatalogT< RecordT >::capacity ( ) const
inline

Return the capacity of the catalog.

This is computed as the sum of the current size and the unallocated space in the table. It does not reflect the size of the internal vector, and hence cannot be used to judge when iterators may be invalidated.

Definition at line 425 of file Catalog.h.

◆ cbegin()

template<typename RecordT >
const_iterator lsst::afw::table::CatalogT< RecordT >::cbegin ( ) const
inline

Definition at line 405 of file Catalog.h.

◆ cend()

template<typename RecordT >
const_iterator lsst::afw::table::CatalogT< RecordT >::cend ( ) const
inline

Definition at line 406 of file Catalog.h.

◆ clear()

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::clear ( )
inline

Remove all records from the catalog.

Definition at line 579 of file Catalog.h.

◆ copy()

template<typename RecordT >
CatalogT lsst::afw::table::CatalogT< RecordT >::copy ( ) const
inline

Deep-copy the catalog using a cloned table.

Definition at line 500 of file Catalog.h.

◆ empty()

template<typename RecordT >
bool lsst::afw::table::CatalogT< RecordT >::empty ( ) const
inline

Return true if the catalog has no records.

Definition at line 410 of file Catalog.h.

◆ end() [1/2]

template<typename RecordT >
iterator lsst::afw::table::CatalogT< RecordT >::end ( )
inline

Definition at line 402 of file Catalog.h.

◆ end() [2/2]

template<typename RecordT >
const_iterator lsst::afw::table::CatalogT< RecordT >::end ( ) const
inline

Definition at line 404 of file Catalog.h.

◆ equal_range() [1/4]

template<typename RecordT >
template<typename T >
std::pair< iterator, iterator > lsst::afw::table::CatalogT< RecordT >::equal_range ( typename Field< T >::Value const &  value,
Key< T > const &  key 
)

◆ equal_range() [2/4]

template<typename RecordT >
template<typename T >
std::pair< typename CatalogT< RecordT >::iterator, typename CatalogT< RecordT >::iterator > lsst::afw::table::CatalogT< RecordT >::equal_range ( typename Field< T >::Value const &  value,
Key< T > const &  key 
)

Definition at line 850 of file Catalog.h.

◆ equal_range() [3/4]

template<typename RecordT >
template<typename T >
std::pair< const_iterator, const_iterator > lsst::afw::table::CatalogT< RecordT >::equal_range ( typename Field< T >::Value const &  value,
Key< T > const &  key 
) const

◆ equal_range() [4/4]

template<typename RecordT >
template<typename T >
std::pair< typename CatalogT< RecordT >::const_iterator, typename CatalogT< RecordT >::const_iterator > lsst::afw::table::CatalogT< RecordT >::equal_range ( typename Field< T >::Value const &  value,
Key< T > const &  key 
) const

Definition at line 862 of file Catalog.h.

◆ erase() [1/2]

template<typename RecordT >
iterator lsst::afw::table::CatalogT< RecordT >::erase ( iterator  first,
iterator  last 
)
inline

Erase the records in the range [first, last).

Definition at line 568 of file Catalog.h.

◆ erase() [2/2]

template<typename RecordT >
iterator lsst::afw::table::CatalogT< RecordT >::erase ( iterator  pos)
inline

Erase the record pointed to by pos, and return an iterator the next record.

Definition at line 565 of file Catalog.h.

◆ find() [1/2]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::iterator lsst::afw::table::CatalogT< RecordT >::find ( typename Field< T >::Value const &  value,
Key< T > const &  key 
)

Return an iterator to the record with the given value.

When the field being searched is not unique, which matching record will be returned is not defined. In these cases, lower_bound, upper_bound, or equal_range should be used instead.

In Python, this method returns a Record, not an iterator.

Note
The catalog must be sorted in ascending order according to the given key before calling find (i.e. isSorted(key) must be true) for maximal efficiency. If the value searched for is not found, it assumes that the catalog is unsorted and performs a brute-force search instead of failing immediately.

Returns end() if the Record cannot be found.

Definition at line 763 of file Catalog.h.

◆ find() [2/2]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::const_iterator lsst::afw::table::CatalogT< RecordT >::find ( typename Field< T >::Value const &  value,
Key< T > const &  key 
) const

Definition at line 784 of file Catalog.h.

◆ front()

template<typename RecordT >
reference lsst::afw::table::CatalogT< RecordT >::front ( ) const
inline

Return the first record.

Definition at line 458 of file Catalog.h.

◆ get()

template<typename RecordT >
std::shared_ptr< RecordT > const lsst::afw::table::CatalogT< RecordT >::get ( size_type  i) const
inline

Return a pointer to the record at index i.

Definition at line 464 of file Catalog.h.

◆ getColumnView()

template<typename RecordT >
ColumnView lsst::afw::table::CatalogT< RecordT >::getColumnView ( ) const
inline

Return a ColumnView of this catalog's records.

Will throw RuntimeError if records are not contiguous.

Definition at line 382 of file Catalog.h.

◆ getInternal() [1/2]

template<typename RecordT >
Internal & lsst::afw::table::CatalogT< RecordT >::getInternal ( )
inline

Return a reference to the internal vector-of-shared_ptr.

While in most cases it is more convenient to use the Catalog's iterators, which dereference directly to Record objects (and hence allow iter->method() rather than (**iter).method()), direct access to the underlying vector-of-shared_ptr is provided here to allow complete use of the C++ STL. In particular, in order to use a mutating STL algorithm on a Catalog in such a way that Records are shallow-copied (i.e. shared_ptr::operator= is invoked instead of Record::operator=), those algorithms should be called on the iterators of these internal containers. When an algorithm should be called in such a way that records are deep-copied, the regular Catalog iterators should be used.

Definition at line 676 of file Catalog.h.

◆ getInternal() [2/2]

template<typename RecordT >
Internal const & lsst::afw::table::CatalogT< RecordT >::getInternal ( ) const
inline

Definition at line 677 of file Catalog.h.

◆ getSchema()

template<typename RecordT >
Schema lsst::afw::table::CatalogT< RecordT >::getSchema ( ) const
inline

Return the schema associated with the catalog's table.

Definition at line 118 of file Catalog.h.

◆ getTable()

template<typename RecordT >
std::shared_ptr< Table > lsst::afw::table::CatalogT< RecordT >::getTable ( ) const
inline

Return the table associated with the catalog.

Definition at line 115 of file Catalog.h.

◆ insert() [1/4]

template<typename RecordT >
template<typename InputIterator >
void lsst::afw::table::CatalogT< RecordT >::insert ( iterator  pos,
InputIterator  first,
InputIterator  last,
bool  deep = false 
)
inline

Insert an iterator range into the table.

InputIterator must dereference to a record reference that is convertible to the record type held by the catalog, and must be implicitly convertible to a shared_ptr to a record.

If deep is true, new records will be created by calling copyRecord on the catalog's table. If deep is false, the new records will not be copied, but they must have been created with the catalog's table (note that a table may be shared by multiple catalogs).

If InputIterator models RandomAccessIterator (according to std::iterator_traits) and deep is true, table->preallocate will be used to ensure that the resulting records are contiguous in memory and can be used with ColumnView. To ensure this is the case for other iterator types, the user must preallocate the table manually.

Definition at line 518 of file Catalog.h.

◆ insert() [2/4]

template<typename RecordT >
iterator lsst::afw::table::CatalogT< RecordT >::insert ( iterator  pos,
Record const &  r 
)
inline

Insert a copy of the given record at the given position.

Definition at line 554 of file Catalog.h.

◆ insert() [3/4]

template<typename RecordT >
iterator lsst::afw::table::CatalogT< RecordT >::insert ( iterator  pos,
std::shared_ptr< RecordT > const &  p 
)
inline

Insert the given record at the given position without copying.

Definition at line 560 of file Catalog.h.

◆ insert() [4/4]

template<typename RecordT >
template<typename InputIterator >
void lsst::afw::table::CatalogT< RecordT >::insert ( SchemaMapper const &  mapper,
iterator  pos,
InputIterator  first,
InputIterator  last 
)
inline

Insert a range of records into the catalog by copying them with a SchemaMapper.

Definition at line 539 of file Catalog.h.

◆ isContiguous()

template<typename RecordT >
bool lsst::afw::table::CatalogT< RecordT >::isContiguous ( ) const
inline

Return true if all records are contiguous.

Definition at line 393 of file Catalog.h.

◆ isSorted() [1/2]

template<typename RecordT >
template<typename Compare >
bool lsst::afw::table::CatalogT< RecordT >::isSorted ( Compare  cmp) const

Return true if the catalog is in ascending order according to the given predicate.

cmp(a, b) should return true if record a is less than record b, and false otherwise.

TODO: C++11 has an is_sorted function we should use when available.

Definition at line 726 of file Catalog.h.

◆ isSorted() [2/2]

template<typename RecordT >
template<typename T >
bool lsst::afw::table::CatalogT< RecordT >::isSorted ( Key< T > const &  key) const

Return true if the catalog is in ascending order according to the given key.

Definition at line 749 of file Catalog.h.

◆ lower_bound() [1/2]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::iterator lsst::afw::table::CatalogT< RecordT >::lower_bound ( typename Field< T >::Value const &  value,
Key< T > const &  key 
)

Performed binary searches on sorted fields.

These methods perform binary searches analogous to the STL algorithms of the same name; they simply create a comparison functor using the given value and Key.

In Python, the lower_bound and upper_bound methods return the position of the result record in the catalog, and equal_range returns a Python slice object that defines the range.

Note
The catalog must be sorted in ascending order according to the given key before calling any of the search methods (i.e. isSorted(key) must be true).

Definition at line 805 of file Catalog.h.

◆ lower_bound() [2/2]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::const_iterator lsst::afw::table::CatalogT< RecordT >::lower_bound ( typename Field< T >::Value const &  value,
Key< T > const &  key 
) const

Definition at line 816 of file Catalog.h.

◆ max_size()

template<typename RecordT >
size_type lsst::afw::table::CatalogT< RecordT >::max_size ( ) const
inline

Return the maximum number of elements allowed in a catalog.

Definition at line 416 of file Catalog.h.

◆ operator=() [1/2]

template<typename RecordT >
CatalogT & lsst::afw::table::CatalogT< RecordT >::operator= ( CatalogT< RecordT > &&  other)
inline

Definition at line 178 of file Catalog.h.

◆ operator=() [2/2]

template<typename RecordT >
CatalogT & lsst::afw::table::CatalogT< RecordT >::operator= ( CatalogT< RecordT > const &  other)
inline

Shallow assigment.

Definition at line 170 of file Catalog.h.

◆ operator[]()

template<typename RecordT >
reference lsst::afw::table::CatalogT< RecordT >::operator[] ( size_type  i) const
inline

Return the record at index i.

Definition at line 452 of file Catalog.h.

◆ pop_back()

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::pop_back ( )
inline

Remove the last record in the catalog.

Definition at line 497 of file Catalog.h.

◆ push_back() [1/2]

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::push_back ( Record const &  r)
inline

Add a copy of the given record to the end of the catalog.

Definition at line 481 of file Catalog.h.

◆ push_back() [2/2]

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::push_back ( std::shared_ptr< RecordT > const &  p)
inline

Add the given record to the end of the catalog without copying.

Definition at line 487 of file Catalog.h.

◆ readFits() [1/3]

template<typename RecordT >
static CatalogT lsst::afw::table::CatalogT< RecordT >::readFits ( fits::Fits fitsfile,
int  flags = 0 
)
inlinestatic

Read a FITS binary table from a file object already at the correct extension.

Parameters
[in]fitsfileFits file object to read from.
[in]flagsTable-subclass-dependent bitflags that control the details of how to read the catalog. See e.g. SourceFitsFlags.

Definition at line 373 of file Catalog.h.

◆ readFits() [2/3]

template<typename RecordT >
static CatalogT lsst::afw::table::CatalogT< RecordT >::readFits ( fits::MemFileManager manager,
int  hdu = fits::DEFAULT_HDU,
int  flags = 0 
)
inlinestatic

Read a FITS binary table from a RAM file.

Parameters
[in]managerObject that manages the memory to be read.
[in]hduNumber of the "header-data unit" to read (where 0 is the Primary HDU). The default value of afw::fits::DEFAULT_HDU is interpreted as "the first HDU with NAXIS != 0".
[in]flagsTable-subclass-dependent bitflags that control the details of how to read the catalog. See e.g. SourceFitsFlags.

Definition at line 362 of file Catalog.h.

◆ readFits() [3/3]

template<typename RecordT >
static CatalogT lsst::afw::table::CatalogT< RecordT >::readFits ( std::string const &  filename,
int  hdu = fits::DEFAULT_HDU,
int  flags = 0 
)
inlinestatic

Read a FITS binary table from a regular file.

Parameters
[in]filenameName of the file to read.
[in]hduNumber of the "header-data unit" to read (where 0 is the Primary HDU). The default value of afw::fits::DEFAULT_HDU is interpreted as "the first HDU with NAXIS != 0".
[in]flagsTable-subclass-dependent bitflags that control the details of how to read the catalog. See e.g. SourceFitsFlags.

Definition at line 348 of file Catalog.h.

◆ reserve()

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::reserve ( size_type  n)
inline

Increase the capacity of the catalog to the given size.

This can be used to guarantee that the catalog will be contiguous, but it only affects records constructed after reserve().

Definition at line 433 of file Catalog.h.

◆ resize()

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::resize ( size_type  n)
inline

Change the size of the catalog, removing or adding empty records as needed.

Definition at line 440 of file Catalog.h.

◆ set()

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::set ( size_type  i,
std::shared_ptr< RecordT > const &  p 
)
inline

Set the record at index i to a pointer.

Definition at line 467 of file Catalog.h.

◆ size()

template<typename RecordT >
size_type lsst::afw::table::CatalogT< RecordT >::size ( ) const
inline

Return the number of elements in the catalog.

Definition at line 413 of file Catalog.h.

◆ sort() [1/2]

template<typename RecordT >
template<typename Compare >
void lsst::afw::table::CatalogT< RecordT >::sort ( Compare  cmp)

Sort the catalog in-place by the field with the given predicate.

cmp(a, b) should return true if record a is less than record b, and false otherwise.

Definition at line 742 of file Catalog.h.

◆ sort() [2/2]

template<typename RecordT >
template<typename T >
void lsst::afw::table::CatalogT< RecordT >::sort ( Key< T > const &  key)

Sort the catalog in-place by the field with the given key.

Definition at line 756 of file Catalog.h.

◆ subset() [1/2]

template<typename RecordT >
CatalogT< RecordT > lsst::afw::table::CatalogT< RecordT >::subset ( ndarray::Array< bool const, 1 > const &  mask) const
inline

Return the subset of a catalog corresponding to the True values of the given mask array.

The returned array's records are shallow copies, and hence will not in general be contiguous.

Definition at line 185 of file Catalog.h.

◆ subset() [2/2]

template<typename RecordT >
CatalogT< RecordT > lsst::afw::table::CatalogT< RecordT >::subset ( std::ptrdiff_t  startd,
std::ptrdiff_t  stopd,
std::ptrdiff_t  step 
) const
inline

Returns a shallow copy of a subset of this Catalog.

The arguments correspond to python's slice() syntax.

Definition at line 206 of file Catalog.h.

◆ swap()

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::swap ( CatalogT< RecordT > &  other)
inlinenoexcept

Shallow swap of two catalogs.

Definition at line 573 of file Catalog.h.

◆ upper_bound() [1/2]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::iterator lsst::afw::table::CatalogT< RecordT >::upper_bound ( typename Field< T >::Value const &  value,
Key< T > const &  key 
)

Definition at line 827 of file Catalog.h.

◆ upper_bound() [2/2]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::const_iterator lsst::afw::table::CatalogT< RecordT >::upper_bound ( typename Field< T >::Value const &  value,
Key< T > const &  key 
) const

Definition at line 838 of file Catalog.h.

◆ writeFits() [1/3]

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::writeFits ( fits::Fits fitsfile,
int  flags = 0 
) const
inline

Write a FITS binary table to an open file object.

Parameters
[in,out]fitsfileFits file object to write to.
[in]flagsTable-subclass-dependent bitflags that control the details of how to read the catalogs. See e.g. SourceFitsFlags.

Definition at line 334 of file Catalog.h.

◆ writeFits() [2/3]

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::writeFits ( fits::MemFileManager manager,
std::string const &  mode = "w",
int  flags = 0 
) const
inline

Write a FITS binary table to a RAM file.

Parameters
[in,out]managerObject that manages the memory to write to.
[in]mode"a" to append a new HDU, "w" to overwrite any existing file.
[in]flagsTable-subclass-dependent bitflags that control the details of how to read the catalogs. See e.g. SourceFitsFlags.

Definition at line 323 of file Catalog.h.

◆ writeFits() [3/3]

template<typename RecordT >
void lsst::afw::table::CatalogT< RecordT >::writeFits ( std::string const &  filename,
std::string const &  mode = "w",
int  flags = 0 
) const
inline

Write a FITS binary table to a regular file.

Parameters
[in]filenameName of the file to write.
[in]mode"a" to append a new HDU, "w" to overwrite any existing file.
[in]flagsTable-subclass-dependent bitflags that control the details of how to read the catalogs. See e.g. SourceFitsFlags.

Definition at line 311 of file Catalog.h.


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