42 (boost::format(doc) % docData.
front()).str(), unit);
54 if (size == 0)
return result;
67 if (keys.empty())
return;
68 _begin = keys.front();
70 if (keys[i].getOffset() - _begin.getOffset() != (i *
sizeof(T))) {
72 "Keys passed to ArrayKey constructor are not contiguous");
89 if (current.
getOffset() - _begin.getOffset() != (_size *
sizeof(T))) {
91 "Keys discovered in Schema are not contiguous");
110 return ndarray::external(record.getElement(_begin), ndarray::makeVector(_size), ndarray::ROW_MAJOR,
111 record.getManager());
118 "Size of input array (%d) does not match size of array field (%d)");
119 std::copy(value.begin(), value.end(), record.getElement(_begin));
124 return ndarray::external(record.
getElement(_begin), ndarray::makeVector(_size), ndarray::ROW_MAJOR,
130 return ndarray::external(record.
getElement(_begin), ndarray::makeVector(_size), ndarray::ROW_MAJOR,
139 return detail::Access::makeKey<T>(_begin.getOffset() + i *
sizeof(T));
144 if (begin >=
end ||
end > _size) {
146 "ArrayKey slice range does not fit within valid range");
table::Key< std::string > name
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
#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.
Tag types used to declare specialized field types.
A FunctorKey used to get or set a ndarray::Array from a sequence of scalar Keys.
Key< T > operator[](std::size_t i) const
Return a scalar Key for an element of the array.
void set(BaseRecord &record, ndarray::Array< T const, 1, 1 > const &value) const override
Set an array in the given record.
ArrayKey slice(std::size_t begin, std::size_t end) const
Return a FunctorKey corresponding to a range of elements.
ndarray::ArrayRef< T const, 1, 1 > getConstReference(BaseRecord const &record) const override
Get const reference array from the given record.
ArrayKey() noexcept
Default constructor; instance will not be usable unless subsequently assigned to.
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.
ndarray::ArrayRef< T, 1, 1 > getReference(BaseRecord &record) const override
Get non-const reference array from the given record.
Base class for all records.
Field< T >::Element * getElement(Key< T > const &key)
Return a pointer to the underlying elements of a field (non-const).
ndarray::Manager::Ptr getManager() const
A class used as a handle to a particular field in a table.
std::size_t getOffset() const noexcept
Return the offset (in bytes) of this field within a record.
Defines the fields and offsets for a table.
A proxy type for name lookups in a Schema.
Reports invalid arguments.
Reports attempts to exceed implementation-defined length limits for some classes.
Reports attempts to access elements using an invalid key.