LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
Field.h
Go to the documentation of this file.
1// -*- lsst-c++ -*-
2#ifndef AFW_TABLE_Field_h_INCLUDED
3#define AFW_TABLE_Field_h_INCLUDED
4
5#include <iostream>
6
8
9namespace lsst {
10namespace afw {
11namespace table {
12
23template <typename T>
24struct Field : public FieldBase<T> {
27
44 Field(std::string const& name, std::string const& doc, std::string const& units = "",
45 FieldBase<T> const& size = FieldBase<T>())
46 : FieldBase<T>(size), _name(name), _doc(doc), _units(units) {}
47
61 Field(std::string const& name, std::string const& doc, FieldBase<T> const& size)
62 : FieldBase<T>(size), _name(name), _doc(doc), _units() {}
63
64 Field(Field const&) = default;
65 Field(Field&&) noexcept = default;
66 Field& operator=(Field const&) = default;
67 Field& operator=(Field&&) noexcept = default;
68 ~Field() noexcept = default;
69
71 std::string const& getName() const noexcept { return _name; }
72
74 std::string const& getDoc() const noexcept { return _doc; }
75
77 std::string const& getUnits() const noexcept { return _units; }
78
80 inline friend std::ostream& operator<<(std::ostream& os, Field<T> const& field) {
81 os << "Field['" << Field<T>::getTypeString() << "'](name=\"" << field.getName() << "\"";
82 if (!field.getDoc().empty()) os << ", doc=\"" << field.getDoc() << "\"";
83 if (!field.getUnits().empty()) os << ", units=\"" << field.getUnits() << "\"";
84 field.stream(os);
85 return os << ")";
86 }
87
89 Field<T> copyRenamed(std::string const& newName) const {
90 return Field<T>(newName, getDoc(), getUnits(), *this);
91 }
92
93private:
94 std::string _name;
95 std::string _doc;
96 std::string _units;
97};
98} // namespace table
99} // namespace afw
100} // namespace lsst
101
102#endif // !AFW_TABLE_Field_h_INCLUDED
table::Key< std::string > name
Definition: Amplifier.cc:116
table::Key< int > field
Definition: ApCorrMap.cc:77
std::ostream * os
Definition: Schema.cc:557
STL namespace.
Field base class default implementation (used for numeric scalars and lsst::geom::Angle).
Definition: FieldBase.h:41
static std::string getTypeString()
Return a string description of the field type.
Definition: FieldBase.cc:56
T Element
the type of subfields (the same as the type itself for scalars)
Definition: FieldBase.h:45
A description of a field in a table.
Definition: Field.h:24
typename FieldBase< T >::Element Element
Type used to store field data in the table (a field may have multiple elements).
Definition: Field.h:26
std::string const & getName() const noexcept
Return the name of the field.
Definition: Field.h:71
friend std::ostream & operator<<(std::ostream &os, Field< T > const &field)
Stringification.
Definition: Field.h:80
std::string const & getUnits() const noexcept
Return the units for the field.
Definition: Field.h:77
Field(std::string const &name, std::string const &doc, FieldBase< T > const &size)
Construct a new field.
Definition: Field.h:61
Field< T > copyRenamed(std::string const &newName) const
Return a new Field with a new name and other properties the same as this.
Definition: Field.h:89
Field(std::string const &name, std::string const &doc, std::string const &units="", FieldBase< T > const &size=FieldBase< T >())
Construct a new field.
Definition: Field.h:44
Field(Field const &)=default
Field(Field &&) noexcept=default
std::string const & getDoc() const noexcept
Return the documentation for the field.
Definition: Field.h:74