LSSTApplications  19.0.0-14-gb0260a2+1009f50558,20.0.0+089c43b26b,20.0.0+126303c00d,20.0.0+2f3d0e5c40,20.0.0+36ef800059,20.0.0+5efbb753f1,20.0.0+bebc1f60e8,20.0.0+c31f88ab0f,20.0.0+e2e26847c2,20.0.0+f8788d280b,20.0.0-1-g10df615+c10c626ef0,20.0.0-1-g253301a+36ef800059,20.0.0-1-g2b7511a+bebc1f60e8,20.0.0-1-g4d801e7+2364cbef1f,20.0.0-1-g5b95a8c+f41a630bc9,20.0.0-1-g660595b+f45b7d88f4,20.0.0-1-gc96f8cb+4c66cd7cf3,20.0.0-1-gd1c87d7+85c46248f3,20.0.0-1-gedffbd8+f975718b49,20.0.0-13-ge9dc5b3+55648be1db,20.0.0-15-ga86d0f6+bdc7c63f7c,20.0.0-15-gf5872d0+4c66cd7cf3,20.0.0-16-g6fe20a1+a77778c47d,20.0.0-2-g4dae9ad+4c66cd7cf3,20.0.0-2-g7818986+85c46248f3,20.0.0-2-gec03fae+ff10c6d78d,20.0.0-25-g38d2b7ae+bde7f0c6ec,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g6a8623c+55648be1db,20.0.0-3-g750bffe+823a89ab62,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-47-g0830830+f5f993f8be,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-5-gfcebe35+8726ad94da,20.0.0-7-gc818c6e6+aaebb51c78,20.0.0-7-gcda7bf1+2a82aa79eb,20.0.0-9-g61a2a9a3d+14f89e4eca,w.2020.38
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
std::string
STL class.
lsst::afw::table::Field::Field
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
lsst::afw
Definition: imageAlgorithm.dox:1
lsst::afw::geom.transform.transformContinued.name
string name
Definition: transformContinued.py:32
lsst::afw::table::Field::Field
Field(Field const &)=default
lsst::afw::table::Field::operator<<
friend std::ostream & operator<<(std::ostream &os, Field< T > const &field)
Stringification.
Definition: Field.h:80
std::ostream
STL class.
field
table::Key< int > field
Definition: ApCorrMap.cc:77
lsst::afw::table::Field::getDoc
std::string const & getDoc() const noexcept
Return the documentation for the field.
Definition: Field.h:74
lsst::afw::table::FieldBase::Element
T Element
the type of subfields (the same as the type itself for scalars)
Definition: FieldBase.h:47
lsst
A base class for image defects.
Definition: imageAlgorithm.dox:1
os
std::ostream * os
Definition: Schema.cc:746
lsst::afw::table::FieldBase
Field base class default implementation (used for numeric scalars and lsst::geom::Angle).
Definition: FieldBase.h:43
lsst::afw::table::Field
A description of a field in a table.
Definition: Field.h:24
lsst::afw::table::Field::getUnits
std::string const & getUnits() const noexcept
Return the units for the field.
Definition: Field.h:77
lsst::afw::table::FieldBase::getTypeString
static std::string getTypeString()
Return a string description of the field type.
Definition: FieldBase.cc:56
std
STL namespace.
lsst::afw::table::Field::getName
std::string const & getName() const noexcept
Return the name of the field.
Definition: Field.h:71
lsst::afw::table::Field::Element
FieldBase< T >::Element Element
Type used to store field data in the table (a field may have multiple elements).
Definition: Field.h:26
FieldBase.h
lsst::afw::table::Field::copyRenamed
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
lsst::afw::table::Field::Field
Field(std::string const &name, std::string const &doc, FieldBase< T > const &size)
Construct a new field.
Definition: Field.h:61
lsst::afw::table::Field::Field
Field(Field &&) noexcept=default