2 #ifndef AFW_TABLE_DETAIL_SchemaImpl_h_INCLUDED 3 #define AFW_TABLE_DETAIL_SchemaImpl_h_INCLUDED 10 #include "boost/variant.hpp" 11 #include "boost/mpl/transform.hpp" 64 static int const VERSION = 3;
103 template <
typename F>
105 auto iter = _names.find(name);
106 if (iter == _names.end()) {
111 visitor(_items[iter->second]);
120 template <
typename T>
124 template <
typename T>
131 template <
typename T>
138 template <
typename T>
148 ItemContainer
const&
getItems()
const {
return _items; }
152 : daf::
base::Citizen(typeid(this)),
167 template <
typename F>
170 template <
typename T>
184 void operator()(ItemVariant
const& v)
const { boost::apply_visitor(*
this, v); }
187 template <
typename T>
197 template <
typename T>
198 Key<T> addFieldImpl(
int elementSize,
int elementCount,
Field<T> const& field,
bool doReplace);
203 ItemContainer _items;
213 #endif // !AFW_TABLE_DETAIL_SchemaImpl_h_INCLUDED int getRecordSize() const
The size of a record in bytes.
bool contains(VertexIterator const begin, VertexIterator const end, UnitVector3d const &v)
VisitorWrapper(T &&func)
Construct the wrapper.
ItemContainer const & getItems() const
Return the vector of SchemaItem variants.
void findAndApply(std::string const &name, F &&func) const
Find an item by name and run the given functor on it.
std::vector< ItemVariant > ItemContainer
A std::vector whose elements can be any of the allowed SchemaItem types.
boost::mpl::transform< FieldTypes, MakeItem >::type ItemTypes
An MPL sequence of all the allowed SchemaItem templates.
boost::make_variant_over< ItemTypes >::type ItemVariant
A Boost.Variant type that can hold any one of the allowed SchemaItem types.
std::map< int, int > OffsetMap
A map from standard field offsets to position in the vector, so we can do field lookups.
int getNonFlagFieldCount() const
The number of non-Flag fields.
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)
A description of a field in a table.
Tag types used to declare specialized field types.
void operator()(SchemaItem< T > const &x) const
Call the wrapped function.
A private implementation class to hide the messy details of Schema.
#define LSST_EXCEPT(type,...)
Create an exception with a given type.
A functor-wrapper used in the implementation of Schema::forEach.
A class used as a handle to a particular field in a table.
Key specialization for Flag.
std::map< std::string, int > NameMap
A map from field names to position in the vector, so we can do name lookups.
SchemaImpl()
Default constructor.
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...
void operator()(ItemVariant const &v) const
Invoke the visitation.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
int getFieldCount() const
The total number of fields.
SchemaItem(Key< T > const &key_, Field< T > const &field_)
int getFlagFieldCount() const
The number of Flag fields.
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...