lsst.afw  14.0-60-ga423a1d65+2
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
lsst::afw::table::BaseRecord Class Reference

Base class for all records. More...

#include <BaseRecord.h>

Inheritance diagram for lsst::afw::table::BaseRecord:
lsst::daf::base::Citizen lsst::afw::detection::PeakRecord lsst::afw::table::AmpInfoRecord lsst::afw::table::ExposureRecord lsst::afw::table::SimpleRecord lsst::afw::table::SourceRecord

Public Types

typedef BaseTable Table
 The associated table class. More...
 
typedef BaseColumnView ColumnView
 The associated ColumnView class. More...
 
typedef CatalogT< BaseRecord > Catalog
 Template of CatalogT used to hold records of this type. More...
 
typedef CatalogT< BaseRecord const > ConstCatalog
 Template of CatalogT used to hold const records of this type. More...
 
typedef unsigned long memId
 
typedef memId(* memNewCallback) (const memId cid)
 
typedef memId(* memCallback) (const Citizen *ptr)
 

Public Member Functions

 BaseRecord (const BaseRecord &)=delete
 
BaseRecord & operator= (const BaseRecord &)=delete
 
 BaseRecord (BaseRecord &&)=delete
 
BaseRecord & operator= (BaseRecord &&)=delete
 
Schema getSchema () const
 Return the Schema that holds this record's fields and keys. More...
 
std::shared_ptr< BaseTable const > getTable () const
 Return the table this record is associated with. More...
 
template<typename T >
Field< T >::Element * getElement (Key< T > const &key)
 Return a pointer to the underlying elements of a field (non-const). More...
 
template<typename T >
Field< T >::Element const * getElement (Key< T > const &key) const
 Return a pointer to the underlying elements of a field (const). More...
 
template<typename T >
Field< T >::Reference operator[] (Key< T > const &key)
 Return a reference (or reference-like type) to the field's value. More...
 
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. More...
 
template<typename T >
Field< T >::Value get (Key< T > const &key) const
 Return the value of a field for the given key. More...
 
template<typename T , typename U >
void set (Key< T > const &key, U const &value)
 Set value of a field for the given key. More...
 
template<typename T >
T get (OutputFunctorKey< T > const &key) const
 Compute a calculated or aggregate field. More...
 
template<typename T , typename U >
void set (InputFunctorKey< T > const &key, U const &value)
 Set a calculated or aggregate field. More...
 
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. More...
 
void assign (BaseRecord const &other, SchemaMapper const &mapper)
 Copy field values from other to this, using a mapper. More...
 
ndarray::Manager::Ptr getManager () const
 
virtual ~BaseRecord ()
 
std::string repr () const
 
void markPersistent (void)
 
memId getId () const
 

Static Public Member Functions

static bool hasBeenCorrupted ()
 
static memId getNextMemId ()
 
static int init ()
 
static int census (int, memId startingMemId=0)
 
static void census (std::ostream &stream, memId startingMemId=0)
 
static const std::vector< const Citizen *> * census ()
 
static int census (int, memId startingMemId=0)
 
static void census (std::ostream &stream, memId startingMemId=0)
 
static const std::vector< const Citizen *> * census ()
 
static memId setNewCallbackId (memId id)
 
static memId setNewCallbackId (memId id)
 
static memId setDeleteCallbackId (memId id)
 
static memId setDeleteCallbackId (memId id)
 
static memNewCallback setNewCallback (memNewCallback func)
 
static memCallback setDeleteCallback (memCallback func)
 
static memCallback setCorruptionCallback (memCallback func)
 

Public Attributes

 magicSentinel
 

Protected Member Functions

virtual void _assign (BaseRecord const &other)
 Called by assign() after transferring fields to allow subclass data members to be copied. More...
 
virtual void _stream (std::ostream &os) const
 Called by operator<<. More...
 
 BaseRecord (std::shared_ptr< BaseTable > const &table)
 Construct a record with uninitialized data. More...
 

Friends

class BaseTable
 
class BaseColumnView
 
std::ostream & operator<< (std::ostream &os, BaseRecord const &record)
 Write the record's content out, one field on each line. More...
 

Detailed Description

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.

Definition at line 31 of file BaseRecord.h.

Member Typedef Documentation

◆ Catalog

Template of CatalogT used to hold records of this type.

Definition at line 48 of file BaseRecord.h.

◆ ColumnView

The associated ColumnView class.

Definition at line 45 of file BaseRecord.h.

◆ ConstCatalog

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

Definition at line 51 of file BaseRecord.h.

◆ Table

The associated table class.

Definition at line 42 of file BaseRecord.h.

Constructor & Destructor Documentation

◆ BaseRecord() [1/3]

lsst::afw::table::BaseRecord::BaseRecord ( const BaseRecord &  )
delete

◆ BaseRecord() [2/3]

lsst::afw::table::BaseRecord::BaseRecord ( BaseRecord &&  )
delete

◆ ~BaseRecord()

virtual lsst::afw::table::BaseRecord::~BaseRecord ( )
inlinevirtual

Definition at line 176 of file BaseRecord.h.

◆ BaseRecord() [3/3]

lsst::afw::table::BaseRecord::BaseRecord ( std::shared_ptr< BaseTable > const &  table)
inlineprotected

Construct a record with uninitialized data.

Definition at line 190 of file BaseRecord.h.

Member Function Documentation

◆ _assign()

virtual void lsst::afw::table::BaseRecord::_assign ( BaseRecord const &  other)
inlineprotectedvirtual

Called by assign() after transferring fields to allow subclass data members to be copied.

Reimplemented in lsst::afw::table::SourceRecord, and lsst::afw::table::ExposureRecord.

Definition at line 183 of file BaseRecord.h.

◆ _stream()

virtual void lsst::afw::table::BaseRecord::_stream ( std::ostream &  os) const
protectedvirtual

Called by operator<<.

Overrides should call the base class implementation and append additional fields on new lines, with the syntax "%(name)s: %(value)s".

◆ assign() [1/2]

void lsst::afw::table::BaseRecord::assign ( BaseRecord const &  other)

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

◆ assign() [2/2]

void lsst::afw::table::BaseRecord::assign ( BaseRecord const &  other,
SchemaMapper const &  mapper 
)

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

◆ get() [1/2]

template<typename T >
Field<T>::Value lsst::afw::table::BaseRecord::get ( Key< T > const &  key) const
inline

Return the value of a field for the given key.

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

Definition at line 125 of file BaseRecord.h.

◆ get() [2/2]

template<typename T >
T lsst::afw::table::BaseRecord::get ( OutputFunctorKey< T > const &  key) const
inline

Compute a calculated or aggregate field.

Definition at line 146 of file BaseRecord.h.

◆ getElement() [1/2]

template<typename T >
Field<T>::Element* lsst::afw::table::BaseRecord::getElement ( Key< T > const &  key)
inline

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.

Definition at line 67 of file BaseRecord.h.

◆ getElement() [2/2]

template<typename T >
Field<T>::Element const* lsst::afw::table::BaseRecord::getElement ( Key< T > const &  key) const
inline

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.

Definition at line 85 of file BaseRecord.h.

◆ getManager()

ndarray::Manager::Ptr lsst::afw::table::BaseRecord::getManager ( ) const
inline

Definition at line 174 of file BaseRecord.h.

◆ getSchema()

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

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

Definition at line 54 of file BaseRecord.h.

◆ getTable()

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

Return the table this record is associated with.

Definition at line 57 of file BaseRecord.h.

◆ operator=() [1/2]

BaseRecord& lsst::afw::table::BaseRecord::operator= ( const BaseRecord &  )
delete

◆ operator=() [2/2]

BaseRecord& lsst::afw::table::BaseRecord::operator= ( BaseRecord &&  )
delete

◆ operator[]() [1/4]

template<typename T >
Field<T>::Reference lsst::afw::table::BaseRecord::operator[] ( Key< T > const &  key)
inline

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.

Definition at line 103 of file BaseRecord.h.

◆ operator[]() [2/4]

template<typename T >
Field<T>::ConstReference lsst::afw::table::BaseRecord::operator[] ( Key< T > const &  key) const
inline

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.

Definition at line 115 of file BaseRecord.h.

◆ operator[]() [3/4]

template<typename Ref >
Ref lsst::afw::table::BaseRecord::operator[] ( ReferenceFunctorKey< Ref > const &  key)
inline

Definition at line 159 of file BaseRecord.h.

◆ operator[]() [4/4]

template<typename ConstRef >
ConstRef lsst::afw::table::BaseRecord::operator[] ( ConstReferenceFunctorKey< ConstRef > const &  key) const
inline

Definition at line 164 of file BaseRecord.h.

◆ set() [1/2]

template<typename T , typename U >
void lsst::afw::table::BaseRecord::set ( Key< T > const &  key,
U const &  value 
)
inline

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.

Definition at line 138 of file BaseRecord.h.

◆ set() [2/2]

template<typename T , typename U >
void lsst::afw::table::BaseRecord::set ( InputFunctorKey< T > const &  key,
U const &  value 
)
inline

Set a calculated or aggregate field.

Definition at line 154 of file BaseRecord.h.

Friends And Related Function Documentation

◆ BaseColumnView

friend class BaseColumnView
friend

Definition at line 196 of file BaseRecord.h.

◆ BaseTable

friend class BaseTable
friend

Definition at line 195 of file BaseRecord.h.

◆ operator<<

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

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


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