2#ifndef AFW_TABLE_DETAIL_SchemaImpl_h_INCLUDED
3#define AFW_TABLE_DETAIL_SchemaImpl_h_INCLUDED
49 template <
typename ...E>
50 static std::variant<SchemaItem<E>...> makeItemVariantType(
TypeList<E...>);
91 auto iter = _names.find(name);
92 if (iter == _names.end()) {
94 (boost::format(
"Field with name '%s' not found") % name).str());
105 template <
typename T>
109 template <
typename T>
116 template <
typename T>
123 template <
typename T>
136 SchemaImpl() : _recordSize(0), _lastFlagField(0), _lastFlagBit(0), _items(), _initFlag(false) {}
141 template <
typename T>
#define LSST_EXCEPT(type,...)
Tag types used to declare specialized field types.
A class used as a handle to a particular field in a table.
Defines the fields and offsets for a table.
A proxy type for name lookups in a Schema.
std::set< std::string > getNames(bool topOnly) const
Return a set of field names (used to implement Schema::getNames).
SchemaImpl()
Default constructor.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a field to the schema (used to implement Schema::addField).
int contains(SchemaItem< T > const &item, int flags) const
decltype(auto) findAndApply(std::string const &name, F &&func) const
Find an item by name and run the given functor on it.
std::size_t getRecordSize() const
The size of a record in bytes.
void replaceField(Key< T > const &key, Field< T > const &field)
Replace the Field in an existing SchemaItem without changing the Key.
std::map< std::string, std::size_t > NameMap
A map from field names to position in the vector, so we can do name lookups.
std::size_t getFlagFieldCount() const
The number of Flag fields.
std::size_t getNonFlagFieldCount() const
The number of non-Flag fields.
SchemaItem< T > find(std::string const &name) const
Find an item by name (used to implement Schema::find).
std::map< std::pair< std::size_t, std::size_t >, std::size_t > FlagMap
A map from Flag field offset/bit pairs to position in the vector, so we can do Flag field lookups.
ItemContainer const & getItems() const
Return the vector of SchemaItem variants.
std::size_t getFieldCount() const
The total number of fields.
decltype(makeItemVariantType(FieldTypes{})) ItemVariant
A Boost.Variant type that can hold any one of the allowed SchemaItem types.
std::vector< ItemVariant > ItemContainer
A std::vector whose elements can be any of the allowed SchemaItem types.
std::map< std::size_t, std::size_t > OffsetMap
A map from standard field offsets to position in the vector, so we can do field lookups.
TypeList< RecordId, std::uint16_t, std::int32_t, float, double, lsst::geom::Angle, std::uint8_t, Flag, std::string, Array< std::uint16_t >, Array< int >, Array< float >, Array< double >, Array< std::uint8_t > > FieldTypes
A compile-time list of all field types.
A description of a field in a table.
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...
SchemaItem(Key< T > const &key_, Field< T > const &field_)