LSSTApplications  8.0.0.0+107,8.0.0.1+13,9.1+18,9.2,master-g084aeec0a4,master-g0aced2eed8+6,master-g15627eb03c,master-g28afc54ef9,master-g3391ba5ea0,master-g3d0fb8ae5f,master-g4432ae2e89+36,master-g5c3c32f3ec+17,master-g60f1e072bb+1,master-g6a3ac32d1b,master-g76a88a4307+1,master-g7bce1f4e06+57,master-g8ff4092549+31,master-g98e65bf68e,master-ga6b77976b1+53,master-gae20e2b580+3,master-gb584cd3397+53,master-gc5448b162b+1,master-gc54cf9771d,master-gc69578ece6+1,master-gcbf758c456+22,master-gcec1da163f+63,master-gcf15f11bcc,master-gd167108223,master-gf44c96c709
LSSTDataManagementBasePackage
KeyBase.h
Go to the documentation of this file.
1 // -*- lsst-c++ -*-
2 #ifndef AFW_TABLE_KeyBase_h_INCLUDED
3 #define AFW_TABLE_KeyBase_h_INCLUDED
4 
5 #include <vector>
6 
7 #include "lsst/afw/table/misc.h"
8 
9 namespace lsst { namespace afw { namespace table {
10 
11 class BaseRecord;
12 
13 template <typename T> class Key;
14 
16 template <typename T>
17 class KeyBase {
18 public:
19  static bool const HAS_NAMED_SUBFIELDS = false;
20 
21 };
22 
24 template <>
25 class KeyBase< Coord > {
26 public:
27  static bool const HAS_NAMED_SUBFIELDS = true;
28 
29  Key<Angle> getRa() const;
30  Key<Angle> getDec() const;
31 
32 #ifndef SWIG
33  static char const * subfields[];
34 #endif
35 };
36 
38 template <typename U>
39 class KeyBase< Point<U> > {
40 public:
41  static bool const HAS_NAMED_SUBFIELDS = true;
42 
43  Key<U> getX() const;
44  Key<U> getY() const;
45 
46  static char const * subfields[];
47 };
48 
50 template <typename U>
51 class KeyBase< Moments<U> > {
52 public:
53  static bool const HAS_NAMED_SUBFIELDS = true;
54 
55  Key<U> getIxx() const;
56  Key<U> getIyy() const;
57  Key<U> getIxy() const;
58 
59  static char const * subfields[];
60 };
61 
63 template <typename U>
64 class KeyBase< Array<U> > {
65 public:
66  static bool const HAS_NAMED_SUBFIELDS = false;
67 
68  std::vector<U> extractVector(BaseRecord const & record) const;
69 
70  void assignVector(BaseRecord & record, std::vector<U> const & values) const;
71 
72  Key<U> operator[](int i) const;
73 
74  Key< Array<U> > slice(int begin, int end) const;
75 };
76 
78 template <typename U>
79 class KeyBase< Covariance<U> > {
80 public:
81  static bool const HAS_NAMED_SUBFIELDS = false;
82 
84  Key<U> operator()(int i, int j) const;
85 };
86 
88 template <typename U>
89 class KeyBase< Covariance< Point<U> > > {
90 public:
91  static bool const HAS_NAMED_SUBFIELDS = false;
92 
94  Key<U> operator()(int i, int j) const;
95 };
96 
98 template <typename U>
99 class KeyBase< Covariance< Moments<U> > > {
100 public:
101  static bool const HAS_NAMED_SUBFIELDS = false;
102 
104  Key<U> operator()(int i, int j) const;
105 };
106 
107 }}} // namespace lsst::afw::table
108 
109 #endif // !AFW_TABLE_KeyBase_h_INCLUDED
static bool const HAS_NAMED_SUBFIELDS
Definition: KeyBase.h:19
A base class for Key that allows subfield keys to be extracted for some field types.
Definition: KeyBase.h:17
Base class for all records.
Definition: BaseRecord.h:27
A class used as a handle to a particular field in a table.
Definition: fwd.h:44
Tag types used to declare specialized field types.
Definition: misc.h:30
afw::table::SourceRecord * record