Class BaseRecord

Nested Relationships

Inheritance Relationships

Derived Types

Class Documentation

class BaseRecord

Base class for all records.

BaseRecord is a polymorphic base class that provides the core record interface: access to fields and links back to the table it is associated with. Field access is provided by the templated get, set, and operator[] member functions. As templates they are nonvirtual and cannot be overridden by subclasses. The implementations for these accessors is in the FieldBase template specializations.

Each subclass of BaseRecord should be paired with a subclass of BaseTable. All record creation goes through a table, as the table allocates the memory used to store a record’s fields and holds the Schema instance that defines those fields.

Records are noncopyable, and are hence usually passed by shared_ptr or [const-]reference.

Subclassed by lsst::afw::detection::PeakRecord, lsst::afw::table::ExposureRecord, lsst::afw::table::SimpleRecord

Public Types

typedef BaseTable Table

The associated table class.

typedef BaseColumnView ColumnView

The associated ColumnView class.

typedef CatalogT<BaseRecord> Catalog

Template of CatalogT used to hold records of this type.

typedef CatalogT<BaseRecord const> ConstCatalog

Template of CatalogT used to hold const records of this type.

Public Functions

BaseRecord(ConstructionToken const&, detail::RecordData &&data)

Construct a record with uninitialized data.

Access to this constructor is restricted to BaseTable and BaseRecord subclasses via the ConstructionToken argument, which can only be constructed by BaseTable. This constructor is public so it can still be called by std::make_shared code with access to ConstructionToken.

BaseRecord(const BaseRecord&)
BaseRecord &operator=(const BaseRecord&)
BaseRecord(BaseRecord&&)
BaseRecord &operator=(BaseRecord&&)
Schema getSchema() const

Return the Schema that holds this record’s fields and keys.

std::shared_ptr<BaseTable const> getTable() const

Return the table this record is associated with.

template<typename T>
Field<T>::Element *getElement(Key<T> const &key)

Return a pointer to the underlying elements of a field (non-const).

This low-level access is intended mostly for use with serialization; users should generally prefer the safer get(), set() and operator[] member functions.

template<typename T>
Field<T>::Element const *getElement(Key<T> const &key) const

Return a pointer to the underlying elements of a field (const).

This low-level access is intended mostly for use with serialization; users should generally prefer the safer get(), set() and operator[] member functions.

template<typename T>
Field<T>::Reference operator[](Key<T> const &key)

Return a reference (or reference-like type) to the field’s value.

Some field types (Point, Moments, Flag, Covariance, and SpherePoint) do not support reference access.

No checking is done to ensure the Key belongs to the correct schema.

template<typename T>
Field<T>::ConstReference operator[](Key<T> const &key) const

Return a const reference (or const-reference-like type) to the field’s value.

Some field types (Point, Moments, Flag, Covariance, and SpherePoint) do not support reference access.

No checking is done to ensure the Key belongs to the correct schema.

template<typename T>
Field<T>::Value get(Key<T> const &key) const

Return the value of a field for the given key.

No checking is done to ensure the Key belongs to the correct schema.

template<typename T, typename U>
void set(Key<T> const &key, U const &value)

Set value of a field for the given key.

This method has an additional template parameter because some fields accept and convert different types to the stored field type.

No checking is done to ensure the Key belongs to the correct schema.

template<typename T>
T get(OutputFunctorKey<T> const &key) const

Compute a calculated or aggregate field.

template<typename T, typename U>
void set(InputFunctorKey<T> const &key, U const &value)

Set a calculated or aggregate field.

template<typename Ref>
Ref operator[](ReferenceFunctorKey<Ref> const &key)
template<typename ConstRef>
ConstRef operator[](ConstReferenceFunctorKey<ConstRef> const &key) const
void assign(BaseRecord const &other)

Copy all field values from other to this, requiring that they have equal schemas.

void assign(BaseRecord const &other, SchemaMapper const &mapper)

Copy field values from other to this, using a mapper.

ndarray::Manager::Ptr getManager() const
virtual ~BaseRecord()

Protected Functions

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<<. Overrides should call the base class implementation and append additional fields on new lines, with the syntax “%(name)s: %(value)s”.

Friends

std::ostream &operator<<(std::ostream &os, BaseRecord const &record)

Write the record’s content out, one field on each line.