lsst.afw  22.0.0-22-gf1d71818e+649249edd3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
lsst::afw::table::SortedCatalogT< RecordT > Class Template Reference

Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID. More...

#include <SortedCatalog.h>

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

Public Types

typedef RecordT Record
 
typedef Record::Table Table
 
typedef Base::iterator iterator
 
typedef Base::const_iterator const_iterator
 
typedef Record::ColumnView ColumnView
 
typedef RecordT value_type
 
typedef RecordT & reference
 
typedef std::shared_ptr< RecordT > pointer
 
typedef Internal::size_type size_type
 
typedef Internal::difference_type difference_type
 

Public Member Functions

 SortedCatalogT (SortedCatalogT const &)=default
 
 SortedCatalogT (SortedCatalogT &&)=default
 
SortedCatalogToperator= (SortedCatalogT const &)=default
 
SortedCatalogToperator= (SortedCatalogT &&)=default
 
 ~SortedCatalogT ()=default
 
bool isSorted () const
 Return true if the vector is in ascending ID order. More...
 
void sort ()
 Sort the vector in-place by ID. More...
 
iterator find (RecordId id)
 Return an iterator to the record with the given ID. More...
 
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). More...
 
 SortedCatalogT (Schema const &schema)
 Construct a vector from a schema, creating a table with Table::make(schema). More...
 
template<typename InputIterator >
 SortedCatalogT (std::shared_ptr< Table > const &table, InputIterator first, InputIterator last, bool deep=false)
 Construct a vector from a table and an iterator range. More...
 
template<typename OtherRecordT >
 SortedCatalogT (SortedCatalogT< OtherRecordT > const &other)
 Shallow copy constructor from a container containing a related record type. More...
 
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. More...
 
SortedCatalogT subset (std::ptrdiff_t startd, std::ptrdiff_t stopd, std::ptrdiff_t step) const
 Shallow copy a subset of another SortedCatalog. 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
 
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...
 
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...
 
const_iterator begin () const
 
iterator end ()
 
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 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
 
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
 
InternalgetInternal ()
 Return a reference to the internal vector-of-shared_ptr. More...
 
Internal const & getInternal () const
 

Static Public Member Functions

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

Protected Member Functions

 SortedCatalogT (Base const &other)
 

Detailed Description

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

Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.

For a record/table pair to be used with SortedCatalogT, the table class must provide a static getIdKey() member function that returns the key to the ID field.

Definition at line 42 of file SortedCatalog.h.

Member Typedef Documentation

◆ ColumnView

template<typename RecordT >
typedef Record::ColumnView lsst::afw::table::CatalogT< RecordT >::ColumnView
inherited

Definition at line 104 of file Catalog.h.

◆ const_iterator

template<typename RecordT >
typedef Base::const_iterator lsst::afw::table::SortedCatalogT< RecordT >::const_iterator

Definition at line 50 of file SortedCatalog.h.

◆ difference_type

template<typename RecordT >
typedef Internal::difference_type lsst::afw::table::CatalogT< RecordT >::difference_type
inherited

Definition at line 110 of file Catalog.h.

◆ iterator

template<typename RecordT >
typedef Base::iterator lsst::afw::table::SortedCatalogT< RecordT >::iterator

Definition at line 49 of file SortedCatalog.h.

◆ pointer

template<typename RecordT >
typedef std::shared_ptr<RecordT> lsst::afw::table::CatalogT< RecordT >::pointer
inherited

Definition at line 108 of file Catalog.h.

◆ Record

template<typename RecordT >
typedef RecordT lsst::afw::table::SortedCatalogT< RecordT >::Record

Definition at line 46 of file SortedCatalog.h.

◆ reference

template<typename RecordT >
typedef RecordT& lsst::afw::table::CatalogT< RecordT >::reference
inherited

Definition at line 107 of file Catalog.h.

◆ size_type

template<typename RecordT >
typedef Internal::size_type lsst::afw::table::CatalogT< RecordT >::size_type
inherited

Definition at line 109 of file Catalog.h.

◆ Table

template<typename RecordT >
typedef Record::Table lsst::afw::table::SortedCatalogT< RecordT >::Table

Definition at line 47 of file SortedCatalog.h.

◆ value_type

template<typename RecordT >
typedef RecordT lsst::afw::table::CatalogT< RecordT >::value_type
inherited

Definition at line 106 of file Catalog.h.

Constructor & Destructor Documentation

◆ SortedCatalogT() [1/7]

template<typename RecordT >
lsst::afw::table::SortedCatalogT< RecordT >::SortedCatalogT ( SortedCatalogT< RecordT > const &  )
default

◆ SortedCatalogT() [2/7]

template<typename RecordT >
lsst::afw::table::SortedCatalogT< RecordT >::SortedCatalogT ( SortedCatalogT< RecordT > &&  )
default

◆ ~SortedCatalogT()

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

◆ SortedCatalogT() [3/7]

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

Construct a vector from a table (or nothing).

A vector with no table is considered invalid; a valid table must be assigned to it before it can be used.

Definition at line 87 of file SortedCatalog.h.

◆ SortedCatalogT() [4/7]

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

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

Definition at line 90 of file SortedCatalog.h.

◆ SortedCatalogT() [5/7]

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

Construct a vector 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 103 of file SortedCatalog.h.

◆ SortedCatalogT() [6/7]

template<typename RecordT >
template<typename OtherRecordT >
lsst::afw::table::SortedCatalogT< RecordT >::SortedCatalogT ( SortedCatalogT< 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 114 of file SortedCatalog.h.

◆ SortedCatalogT() [7/7]

template<typename RecordT >
lsst::afw::table::SortedCatalogT< RecordT >::SortedCatalogT ( Base const &  other)
inlineexplicitprotected

Definition at line 174 of file SortedCatalog.h.

Member Function Documentation

◆ addNew()

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

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

Definition at line 486 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 
)
inlineinherited

Replace the contents of the table with an iterator range.

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

Definition at line 471 of file Catalog.h.

◆ at()

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

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

Definition at line 451 of file Catalog.h.

◆ back()

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

Return the last record.

Definition at line 457 of file Catalog.h.

◆ begin() [1/2]

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

Iterator access.

See also
CatalogIterator

Definition at line 397 of file Catalog.h.

◆ begin() [2/2]

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

Definition at line 399 of file Catalog.h.

◆ capacity()

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

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 421 of file Catalog.h.

◆ cbegin()

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

Definition at line 401 of file Catalog.h.

◆ cend()

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

Definition at line 402 of file Catalog.h.

◆ clear()

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

Remove all records from the catalog.

Definition at line 575 of file Catalog.h.

◆ copy()

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

Deep-copy the catalog using a cloned table.

Definition at line 496 of file Catalog.h.

◆ empty()

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

Return true if the catalog has no records.

Definition at line 406 of file Catalog.h.

◆ end() [1/2]

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

Definition at line 398 of file Catalog.h.

◆ end() [2/2]

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

Definition at line 400 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 
)
inherited

◆ 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 
)
inherited

Definition at line 846 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
inherited

◆ 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
inherited

Definition at line 858 of file Catalog.h.

◆ erase() [1/2]

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

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

Definition at line 564 of file Catalog.h.

◆ erase() [2/2]

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

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

Definition at line 561 of file Catalog.h.

◆ find() [1/6]

template<typename RecordT >
iterator lsst::afw::table::SortedCatalogT< RecordT >::find ( RecordId  id)
inline

Return an iterator to the record with the given ID.

Note
The vector must be sorted in ascending ID order before calling find (i.e. isSorted() must be true).

Returns end() if the Record cannot be found.

Definition at line 77 of file SortedCatalog.h.

◆ find() [2/6]

template<typename RecordT >
const_iterator lsst::afw::table::SortedCatalogT< RecordT >::find ( RecordId  id) const
inline

Definition at line 78 of file SortedCatalog.h.

◆ find() [3/6]

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 
)
inherited

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 759 of file Catalog.h.

◆ find() [4/6]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::iterator lsst::afw::table::CatalogT< RecordT >::find ( typename T  )

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 619 of file Catalog.h.

◆ find() [5/6]

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
inherited

Definition at line 780 of file Catalog.h.

◆ find() [6/6]

template<typename RecordT >
template<typename T >
CatalogT< RecordT >::const_iterator lsst::afw::table::CatalogT< RecordT >::find ( typename T  )

Definition at line 622 of file Catalog.h.

◆ front()

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

Return the first record.

Definition at line 454 of file Catalog.h.

◆ get()

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

Return a pointer to the record at index i.

Definition at line 460 of file Catalog.h.

◆ getColumnView()

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

Return a ColumnView of this catalog's records.

Will throw RuntimeError if records are not contiguous.

Definition at line 378 of file Catalog.h.

◆ getInternal() [1/2]

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

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 672 of file Catalog.h.

◆ getInternal() [2/2]

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

Definition at line 673 of file Catalog.h.

◆ getSchema()

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

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
inlineinherited

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 
)
inlineinherited

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 514 of file Catalog.h.

◆ insert() [2/4]

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

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

Definition at line 550 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 
)
inlineinherited

Insert the given record at the given position without copying.

Definition at line 556 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 
)
inlineinherited

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

Definition at line 535 of file Catalog.h.

◆ isContiguous()

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

Return true if all records are contiguous.

Definition at line 389 of file Catalog.h.

◆ isSorted() [1/5]

template<typename RecordT >
bool lsst::afw::table::SortedCatalogT< RecordT >::isSorted ( ) const
inline

Return true if the vector is in ascending ID order.

Definition at line 63 of file SortedCatalog.h.

◆ isSorted() [2/5]

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

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 722 of file Catalog.h.

◆ isSorted() [3/5]

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

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 587 of file Catalog.h.

◆ isSorted() [4/5]

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

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

Definition at line 745 of file Catalog.h.

◆ isSorted() [5/5]

template<typename RecordT >
template<typename T >
bool lsst::afw::table::CatalogT< RecordT >::isSorted ( typename T  )

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

Definition at line 579 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 
)
inherited

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 801 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
inherited

Definition at line 812 of file Catalog.h.

◆ max_size()

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

Return the maximum number of elements allowed in a catalog.

Definition at line 412 of file Catalog.h.

◆ operator=() [1/2]

template<typename RecordT >
SortedCatalogT& lsst::afw::table::SortedCatalogT< RecordT >::operator= ( SortedCatalogT< RecordT > &&  )
default

◆ operator=() [2/2]

template<typename RecordT >
SortedCatalogT& lsst::afw::table::SortedCatalogT< RecordT >::operator= ( SortedCatalogT< RecordT > const &  )
default

◆ operator[]()

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

Return the record at index i.

Definition at line 448 of file Catalog.h.

◆ pop_back()

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

Remove the last record in the catalog.

Definition at line 493 of file Catalog.h.

◆ push_back() [1/2]

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

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

Definition at line 477 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)
inlineinherited

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

Definition at line 483 of file Catalog.h.

◆ readFits() [1/3]

template<typename RecordT >
static SortedCatalogT lsst::afw::table::SortedCatalogT< 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 152 of file SortedCatalog.h.

◆ readFits() [2/3]

template<typename RecordT >
static SortedCatalogT lsst::afw::table::SortedCatalogT< 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 140 of file SortedCatalog.h.

◆ readFits() [3/3]

template<typename RecordT >
static SortedCatalogT lsst::afw::table::SortedCatalogT< 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 126 of file SortedCatalog.h.

◆ reserve()

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

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 429 of file Catalog.h.

◆ resize()

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

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

Definition at line 436 of file Catalog.h.

◆ set()

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

Set the record at index i to a pointer.

Definition at line 463 of file Catalog.h.

◆ size()

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

Return the number of elements in the catalog.

Definition at line 409 of file Catalog.h.

◆ sort() [1/4]

template<typename RecordT >
void lsst::afw::table::SortedCatalogT< RecordT >::sort ( )
inline

Sort the vector in-place by ID.

Definition at line 66 of file SortedCatalog.h.

◆ sort() [2/4]

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

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 599 of file Catalog.h.

◆ sort() [3/4]

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

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

Definition at line 752 of file Catalog.h.

◆ sort() [4/4]

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

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

Definition at line 591 of file Catalog.h.

◆ subset() [1/2]

template<typename RecordT >
SortedCatalogT<RecordT> lsst::afw::table::SortedCatalogT< 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 161 of file SortedCatalog.h.

◆ subset() [2/2]

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

Shallow copy a subset of another SortedCatalog.

Mostly here for use from python.

Definition at line 169 of file SortedCatalog.h.

◆ swap()

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

Shallow swap of two catalogs.

Definition at line 569 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 
)
inherited

Definition at line 823 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
inherited

Definition at line 834 of file Catalog.h.

◆ writeFits() [1/3]

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

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 330 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
inlineinherited

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 319 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
inlineinherited

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 307 of file Catalog.h.


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