LSSTApplications  10.0-2-g4f67435,11.0.rc2+1,11.0.rc2+12,11.0.rc2+3,11.0.rc2+4,11.0.rc2+5,11.0.rc2+6,11.0.rc2+7,11.0.rc2+8
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
lsst.afw.table::ArrayKey< T > Class Template Reference

A FunctorKey used to get or set a ndarray::Array from a sequence of scalar Keys. More...

#include <arrays.h>

Inheritance diagram for lsst.afw.table::ArrayKey< T >:
lsst.afw.table::FunctorKey< ndarray::Array< T const, 1, 1 > > lsst.afw.table::ReferenceFunctorKey< ndarray::ArrayRef< T, 1, 1 > > lsst.afw.table::ConstReferenceFunctorKey< ndarray::ArrayRef< T const, 1, 1 > > lsst.afw.table::OutputFunctorKey< ndarray::Array< T const, 1, 1 > > lsst.afw.table::InputFunctorKey< ndarray::Array< T const, 1, 1 > >

Public Member Functions

 ArrayKey ()
 Default constructor; instance will not be usuable unless subsequently assigned to. More...
 
 ArrayKey (std::vector< Key< T > > const &keys)
 Construct from a vector of scalar Keys. More...
 
 ArrayKey (Key< Array< T > > const &other)
 
 ArrayKey (SubSchema const &s)
 Construct from a subschema, assuming *_0, *_1, *_2, etc. subfields. More...
 
int getSize () const
 Return the number of elements in the array. More...
 
virtual ndarray::Array< T
const, 1, 1 > 
get (BaseRecord const &record) const
 Get an array from the given record. More...
 
virtual void set (BaseRecord &record, ndarray::Array< T const, 1, 1 > const &value) const
 Set an array in the given record. More...
 
virtual ndarray::ArrayRef< T, 1, 1 > getReference (BaseRecord &record) const
 Get non-const reference array from the given record. More...
 
virtual ndarray::ArrayRef< T
const, 1, 1 > 
getConstReference (BaseRecord const &record) const
 Get const reference array from the given record. More...
 
bool isValid () const
 Return True if the FunctorKey contains valid scalar keys. More...
 
Key< T > operator[] (int i) const
 Return a scalar Key for an element of the array. More...
 
ArrayKey slice (int begin, int end) const
 Return a FunctorKey corresponding to a range of elements. More...
 
bool operator== (ArrayKey< T > const &other) const
 Compare the FunctorKey for equality with another, using the underlying scalar Keys. More...
 
bool operator!= (ArrayKey< T > const &other) const
 Compare the FunctorKey for equality with another, using the underlying scalar Keys. More...
 
- Public Member Functions inherited from lsst.afw.table::OutputFunctorKey< ndarray::Array< T const, 1, 1 > >
virtual ~OutputFunctorKey ()
 
- Public Member Functions inherited from lsst.afw.table::InputFunctorKey< ndarray::Array< T const, 1, 1 > >
virtual ~InputFunctorKey ()
 
- Public Member Functions inherited from lsst.afw.table::ReferenceFunctorKey< ndarray::ArrayRef< T, 1, 1 > >
virtual ~ReferenceFunctorKey ()
 
- Public Member Functions inherited from lsst.afw.table::ConstReferenceFunctorKey< ndarray::ArrayRef< T const, 1, 1 > >
virtual ~ConstReferenceFunctorKey ()
 

Static Public Member Functions

static ArrayKey addFields (Schema &schema, std::string const &name, std::string const &doc, std::string const &unit, std::vector< T > const &docData)
 
static ArrayKey addFields (Schema &schema, std::string const &name, std::string const &doc, std::string const &unit, int size)
 

Private Member Functions

 ArrayKey (Key< T > const &begin, int size)
 

Private Attributes

Key< T > _begin
 
int _size
 

Detailed Description

template<typename T>
class lsst.afw.table::ArrayKey< T >

A FunctorKey used to get or set a ndarray::Array from a sequence of scalar Keys.

ArrayKey operates on the convention that arrays are defined by a set of contiguous scalar fields (i.e. added to the Schema in order, with no interruption) of the same type, with a common field name prefix and "_0", "_1" etc. suffixes.

Definition at line 39 of file arrays.h.

Constructor & Destructor Documentation

template<typename T>
lsst.afw.table::ArrayKey< T >::ArrayKey ( )
inline

Default constructor; instance will not be usuable unless subsequently assigned to.

Definition at line 86 of file arrays.h.

86 : _begin() {}
template<typename T>
lsst.afw.table::ArrayKey< T >::ArrayKey ( std::vector< Key< T > > const &  keys)
explicit

Construct from a vector of scalar Keys.

template<typename T>
lsst.afw.table::ArrayKey< T >::ArrayKey ( Key< Array< T > > const &  other)
explicit

Construct from a compound Key< Array<T> >

Key< Array<T> > is now deprecated in favor of ArrayKey; this factory function is intended to aid in the transition.

template<typename T>
lsst.afw.table::ArrayKey< T >::ArrayKey ( SubSchema const &  s)

Construct from a subschema, assuming *_0, *_1, *_2, etc. subfields.

If a schema has "a_0", "a_1", and "a_2" fields, this constructor allows you to construct a 3-element ArrayKey via:

* ArrayKey<T> k(schema["a"]);
*
template<typename T>
lsst.afw.table::ArrayKey< T >::ArrayKey ( Key< T > const &  begin,
int  size 
)
inlineprivate

Definition at line 146 of file arrays.h.

146 : _begin(begin), _size(size) {}

Member Function Documentation

template<typename T>
static ArrayKey lsst.afw.table::ArrayKey< T >::addFields ( Schema schema,
std::string const &  name,
std::string const &  doc,
std::string const &  unit,
std::vector< T > const &  docData 
)
static

Add an array of fields to a Schema, and return an ArrayKey that points to them.

Parameters
[in,out]schemaSchema to add fields to.
[in]nameName prefix for all fields; "_0", "_1", etc. will be appended to this to form the full field names.
[in]docString used as the documentation for the fields. Should include a single boost::format template string, which will be substituted with the appropriate element from the docData array to form the full documentation string.
[in]unitString used as the unit for all fields.
[in]docDataVector of values substituted into the doc fields. The length of the vector determines the number of fields added.
template<typename T>
static ArrayKey lsst.afw.table::ArrayKey< T >::addFields ( Schema schema,
std::string const &  name,
std::string const &  doc,
std::string const &  unit,
int  size 
)
static

Add an array of fields to a Schema, and return an ArrayKey that points to them.

Parameters
[in,out]schemaSchema to add fields to.
[in]nameName prefix for all fields; "_0", "_1", etc. will be appended to this to form the full field names.
[in]docString used as the documentation for the fields.
[in]unitString used as the unit for all fields.
[in]sizeNumber of fields to add.
template<typename T>
virtual ndarray::Array<T const,1,1> lsst.afw.table::ArrayKey< T >::get ( BaseRecord const &  record) const
virtual

Get an array from the given record.

Implements lsst.afw.table::OutputFunctorKey< ndarray::Array< T const, 1, 1 > >.

template<typename T>
virtual ndarray::ArrayRef<T const,1,1> lsst.afw.table::ArrayKey< T >::getConstReference ( BaseRecord const &  record) const
virtual

Get const reference array from the given record.

Implements lsst.afw.table::ConstReferenceFunctorKey< ndarray::ArrayRef< T const, 1, 1 > >.

template<typename T>
virtual ndarray::ArrayRef<T,1,1> lsst.afw.table::ArrayKey< T >::getReference ( BaseRecord record) const
virtual

Get non-const reference array from the given record.

Implements lsst.afw.table::ReferenceFunctorKey< ndarray::ArrayRef< T, 1, 1 > >.

template<typename T>
int lsst.afw.table::ArrayKey< T >::getSize ( ) const
inline

Return the number of elements in the array.

Definition at line 111 of file arrays.h.

111 { return _size; }
template<typename T>
bool lsst.afw.table::ArrayKey< T >::isValid ( ) const
inline

Return True if the FunctorKey contains valid scalar keys.

Definition at line 136 of file arrays.h.

136 { return _begin.isValid(); }
template<typename T>
bool lsst.afw.table::ArrayKey< T >::operator!= ( ArrayKey< T > const &  other) const
inline

Compare the FunctorKey for equality with another, using the underlying scalar Keys.

Definition at line 132 of file arrays.h.

132 { return !operator==(other); }
bool operator==(ArrayKey< T > const &other) const
Compare the FunctorKey for equality with another, using the underlying scalar Keys.
Definition: arrays.h:129
template<typename T>
bool lsst.afw.table::ArrayKey< T >::operator== ( ArrayKey< T > const &  other) const
inline

Compare the FunctorKey for equality with another, using the underlying scalar Keys.

Definition at line 129 of file arrays.h.

129  {
130  return other._begin == _begin && other._size == _size;
131  }
template<typename T>
Key<T> lsst.afw.table::ArrayKey< T >::operator[] ( int  i) const

Return a scalar Key for an element of the array.

template<typename T>
virtual void lsst.afw.table::ArrayKey< T >::set ( BaseRecord record,
ndarray::Array< T const, 1, 1 > const &  value 
) const
virtual

Set an array in the given record.

Implements lsst.afw.table::InputFunctorKey< ndarray::Array< T const, 1, 1 > >.

template<typename T>
ArrayKey lsst.afw.table::ArrayKey< T >::slice ( int  begin,
int  end 
) const

Return a FunctorKey corresponding to a range of elements.

Member Data Documentation

template<typename T>
Key<T> lsst.afw.table::ArrayKey< T >::_begin
private

Definition at line 148 of file arrays.h.

template<typename T>
int lsst.afw.table::ArrayKey< T >::_size
private

Definition at line 149 of file arrays.h.


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