LSSTApplications  18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | List of all members
lsst::afw::table::KeyBase< Array< U > > Class Template Reference

KeyBase specialization for Arrays. More...

#include <KeyBase.h>

Public Member Functions

std::vector< U > extractVector (BaseRecord const &record) const
 
void assignVector (BaseRecord &record, std::vector< U > const &values) const
 
Key< U > operator[] (int i) const
 Return a subfield key for the i-th element of the array. More...
 
Key< Array< U > > slice (int begin, int end) const
 Return a key for a range of elements. More...
 

Static Public Attributes

static bool const HAS_NAMED_SUBFIELDS = false
 

Detailed Description

template<typename U>
class lsst::afw::table::KeyBase< Array< U > >

KeyBase specialization for Arrays.

Definition at line 27 of file KeyBase.h.

Member Function Documentation

◆ assignVector()

template<typename U >
void lsst::afw::table::KeyBase< Array< U > >::assignVector ( BaseRecord record,
std::vector< U > const &  values 
) const

Definition at line 37 of file KeyBase.cc.

37  {
38  Key<Array<U>> const *self = static_cast<Key<Array<U>> const *>(this);
39  std::copy(values.begin(), values.end(), record[*self].begin());
40 }
T copy(T... args)
T end(T... args)
T begin(T... args)

◆ extractVector()

template<typename U >
std::vector< U > lsst::afw::table::KeyBase< Array< U > >::extractVector ( BaseRecord const &  record) const

Definition at line 28 of file KeyBase.cc.

28  {
29  Key<Array<U>> const *self = static_cast<Key<Array<U>> const *>(this);
30  std::vector<U> result(self->getSize());
31  typename Key<Array<U>>::ConstReference array = record[*self];
32  std::copy(array.begin(), array.end(), result.begin());
33  return result;
34 }
T copy(T... args)
STL class.
py::object result
Definition: _schema.cc:429

◆ operator[]()

template<typename U >
Key< U > lsst::afw::table::KeyBase< Array< U > >::operator[] ( int  i) const

Return a subfield key for the i-th element of the array.

Definition at line 43 of file KeyBase.cc.

43  {
44  Key<Array<U>> const *self = static_cast<Key<Array<U>> const *>(this);
45  if (self->isVariableLength()) {
47  "Cannot get Keys to elements of variable-length arrays.");
48  }
49  if (i >= self->getSize() || i < 0) {
50  throw LSST_EXCEPT(lsst::pex::exceptions::LengthError, "Array key index out of range.");
51  }
52  return detail::Access::extractElement(*this, i);
53 }
Reports attempts to exceed implementation-defined length limits for some classes. ...
Definition: Runtime.h:76
static Key< typename Key< T >::Element > extractElement(KeyBase< T > const &kb, int n)
Definition: Access.h:35
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48

◆ slice()

template<typename U >
Key< Array< U > > lsst::afw::table::KeyBase< Array< U > >::slice ( int  begin,
int  end 
) const

Return a key for a range of elements.

Definition at line 56 of file KeyBase.cc.

56  {
57  Key<Array<U>> const *self = static_cast<Key<Array<U>> const *>(this);
58  if (self->isVariableLength()) {
60  "Cannot get Keys to slices of variable-length arrays.");
61  }
62  if (begin > self->getSize() || begin < 0) {
63  throw LSST_EXCEPT(lsst::pex::exceptions::LengthError, "Array key begin index out of range.");
64  }
65  if (end > self->getSize() || end < 0) {
66  throw LSST_EXCEPT(lsst::pex::exceptions::LengthError, "Array key end index out of range.");
67  }
68  return detail::Access::extractRange(*this, begin, end);
69 }
static Key< Array< T > > extractRange(KeyBase< Array< T > > const &kb, int begin, int end)
Definition: Access.h:51
Reports attempts to exceed implementation-defined length limits for some classes. ...
Definition: Runtime.h:76
Reports errors in the logical structure of the program.
Definition: Runtime.h:46
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Definition: Exception.h:48
T begin(T... args)
int end

Member Data Documentation

◆ HAS_NAMED_SUBFIELDS

template<typename U >
bool const lsst::afw::table::KeyBase< Array< U > >::HAS_NAMED_SUBFIELDS = false
static

Definition at line 29 of file KeyBase.h.


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