LSSTApplications
19.0.0-14-gb0260a2+72efe9b372,20.0.0+7927753e06,20.0.0+8829bf0056,20.0.0+995114c5d2,20.0.0+b6f4b2abd1,20.0.0+bddc4f4cbe,20.0.0-1-g253301a+8829bf0056,20.0.0-1-g2b7511a+0d71a2d77f,20.0.0-1-g5b95a8c+7461dd0434,20.0.0-12-g321c96ea+23efe4bbff,20.0.0-16-gfab17e72e+fdf35455f6,20.0.0-2-g0070d88+ba3ffc8f0b,20.0.0-2-g4dae9ad+ee58a624b3,20.0.0-2-g61b8584+5d3db074ba,20.0.0-2-gb780d76+d529cf1a41,20.0.0-2-ged6426c+226a441f5f,20.0.0-2-gf072044+8829bf0056,20.0.0-2-gf1f7952+ee58a624b3,20.0.0-20-geae50cf+e37fec0aee,20.0.0-25-g3dcad98+544a109665,20.0.0-25-g5eafb0f+ee58a624b3,20.0.0-27-g64178ef+f1f297b00a,20.0.0-3-g4cc78c6+e0676b0dc8,20.0.0-3-g8f21e14+4fd2c12c9a,20.0.0-3-gbd60e8c+187b78b4b8,20.0.0-3-gbecbe05+48431fa087,20.0.0-38-ge4adf513+a12e1f8e37,20.0.0-4-g97dc21a+544a109665,20.0.0-4-gb4befbc+087873070b,20.0.0-4-gf910f65+5d3db074ba,20.0.0-5-gdfe0fee+199202a608,20.0.0-5-gfbfe500+d529cf1a41,20.0.0-6-g64f541c+d529cf1a41,20.0.0-6-g9a5b7a1+a1cd37312e,20.0.0-68-ga3f3dda+5fca18c6a4,20.0.0-9-g4aef684+e18322736b,w.2020.45
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
2 #ifndef AFW_TABLE_FieldBase_h_INCLUDED
3 #define AFW_TABLE_FieldBase_h_INCLUDED
8 #include "boost/mpl/vector.hpp"
9 #include "boost/preprocessor/punctuation/paren.hpp"
32 inline int indexCovariance(
int i,
int j) {
return (i < j) ? (i + j * (j + 1) / 2) : (j + i * (i + 1) / 2); }
61 "Constructor disabled (this Field type is not sized).");
100 typedef ndarray::Array<U const, 1, 1>
Value;
126 "A non-negative size must be provided when constructing an array field.");
158 if (isVariableLength()) {
159 return reinterpret_cast<ndarray::Array<Element, 1, 1> *
>(p)->deep();
161 return ndarray::external(p, ndarray::makeVector(
_size), ndarray::ROW_MAJOR,
m);
166 if (isVariableLength()) {
167 return reinterpret_cast<ndarray::Array<Element, 1, 1>
const *
>(p)->deep();
169 return ndarray::external(p, ndarray::makeVector(
_size), ndarray::ROW_MAJOR,
m);
174 if (isVariableLength()) {
175 return *
reinterpret_cast<ndarray::Array<Element, 1, 1>
const *
>(p);
177 return ndarray::external(p, ndarray::makeVector(
_size), ndarray::ROW_MAJOR,
m);
187 ndarray::Array<Element, 1, 1>
const &value)
const {
188 if (isVariableLength()) {
189 *
reinterpret_cast<ndarray::Array<Element, 1, 1> *
>(p) = value;
191 setValueDeep(p, value);
196 template <
typename Derived>
198 ndarray::ExpressionBase<Derived>
const &value)
const {
199 if (isVariableLength()) {
202 "Assignment to a variable-length array must use a non-const array of the correct type.");
204 setValueDeep(p, value);
208 template <
typename Derived>
209 void setValueDeep(
Element *p, ndarray::ExpressionBase<Derived>
const &value)
const {
212 "Incorrect size in array field assignment.");
214 for (
int i = 0; i <
_size; ++i) p[i] = value[i];
279 if (isVariableLength()) {
282 "non-const operator[] not supported for variable-length strings");
290 if (isVariableLength()) {
314 #endif // !AFW_TABLE_FieldBase_h_INCLUDED
static FieldBase makeDefault() noexcept
Needed to allow Keys to be default-constructed.
T & Reference
the type returned by BaseRecord::operator[] (non-const)
int indexCovariance(int i, int j)
Defines the ordering of packed covariance matrices.
char * Reference
the type returned by BaseRecord::operator[]
void setValue(Element *p, ndarray::Manager::Ptr const &, Value v) const
Used to implement BaseRecord::set.
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement BaseRecord::operator[] (const).
bool isVariableLength() const noexcept
Return true if the field is variable-length (each record can have a different size array).
void setValue(Element *p, ndarray::Manager::Ptr const &, ndarray::ExpressionBase< Derived > const &value) const
Used to implement BaseRecord::set; accepts any ndarray expression.
ndarray::Array< U const, 1, 1 > Value
the type returned by BaseRecord::get
FieldBase(FieldBase &&) noexcept=default
bool isVariableLength() const noexcept
Return true if the field is variable-length (each record can have a different size array).
void stream(std::ostream &os) const
Defines how Fields are printed.
void setValue(Element *p, ndarray::Manager::Ptr const &, ndarray::Array< Element, 1, 1 > const &value) const
Used to implement BaseRecord::set; accepts only non-const arrays of the right type.
Reference getReference(Element *p, ndarray::Manager::Ptr const &m) const
Used to implement BaseRecord::operator[] (non-const).
int getElementCount() const noexcept
Return the number of subfield elements (always one for scalars).
int getSize() const noexcept
Return the size of the array (equal to the number of subfield elements), or 0 for a variable-length a...
Value getValue(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement BaseRecord::get.
table::Key< table::Array< int > > _size
FieldBase(FieldBase &&) noexcept=default
char const * ConstReference
the type returned by BaseRecord::operator[] (const)
Reports attempts to exceed implementation-defined length limits for some classes.
Reports errors in the logical structure of the program.
U Element
the type of subfields and array elements
Reference getReference(Element *p, ndarray::Manager::Ptr const &) const
Used to implement BaseRecord::operator[] (non-const).
Tag types used to declare specialized field types.
Reference getReference(Element *p, ndarray::Manager::Ptr const &m) const
Used to implement BaseRecord::operator[] (non-const).
FieldBase(FieldBase const &) noexcept=default
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement BaseRecord::operator[] (const).
T const & ConstReference
the type returned by BaseRecord::operator[] (const)
T Element
the type of subfields (the same as the type itself for scalars)
A base class for image defects.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
int getSize() const noexcept
Return the maximum length of the string, including a null terminator (equal to the number of subfield...
Field base class default implementation (used for numeric scalars and lsst::geom::Angle).
static FieldBase makeDefault() noexcept
Needed to allow Keys to be default-constructed.
std::string Value
the type returned by BaseRecord::get
ndarray::ArrayRef< U const, 1, 1 > ConstReference
the type returned by BaseRecord::operator[] (const)
ConstReference getConstReference(Element const *p, ndarray::Manager::Ptr const &m) const
Used to implement BaseRecord::operator[] (const).
char Element
the type of subfields and array elements
static std::string getTypeString()
Return a string description of the field type.
static FieldBase makeDefault() noexcept
Needed to allow Keys to be default-constructed.
void stream(std::ostream &os) const
Defines how Fields are printed.
FieldBase(int size=0)
Construct a FieldBase with the given size.
int computeCovariancePackedSize(int size)
Defines the packed size of a covariance matrices.
Value getValue(Element const *p, ndarray::Manager::Ptr const &) const
Used to implement BaseRecord::get.
T Value
the type returned by BaseRecord::get
ndarray::ArrayRef< U, 1, 1 > Reference
the type returned by BaseRecord::operator[]
FieldBase(FieldBase &&) noexcept=default
void stream(std::ostream &os) const
Defines how Fields are printed.
FieldBase(FieldBase const &) noexcept=default
FieldBase(FieldBase const &) noexcept=default