LSSTApplications  16.0-10-g0ee56ad+5,16.0-11-ga33d1f2+5,16.0-12-g3ef5c14+3,16.0-12-g71e5ef5+18,16.0-12-gbdf3636+3,16.0-13-g118c103+3,16.0-13-g8f68b0a+3,16.0-15-gbf5c1cb+4,16.0-16-gfd17674+3,16.0-17-g7c01f5c+3,16.0-18-g0a50484+1,16.0-20-ga20f992+8,16.0-21-g0e05fd4+6,16.0-21-g15e2d33+4,16.0-22-g62d8060+4,16.0-22-g847a80f+4,16.0-25-gf00d9b8+1,16.0-28-g3990c221+4,16.0-3-gf928089+3,16.0-32-g88a4f23+5,16.0-34-gd7987ad+3,16.0-37-gc7333cb+2,16.0-4-g10fc685+2,16.0-4-g18f3627+26,16.0-4-g5f3a788+26,16.0-5-gaf5c3d7+4,16.0-5-gcc1f4bb+1,16.0-6-g3b92700+4,16.0-6-g4412fcd+3,16.0-6-g7235603+4,16.0-69-g2562ce1b+2,16.0-8-g14ebd58+4,16.0-8-g2df868b+1,16.0-8-g4cec79c+6,16.0-8-gadf6c7a+1,16.0-8-gfc7ad86,16.0-82-g59ec2a54a+1,16.0-9-g5400cdc+2,16.0-9-ge6233d7+5,master-g2880f2d8cf+3,v17.0.rc1
LSSTDataManagementBasePackage
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 
9 namespace lsst {
10 namespace afw {
11 namespace table {
12 
23 template <typename T>
24 struct Field : public FieldBase<T> {
26  typedef typename FieldBase<T>::Element Element;
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 
93 private:
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
Field base class default implementation (used for numeric scalars and lsst::geom::Angle).
Definition: FieldBase.h:43
table::Key< int > field
Definition: ApCorrMap.cc:77
Field(std::string const &name, std::string const &doc, FieldBase< T > const &size)
Construct a new field.
Definition: Field.h:61
std::string const & getDoc() const noexcept
Return the documentation for the field.
Definition: Field.h:74
STL class.
~Field() noexcept=default
Definition: fieldImpl.cc:50
A base class for image defects.
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
A description of a field in a table.
Definition: Field.h:24
Field & operator=(Field const &)=default
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
std::string const & getName() const noexcept
Return the name of the field.
Definition: Field.h:71
T Element
the type of subfields (the same as the type itself for scalars)
Definition: FieldBase.h:47
FieldBase< T >::Element Element
Type used to store field data in the table (a field may have multiple elements).
Definition: Field.h:26
static std::string getTypeString()
Return a string description of the field type.
Definition: FieldBase.cc:56
STL class.
std::string const & getUnits() const noexcept
Return the units for the field.
Definition: Field.h:77
std::ostream * os
Definition: Schema.cc:746