2 #ifndef AFW_TABLE_BaseColumnView_h_INCLUDED
3 #define AFW_TABLE_BaseColumnView_h_INCLUDED
46 ndarray::Array<IntT, 1, 1>
getArray()
const {
return _array; }
54 std::vector<SchemaItem<Flag> >
const&
getSchemaItems()
const {
return _items; }
61 ndarray::Array<IntT, 1, 1>
_array;
62 std::vector<SchemaItem<Flag> > _items;
86 std::shared_ptr<BaseTable>
getTable()
const;
106 ndarray::result_of::vectorize<detail::FlagExtractor, ndarray::Array<Field<Flag>::Element
const, 1> >::type
135 template <
typename InputIterator>
146 template <
typename InputIterator>
153 BaseColumnView(std::shared_ptr<BaseTable>
const& table,
int recordCount,
void* buf,
154 ndarray::Manager::Ptr
const& manager);
161 std::shared_ptr<Impl> _impl;
164 template <
typename RecordT>
168 typedef typename RecordT::Table
Table;
176 template <
typename InputIterator>
185 template <
typename InputIterator>
187 InputIterator last) {
193 std::size_t recordCount = 1;
194 void* buf = first->_data;
195 ndarray::Manager::Ptr manager = first->_manager;
196 char* expected =
reinterpret_cast<char*
>(buf) + recordSize;
197 for (++first; first != last; ++
first, ++recordCount, expected += recordSize) {
198 if (first->_data != expected || first->_manager != manager) {
199 throw LSST_EXCEPT(lsst::pex::exceptions::RuntimeError,
200 "Record data is not contiguous in memory.");
206 template <
typename InputIterator>
208 InputIterator last) {
209 if (first == last)
return true;
212 std::size_t recordCount = 1;
213 void* buf = first->_data;
214 ndarray::Manager::Ptr manager = first->_manager;
215 char* expected =
reinterpret_cast<char*
>(buf) + recordSize;
216 for (++first; first != last; ++
first, ++recordCount, expected += recordSize) {
217 if (first->_data != expected || first->_manager != manager) {
227 #endif // !AFW_TABLE_BaseColumnView_h_INCLUDED
Defines the fields and offsets for a table.
Schema getSchema() const
Return the schema that defines the fields.
BitsColumn getAllBits() const
Return an integer array with all Flag fields repacked into individual bits.
Column-wise view into a sequence of records that have been allocated contiguously.
A packed representation of a collection of Flag field columns.
std::vector< SchemaItem< Flag > > const & getSchemaItems() const
std::shared_ptr< Table > getTable() const
Return the table that owns the records.
static ColumnViewT make(std::shared_ptr< Table > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
IntT getMask(Key< Flag > const &key) const
ndarray::Array< IntT, 1, 1 > getArray() const
ColumnViewT(BaseColumnView const &base)
ndarray::ArrayRef< T, 1 > const operator[](Key< T > const &key) const
Return a 1-d array corresponding to a scalar field (or subfield).
BitsColumn getBits(std::vector< Key< Flag > > const &keys) const
Return an integer array with the given Flag fields repacked into individual bits. ...
static BaseColumnView make(std::shared_ptr< BaseTable > const &table, InputIterator first, InputIterator last)
Construct a BaseColumnView from an iterator range.
ndarray::Array< typename ImageT::Pixel, 2, 2 > & _array
int getRecordSize() const
Return the raw size of a record in bytes.
A description of a field in a table.
table::Key< std::string > name
Tag types used to declare specialized field types.
std::shared_ptr< BaseTable > getTable() const
Return the table that owns the records.
IntT getBit(Key< Flag > const &key) const
A class used as a handle to a particular field in a table.
BaseColumnView(std::shared_ptr< BaseTable > const &table, int recordCount, void *buf, ndarray::Manager::Ptr const &manager)
Key specialization for Flag.
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 ...
Base class for all tables.
afw::table::Schema schema
IntT getMask(std::string const &name) const