LSSTApplications
18.0.0+106,18.0.0+50,19.0.0,19.0.0+1,19.0.0+10,19.0.0+11,19.0.0+13,19.0.0+17,19.0.0+2,19.0.0-1-g20d9b18+6,19.0.0-1-g425ff20,19.0.0-1-g5549ca4,19.0.0-1-g580fafe+6,19.0.0-1-g6fe20d0+1,19.0.0-1-g7011481+9,19.0.0-1-g8c57eb9+6,19.0.0-1-gb5175dc+11,19.0.0-1-gdc0e4a7+9,19.0.0-1-ge272bc4+6,19.0.0-1-ge3aa853,19.0.0-10-g448f008b,19.0.0-12-g6990b2c,19.0.0-2-g0d9f9cd+11,19.0.0-2-g3d9e4fb2+11,19.0.0-2-g5037de4,19.0.0-2-gb96a1c4+3,19.0.0-2-gd955cfd+15,19.0.0-3-g2d13df8,19.0.0-3-g6f3c7dc,19.0.0-4-g725f80e+11,19.0.0-4-ga671dab3b+1,19.0.0-4-gad373c5+3,19.0.0-5-ga2acb9c+2,19.0.0-5-gfe96e6c+2,w.2020.01
LSSTDataManagementBasePackage
|
A private implementation class to hide the messy details of Schema. More...
#include <SchemaImpl.h>
Classes | |
struct | VisitorWrapper |
A functor-wrapper used in the implementation of Schema::forEach. More... | |
Public Types | |
typedef boost::mpl::transform< FieldTypes, MakeItem >::type | ItemTypes |
An MPL sequence of all the allowed SchemaItem templates. More... | |
typedef boost::make_variant_over< ItemTypes >::type | ItemVariant |
A Boost.Variant type that can hold any one of the allowed SchemaItem types. More... | |
typedef std::vector< ItemVariant > | ItemContainer |
A std::vector whose elements can be any of the allowed SchemaItem types. More... | |
typedef std::map< std::string, int > | NameMap |
A map from field names to position in the vector, so we can do name lookups. More... | |
typedef std::map< int, int > | OffsetMap |
A map from standard field offsets to position in the vector, so we can do field lookups. More... | |
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. More... | |
Public Member Functions | |
int | getRecordSize () const |
The size of a record in bytes. More... | |
int | getFieldCount () const |
The total number of fields. More... | |
int | getFlagFieldCount () const |
The number of Flag fields. More... | |
int | getNonFlagFieldCount () const |
The number of non-Flag fields. More... | |
template<typename T > | |
SchemaItem< T > | find (std::string const &name) const |
Find an item by name (used to implement Schema::find). More... | |
template<typename T > | |
SchemaItem< T > | find (Key< T > const &key) const |
Find an item by key (used to implement Schema::find). More... | |
SchemaItem< Flag > | find (Key< Flag > const &key) const |
Find an item by key (used to implement Schema::find). More... | |
template<typename F > | |
void | findAndApply (std::string const &name, F &&func) const |
Find an item by name and run the given functor on it. More... | |
std::set< std::string > | getNames (bool topOnly) const |
Return a set of field names (used to implement Schema::getNames). More... | |
std::set< std::string > | getNames (bool topOnly, std::string const &prefix) const |
Return a set of field names (used to implement SubSchema::getNames). More... | |
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). More... | |
Key< Flag > | addField (Field< Flag > const &field, bool doReplace=false) |
Add a field to the schema (used to implement Schema::addField). More... | |
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). More... | |
Key< std::string > | addField (Field< std::string > const &field, bool doReplace=false) |
Add a field to the schema (used to implement Schema::addField). More... | |
template<typename T > | |
void | replaceField (Key< T > const &key, Field< T > const &field) |
Replace the Field in an existing SchemaItem without changing the Key. More... | |
ItemContainer const & | getItems () const |
Return the vector of SchemaItem variants. More... | |
SchemaImpl () | |
Default constructor. More... | |
Static Public Attributes | |
static int const | VERSION = 3 |
Friends | |
class | detail::Access |
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.
Definition at line 48 of file SchemaImpl.h.
typedef std::map<std::pair<int, int>, int> lsst::afw::table::detail::SchemaImpl::FlagMap |
A map from Flag field offset/bit pairs to position in the vector, so we can do Flag field lookups.
Definition at line 72 of file SchemaImpl.h.
A std::vector whose elements can be any of the allowed SchemaItem types.
Definition at line 66 of file SchemaImpl.h.
typedef boost::mpl::transform<FieldTypes, MakeItem>::type lsst::afw::table::detail::SchemaImpl::ItemTypes |
An MPL sequence of all the allowed SchemaItem templates.
Definition at line 62 of file SchemaImpl.h.
typedef boost::make_variant_over<ItemTypes>::type lsst::afw::table::detail::SchemaImpl::ItemVariant |
A Boost.Variant type that can hold any one of the allowed SchemaItem types.
Definition at line 64 of file SchemaImpl.h.
typedef std::map<std::string, int> lsst::afw::table::detail::SchemaImpl::NameMap |
A map from field names to position in the vector, so we can do name lookups.
Definition at line 68 of file SchemaImpl.h.
typedef std::map<int, int> lsst::afw::table::detail::SchemaImpl::OffsetMap |
A map from standard field offsets to position in the vector, so we can do field lookups.
Definition at line 70 of file SchemaImpl.h.
|
inlineexplicit |
Default constructor.
Definition at line 146 of file SchemaImpl.h.
Key< T > lsst::afw::table::detail::SchemaImpl::addField | ( | Field< T > const & | field, |
bool | doReplace = false |
||
) |
Add a field to the schema (used to implement Schema::addField).
Definition at line 504 of file Schema.cc.
Key< Flag > lsst::afw::table::detail::SchemaImpl::addField | ( | Field< Flag > const & | field, |
bool | doReplace = false |
||
) |
Add a field to the schema (used to implement Schema::addField).
Definition at line 508 of file Schema.cc.
Key< Array< T > > lsst::afw::table::detail::SchemaImpl::addField | ( | Field< Array< T > > const & | field, |
bool | doReplace = false |
||
) |
Add a field to the schema (used to implement Schema::addField).
Definition at line 484 of file Schema.cc.
Key< std::string > lsst::afw::table::detail::SchemaImpl::addField | ( | Field< std::string > const & | field, |
bool | doReplace = false |
||
) |
Add a field to the schema (used to implement Schema::addField).
Definition at line 493 of file Schema.cc.
int lsst::afw::table::detail::SchemaImpl::contains | ( | SchemaItem< T > const & | item, |
int | flags | ||
) | const |
Definition at line 415 of file Schema.cc.
SchemaItem< T > lsst::afw::table::detail::SchemaImpl::find | ( | std::string const & | name | ) | const |
Find an item by name (used to implement Schema::find).
Definition at line 202 of file Schema.cc.
SchemaItem< T > lsst::afw::table::detail::SchemaImpl::find | ( | Key< T > const & | key | ) | const |
Find an item by key (used to implement Schema::find).
Definition at line 289 of file Schema.cc.
SchemaItem< Flag > lsst::afw::table::detail::SchemaImpl::find | ( | Key< Flag > const & | key | ) | const |
Find an item by key (used to implement Schema::find).
Definition at line 315 of file Schema.cc.
|
inline |
Find an item by name and run the given functor on it.
Definition at line 99 of file SchemaImpl.h.
|
inline |
|
inline |
|
inline |
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.
Definition at line 143 of file SchemaImpl.h.
std::set< std::string > lsst::afw::table::detail::SchemaImpl::getNames | ( | bool | topOnly | ) | const |
Return a set of field names (used to implement Schema::getNames).
Definition at line 441 of file Schema.cc.
std::set< std::string > lsst::afw::table::detail::SchemaImpl::getNames | ( | bool | topOnly, |
std::string const & | prefix | ||
) | const |
Return a set of field names (used to implement SubSchema::getNames).
Definition at line 460 of file Schema.cc.
|
inline |
|
inline |
The size of a record in bytes.
Definition at line 75 of file SchemaImpl.h.
void lsst::afw::table::detail::SchemaImpl::replaceField | ( | Key< T > const & | key, |
Field< T > const & | field | ||
) |
Replace the Field in an existing SchemaItem without changing the Key.
Definition at line 383 of file Schema.cc.
|
friend |
Definition at line 185 of file SchemaImpl.h.
|
static |
Definition at line 59 of file SchemaImpl.h.