File SchemaImpl.h

namespace lsst

Class for a simple mapping implementing a generic AstrometryTransform.

Remove all non-astronomical counts from the Chunk Exposure’s pixels.

Forward declarations for lsst::utils::Cache

For details on the Cache class, see the Cache.h file.

It uses a template rather than a pointer so that the derived classes can use the specifics of the transform. The class simplePolyMapping overloads a few routines.

A base class for image defects

Numeric constants used by the Integrate.h integrator routines.

Compute Image Statistics

Note

Gauss-Kronrod-Patterson quadrature coefficients for use in quadpack routine qng. These coefficients were calculated with 101 decimal digit arithmetic by L. W. Fullerton, Bell Labs, Nov 1981.

Note

The Statistics class itself can only handle lsst::afw::image::MaskedImage() types. The philosophy has been to handle other types by making them look like lsst::afw::image::MaskedImage() and reusing that code. Users should have no need to instantiate a Statistics object directly, but should use the overloaded makeStatistics() factory functions.

namespace afw
namespace table
template<typename T>
struct SchemaItem
#include <SchemaImpl.h>

A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data access).

Public Functions

SchemaItem(Key<T> const &key_, Field<T> const &field_)

Public Members

Key<T> key
Field<T> field
namespace detail
class SchemaImpl
#include <SchemaImpl.h>

A private implementation class to hide the messy details of Schema.

This can’t be a real pimpl class, because some of the most important functionality is in the forEach function, a templated function we can’t explicitly instantiate in a source file. But putting all the details here draws a clear line between what users should look at (Schema) and what they shouldn’t (this).

Because Schema holds SchemaImpl by shared pointer, one SchemaImpl can be shared between multiple Schemas (and SubSchemas), which implement copy-on-write by creating a new SchemaImpl if the pointer they have isn’t unique when they are modified.

Public Types

typedef boost::mpl::transform<FieldTypes, MakeItem>::type ItemTypes

An MPL sequence of all the allowed SchemaItem templates.

typedef boost::make_variant_over<ItemTypes>::type ItemVariant

A Boost.Variant type that can hold any one of the allowed SchemaItem types.

typedef std::vector<ItemVariant> ItemContainer

A std::vector whose elements can be any of the allowed SchemaItem types.

typedef std::map<std::string, int> NameMap

A map from field names to position in the vector, so we can do name lookups.

typedef std::map<int, int> OffsetMap

A map from standard field offsets to position in the vector, so we can do field lookups.

typedef std::map<std::pair<int, int>, int> FlagMap

A map from Flag field offset/bit pairs to position in the vector, so we can do Flag field lookups.

Public Functions

int getRecordSize() const

The size of a record in bytes.

int getFieldCount() const

The total number of fields.

int getFlagFieldCount() const

The number of Flag fields.

int getNonFlagFieldCount() const

The number of non-Flag fields.

template<typename T>
SchemaItem<T> find(std::string const &name) const

Find an item by name (used to implement Schema::find).

template<typename T>
SchemaItem<T> find(Key<T> const &key) const

Find an item by key (used to implement Schema::find).

SchemaItem<Flag> find(Key<Flag> const &key) const

Find an item by key (used to implement Schema::find).

template<typename F>
void findAndApply(std::string const &name, F &&func) const

Find an item by name and run the given functor on it.

std::set<std::string> getNames(bool topOnly) const

Return a set of field names (used to implement Schema::getNames).

std::set<std::string> getNames(bool topOnly, std::string const &prefix) const

Return a set of field names (used to implement SubSchema::getNames).

template<typename T>
int contains(SchemaItem<T> const &item, int flags) const
template<typename T>
Key<T> addField(Field<T> const &field, bool doReplace = false)

Add a field to the schema (used to implement Schema::addField).

Key<Flag> addField(Field<Flag> const &field, bool doReplace = false)

Add a field to the schema (used to implement Schema::addField).

template<typename T>
Key<Array<T>> addField(Field<Array<T>> const &field, bool doReplace = false)

Add a field to the schema (used to implement Schema::addField).

Key<std::string> addField(Field<std::string> const &field, bool doReplace = false)

Add a field to the schema (used to implement Schema::addField).

template<typename T>
void replaceField(Key<T> const &key, Field<T> const &field)

Replace the Field in an existing SchemaItem without changing the Key.

ItemContainer const &getItems() const

Return the vector of SchemaItem variants.

Fields are in the order they are added. That means they’re also ordered with increasing Key offsets, except for Flag fields, which are in increasing order of (offset, bit) relative to each other, but not relative to all the other fields.

SchemaImpl()

Default constructor.

Public Static Attributes

int const VERSION = 3

Private Functions

template<typename T>
Key<T> addFieldImpl(int elementSize, int elementCount, Field<T> const &field, bool doReplace)

Private Members

int _recordSize
int _lastFlagField
int _lastFlagBit
ItemContainer _items
NameMap _names
OffsetMap _offsets
FlagMap _flags

Friends

friend lsst::afw::table::detail::detail::Access
struct MakeItem

Boost.MPL metafunction that returns a SchemaItem<T> given a T.

template<typename T>
struct apply

Public Types

typedef SchemaItem<T> type
template<typename F>
struct VisitorWrapper : public boost::static_visitor<>
#include <SchemaImpl.h>

A functor-wrapper used in the implementation of Schema::forEach.

Visitor functors used with Boost.Variant (see the Boost.Variant docs) must inherit from boost::static_visitor<> to declare their return type (void, in this case). By wrapping user-supplied functors with this class, we can hide the fact that we’ve implemented SchemaImpl using Boost.Variant (because they won’t need to inherit from static_visitor themselves.

Public Functions

template<typename T>
void operator()(SchemaItem<T> const &x) const

Call the wrapped function.

void operator()(ItemVariant const &v) const

Invoke the visitation.

The call to boost::apply_visitor will call the appropriate template of operator().

This overload allows a VisitorWrapper to be applied directly on a variant object with function-call syntax, allowing us to use it on our vector of variants with std::for_each and other STL algorithms.

template<typename T>
VisitorWrapper(T &&func)

Construct the wrapper.

Private Members

F _func