Class BaseColumnView

Inheritance Relationships

Derived Type

Class Documentation

class BaseColumnView

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.

Subclassed by lsst::afw::table::ColumnViewT< RecordT >

Public Functions

std::shared_ptr<BaseTable> getTable() const

Return the table that owns the records.

Schema getSchema() const

Return the schema that defines the fields.

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

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.

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.

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.

BitsColumn 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::LengthError: if keys.size() > 64

BitsColumn 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::LengthError: if the schema has more than 64 Flag fields.

BaseColumnView(BaseColumnView const&)
BaseColumnView(BaseColumnView&&)
BaseColumnView &operator=(BaseColumnView const&)
BaseColumnView &operator=(BaseColumnView&&)
~BaseColumnView()

Public Static Functions

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

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.

template<typename InputIterator>
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.

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

Protected Functions

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