38 if (docData.
empty())
return result;
39 result._size = docData.
size();
41 schema.
join(name,
"0"),
43 for (
int i = 1; i < result._size; ++i) {
54 if (size == 0)
return result;
57 schema.
join(name,
"0"),
59 for (
int i = 1; i < result._size; ++i) {
67 if (
keys.empty())
return;
68 _begin =
keys.front();
69 for (
int i = 1; i <
_size; ++i) {
70 if (
keys[i].getOffset() - _begin.getOffset() !=
static_cast<int>(i *
sizeof(T))) {
72 "Keys passed to ArrayKey constructor are not contiguous");
89 if (current.
getOffset() - _begin.getOffset() !=
static_cast<int>(
_size *
sizeof(T))) {
91 "Keys discovered in Schema are not contiguous");
101 template <
typename T>
103 template <
typename T>
105 template <
typename T>
108 template <
typename T>
110 return ndarray::external(record.
getElement(_begin), ndarray::makeVector(
_size), ndarray::ROW_MAJOR,
114 template <
typename T>
118 "Size of input array (%d) does not match size of array field (%d)");
122 template <
typename T>
124 return ndarray::external(record.
getElement(_begin), ndarray::makeVector(
_size), ndarray::ROW_MAJOR,
128 template <
typename T>
130 return ndarray::external(record.
getElement(_begin), ndarray::makeVector(
_size), ndarray::ROW_MAJOR,
134 template <
typename T>
136 if (i < 0 || i >=
_size) {
139 return detail::Access::makeKey<T>(_begin.getOffset() + i *
sizeof(T));
142 template <
typename T>
144 if (begin < 0 || end >
_size) {
146 "ArrayKey slice range does not fit within valid range");
148 return ArrayKey((*
this)[begin], end - begin);
Defines the fields and offsets for a table.
afw::table::Key< afw::table::Array< Scalar > > ArrayKey
Typedefs to be used for probability and parameter values.
A FunctorKey used to get or set a ndarray::Array from a sequence of scalar Keys.
table::Key< table::Array< int > > _size
A proxy type for name lookups in a Schema.
int getOffset() const noexcept
Return the offset (in bytes) of this field within a record.
#define LSST_THROW_IF_NE(N1, N2, EXC_CLASS, MSG)
Check whether the given values are equal, and throw an LSST Exception if they are not...
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
Reports attempts to exceed implementation-defined length limits for some classes. ...
daf::base::PropertySet * set
ArrayKey() noexcept
Default constructor; instance will not be usable unless subsequently assigned to. ...
ndarray::Manager::Ptr getManager() const
Reports attempts to access elements using an invalid key.
A base class for image defects.
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Tag types used to declare specialized field types.
Field< T >::Element * getElement(Key< T > const &key)
Return a pointer to the underlying elements of a field (non-const).
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
Base class for all records.
A class used as a handle to a particular field in a table.
Reports invalid arguments.
ItemVariant const * other
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
static ArrayKey addFields(Schema &schema, std::string const &name, std::string const &doc, std::string const &unit, std::vector< T > const &docData)
Add an array of fields to a Schema, and return an ArrayKey that points to them.