2 #ifndef AFW_TABLE_BaseRecord_h_INCLUDED
3 #define AFW_TABLE_BaseRecord_h_INCLUDED
97 "Key is not valid (if this is a SourceRecord, make sure slot aliases have been set up).");
99 return reinterpret_cast<typename
Field<T>::Element*
>(
reinterpret_cast<char*
>(_data) +
110 template <
typename T>
115 "Key is not valid (if this is a SourceRecord, make sure slot aliases have been set up).");
117 return reinterpret_cast<typename
Field<T>::Element const*
>(
reinterpret_cast<char const*
>(_data) +
128 template <
typename T>
140 template <
typename T>
150 template <
typename T>
163 template <
typename T,
typename U>
171 template <
typename T>
173 return key.
get(*
this);
179 template <
typename T,
typename U>
181 return key.
set(*
this, value);
184 template <
typename Ref>
189 template <
typename ConstRef>
200 ndarray::Manager::Ptr
getManager()
const {
return _manager; }
223 ndarray::Manager::Ptr _manager;
226 template <
typename RecordT,
typename ...Args>
229 std::forward<Args>(
args)...);
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Column-wise view into a sequence of records that have been allocated contiguously.
Base class for all records.
Ref operator[](ReferenceFunctorKey< Ref > const &key)
BaseRecord & operator=(BaseRecord &&)=delete
Field< T >::Element const * getElement(Key< T > const &key) const
Return a pointer to the underlying elements of a field (const).
void assign(BaseRecord const &other)
Copy all field values from other to this, requiring that they have equal schemas.
ConstRef operator[](ConstReferenceFunctorKey< ConstRef > const &key) const
BaseRecord & operator=(const BaseRecord &)=delete
friend std::ostream & operator<<(std::ostream &os, BaseRecord const &record)
Write the record's content out, one field on each line.
BaseRecord(BaseRecord &&)=delete
Field< T >::Reference operator[](Key< T > const &key)
Return a reference (or reference-like type) to the field's value.
Schema getSchema() const
Return the Schema that holds this record's fields and keys.
Field< T >::ConstReference operator[](Key< T > const &key) const
Return a const reference (or const-reference-like type) to the field's value.
ndarray::Manager::Ptr getManager() const
void set(InputFunctorKey< T > const &key, U const &value)
Set a calculated or aggregate field.
BaseRecord(const BaseRecord &)=delete
friend class BaseColumnView
Field< T >::Element * getElement(Key< T > const &key)
Return a pointer to the underlying elements of a field (non-const).
BaseRecord(ConstructionToken const &, detail::RecordData &&data)
Construct a record with uninitialized data.
void set(Key< T > const &key, U const &value)
Set value of a field for the given key.
Field< T >::Value get(Key< T > const &key) const
Return the value of a field for the given key.
T get(OutputFunctorKey< T > const &key) const
Compute a calculated or aggregate field.
virtual void _assign(BaseRecord const &other)
Called by assign() after transferring fields to allow subclass data members to be copied.
virtual void _stream(std::ostream &os) const
Called by operator<<.
std::shared_ptr< BaseTable const > getTable() const
Return the table this record is associated with.
Base class for all tables.
std::shared_ptr< RecordT > constructRecord(Args &&...args)
Helper function that must be used by all _makeRecord overrides to actually construct records.
Base class for objects that can return a const reference to part of a record, but are not a true Key.
virtual T getConstReference(BaseRecord const &record) const =0
A class used as a handle to a particular field in a table.
std::size_t getOffset() const noexcept
Return the offset (in bytes) of this field within a record.
bool isValid() const noexcept
Return true if the key was initialized to valid offset.
Base class for objects that can extract a value from a record, but are not a true Key themselves.
virtual T get(BaseRecord const &record) const =0
Base class for objects that can return a non-const reference to part of a record, but are not a true ...
virtual T getReference(BaseRecord &record) const =0
Defines the fields and offsets for a table.
A mapping between the keys of two Schemas, used to copy data between them.
Reports errors in the logical structure of the program.
A base class for image defects.
const T & ConstReference
the type returned by BaseRecord::operator[] (const)
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement BaseRecord::operator[] (const).
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement BaseRecord::get.
T & Reference
the type returned by BaseRecord::operator[] (non-const)
void setValue(Element *p, ndarray::Manager::Ptr const &, Value v) const
Used to implement BaseRecord::set.
Reference getReference(Element *p, ndarray::Manager::Ptr const &) const
Used to implement BaseRecord::operator[] (non-const).
T Value
the type returned by BaseRecord::get
typename FieldBase< T >::Element Element
Type used to store field data in the table (a field may have multiple elements).
Helper struct that contains the information passed from BaseTable to BaseRecord at construction.