LSST Applications 26.0.0,g0265f82a02+6660c170cc,g07994bdeae+30b05a742e,g0a0026dc87+17526d298f,g0a60f58ba1+17526d298f,g0e4bf8285c+96dd2c2ea9,g0ecae5effc+c266a536c8,g1e7d6db67d+6f7cb1f4bb,g26482f50c6+6346c0633c,g2bbee38e9b+6660c170cc,g2cc88a2952+0a4e78cd49,g3273194fdb+f6908454ef,g337abbeb29+6660c170cc,g337c41fc51+9a8f8f0815,g37c6e7c3d5+7bbafe9d37,g44018dc512+6660c170cc,g4a941329ef+4f7594a38e,g4c90b7bd52+5145c320d2,g58be5f913a+bea990ba40,g635b316a6c+8d6b3a3e56,g67924a670a+bfead8c487,g6ae5381d9b+81bc2a20b4,g93c4d6e787+26b17396bd,g98cecbdb62+ed2cb6d659,g98ffbb4407+81bc2a20b4,g9ddcbc5298+7f7571301f,ga1e77700b3+99e9273977,gae46bcf261+6660c170cc,gb2715bf1a1+17526d298f,gc86a011abf+17526d298f,gcf0d15dbbd+96dd2c2ea9,gdaeeff99f8+0d8dbea60f,gdb4ec4c597+6660c170cc,ge23793e450+96dd2c2ea9,gf041782ebf+171108ac67
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