lsst.afw  21.0.0-34-g13549a6f6+8935f19055
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
lsst::afw::table::BaseColumnView Class Reference

Column-wise view into a sequence of records that have been allocated contiguously. More...

#include <BaseColumnView.h>

Inheritance diagram for lsst::afw::table::BaseColumnView:
lsst::afw::table::ColumnViewT< RecordT > lsst::afw::table::SourceColumnViewT< RecordT >

Classes

struct  Impl
 

Public Member Functions

std::shared_ptr< BaseTablegetTable () const
 Return the table that owns the records. More...
 
Schema getSchema () const
 Return the schema that defines the fields. More...
 
template<typename T >
ndarray::ArrayRef< T, 1 > const operator[] (Key< T > const &key) const
 Return a 1-d array corresponding to a scalar field (or subfield). More...
 
template<typename T >
ndarray::ArrayRef< T, 2, 1 > const operator[] (Key< Array< T > > const &key) const
 Return a 2-d array corresponding to an array field. More...
 
ndarray::result_of::vectorize< detail::FlagExtractor, ndarray::Array< Field< Flag >::Element const, 1 > >::type operator[] (Key< Flag > const &key) const
 Return a 1-d array expression corresponding to a flag bit. More...
 
BitsColumn getBits (std::vector< Key< Flag > > const &keys) const
 Return an integer array with the given Flag fields repacked into individual bits. More...
 
BitsColumn getAllBits () const
 Return an integer array with all Flag fields repacked into individual bits. More...
 
 BaseColumnView (BaseColumnView const &)
 
 BaseColumnView (BaseColumnView &&)
 
BaseColumnViewoperator= (BaseColumnView const &)
 
BaseColumnViewoperator= (BaseColumnView &&)
 
 ~BaseColumnView ()
 

Static Public Member Functions

template<typename InputIterator >
static BaseColumnView make (std::shared_ptr< BaseTable > const &table, InputIterator first, InputIterator last)
 Construct a BaseColumnView from an iterator range. More...
 
template<typename InputIterator >
static bool isRangeContiguous (std::shared_ptr< BaseTable > const &table, InputIterator first, InputIterator last)
 Return true if the given record iterator range is continuous and the records all belong to the given table. More...
 

Protected Member Functions

 BaseColumnView (std::shared_ptr< BaseTable > const &table, int recordCount, void *buf, ndarray::Manager::Ptr const &manager)
 

Friends

class BaseTable
 

Detailed Description

Column-wise view into a sequence of records that have been allocated contiguously.

A BaseColumnView can be created from any iterator range that dereferences to records, as long as those records' field data is contiguous in memory. In practice, that means they must have been created from the same table, and be in the same order they were created (with no deletions). It also requires that those records be allocated in the same block, which can be guaranteed with BaseTable::preallocate().

Geometric (point and shape) fields cannot be accessed through a BaseColumnView, but their scalar components can be.

BaseColumnView and its subclasses are always non-const views into a catalog, and so cannot be obtained from a catalog-of-const (trying this results in an exception, not a compilation error). As a result, all its accessors return arrays of non-const elements, even though they are themselves const member functions. This is no different from a shared_ptr<T>'s get() member function returning a non-const T*, even though get() is a const member function.

Definition at line 83 of file BaseColumnView.h.

Constructor & Destructor Documentation

◆ BaseColumnView() [1/3]

lsst::afw::table::BaseColumnView::BaseColumnView ( BaseColumnView const &  )
default

◆ BaseColumnView() [2/3]

lsst::afw::table::BaseColumnView::BaseColumnView ( BaseColumnView &&  )
default

◆ ~BaseColumnView()

lsst::afw::table::BaseColumnView::~BaseColumnView ( )
default

◆ BaseColumnView() [3/3]

lsst::afw::table::BaseColumnView::BaseColumnView ( std::shared_ptr< BaseTable > const &  table,
int  recordCount,
void *  buf,
ndarray::Manager::Ptr const &  manager 
)
protected

Definition at line 173 of file BaseColumnView.cc.

Member Function Documentation

◆ getAllBits()

BitsColumn lsst::afw::table::BaseColumnView::getAllBits ( ) const

Return an integer array with all Flag fields repacked into individual bits.

The returned object contains both the int64 array and accessors to obtain a mask given a Key or field name.

Exceptions
pex::exceptions::LengthErrorif the schema has more than 64 Flag fields.

Definition at line 147 of file BaseColumnView.cc.

◆ getBits()

BitsColumn lsst::afw::table::BaseColumnView::getBits ( std::vector< Key< Flag > > const &  keys) const

Return an integer array with the given Flag fields repacked into individual bits.

The returned object contains both the int64 array and accessors to obtain a mask given a Key or field name.

Exceptions
pex::exceptions::LengthErrorif keys.size() > 64

Definition at line 117 of file BaseColumnView.cc.

◆ getSchema()

Schema lsst::afw::table::BaseColumnView::getSchema ( ) const
inline

Return the schema that defines the fields.

Definition at line 89 of file BaseColumnView.h.

◆ getTable()

std::shared_ptr< BaseTable > lsst::afw::table::BaseColumnView::getTable ( ) const

Return the table that owns the records.

Definition at line 68 of file BaseColumnView.cc.

◆ isRangeContiguous()

template<typename InputIterator >
bool lsst::afw::table::BaseColumnView::isRangeContiguous ( std::shared_ptr< BaseTable > const &  table,
InputIterator  first,
InputIterator  last 
)
static

Return true if the given record iterator range is continuous and the records all belong to the given table.

This tests exactly the same requiremetns needed to construct a column view, so if this test succeeds, BaseColumnView::make should as well.

Definition at line 218 of file BaseColumnView.h.

◆ make()

template<typename InputIterator >
BaseColumnView lsst::afw::table::BaseColumnView::make ( std::shared_ptr< BaseTable > const &  table,
InputIterator  first,
InputIterator  last 
)
static

Construct a BaseColumnView from an iterator range.

The iterators must dereference to a reference or const reference to a record. If the record data is not contiguous in memory, throws lsst::pex::exceptions::RuntimeError.

Definition at line 197 of file BaseColumnView.h.

◆ operator=() [1/2]

BaseColumnView & lsst::afw::table::BaseColumnView::operator= ( BaseColumnView &&  )
default

◆ operator=() [2/2]

BaseColumnView & lsst::afw::table::BaseColumnView::operator= ( BaseColumnView const &  )
default

◆ operator[]() [1/3]

template<typename T >
ndarray::ArrayRef< T, 2, 1 > const lsst::afw::table::BaseColumnView::operator[] ( Key< Array< T > > const &  key) const

Return a 2-d array corresponding to an array field.

Definition at line 84 of file BaseColumnView.cc.

◆ operator[]() [2/3]

ndarray::result_of::vectorize< detail::FlagExtractor, ndarray::Array< Field< Flag >::Element const, 1 > >::type lsst::afw::table::BaseColumnView::operator[] ( Key< Flag > const &  key) const

Return a 1-d array expression corresponding to a flag bit.

In C++, the return value is a lazy ndarray expression template that performs the bitwise & operation on every element when that element is requested. In Python, the result will be copied into a bool NumPy array.

Definition at line 101 of file BaseColumnView.cc.

◆ operator[]() [3/3]

template<typename T >
ndarray::ArrayRef< T, 1 > const lsst::afw::table::BaseColumnView::operator[] ( Key< T > const &  key) const

Return a 1-d array corresponding to a scalar field (or subfield).

Definition at line 71 of file BaseColumnView.cc.

Friends And Related Function Documentation

◆ BaseTable

friend class BaseTable
friend

Definition at line 162 of file BaseColumnView.h.


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