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"
12 #include "boost/type_traits/remove_const.hpp"
13 #include "boost/type_traits/remove_reference.hpp"
17 namespace lsst {
namespace afw {
namespace table {
28 #ifndef SWIG // see comment block in tableLib.i; workaround to avoid dangling references
72 typedef boost::mpl::transform<FieldTypes,MakeItem>::type
ItemTypes;
74 typedef boost::make_variant_over< ItemTypes >::type
ItemVariant;
78 typedef std::map<std::string,int>
NameMap;
82 typedef std::map<std::pair<int,int>,
int>
FlagMap;
101 template <
typename T>
108 std::set<std::string>
getNames(
bool topOnly)
const;
111 std::set<std::string>
getNames(
bool topOnly, std::string
const & prefix)
const;
113 template <
typename T>
117 template <
typename T>
124 template <
typename T>
128 template <
typename T>
142 daf::base::
Citizen(typeid(this)),
155 template <
typename F>
159 template <
typename T>
172 boost::apply_visitor(*
this, v);
186 template <
typename T>
202 #endif // !AFW_TABLE_DETAIL_SchemaImpl_h_INCLUDED
std::set< std::string > getNames(bool topOnly) const
Return a set of field names (used to implement Schema::getNames).
table::Key< std::string > name
std::map< std::string, int > NameMap
A map from field names to position in the vector, so we can do name lookups.
void replaceField(Key< T > const &key, Field< T > const &field)
Replace the Field in an existing SchemaItem without changing the Key.
void operator()(SchemaItem< T > const &x) const
Call the wrapped function.
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...
int getFlagFieldCount() const
The number of Flag fields.
Boost.MPL metafunction that returns a SchemaItem<T> given a T.
VisitorWrapper(F func)
Construct the wrapper.
std::vector< ItemVariant > ItemContainer
A std::vector whose elements can be any of the allowed SchemaItem types.
A description of a field in a table.
Tag types used to declare specialized field types.
void operator()(ItemVariant const &v) const
Invoke the visitation.
A private implementation class to hide the messy details of Schema.
ItemContainer const & getItems() const
Return the vector of SchemaItem variants.
boost::make_variant_over< ItemTypes >::type ItemVariant
A Boost.Variant type that can hold any one of the allowed SchemaItem types.
A functor-wrapper used in the implementation of Schema::forEach.
A class used as a handle to a particular field in a table.
Citizen(const std::type_info &)
Key specialization for Flag.
std::map< int, int > OffsetMap
A map from standard field offsets to position in the vector, so we can do field lookups.
Key< T > addFieldImpl(int elementSize, int elementCount, Field< T > const &field, bool doReplace)
int getNonFlagFieldCount() const
The number of non-Flag fields.
int getRecordSize() const
The size of a record in bytes.
SchemaImpl()
Default constructor.
SchemaItem< T > find(std::string const &name) const
Find an item by name (used to implement Schema::find).
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.
boost::mpl::transform< FieldTypes, MakeItem >::type ItemTypes
An MPL sequence of all the allowed SchemaItem templates.
int contains(SchemaItem< T > const &item, int flags) const
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a field to the schema (used to implement Schema::addField).
SchemaItem(Key< T > const &key_, Field< T > const &field_)
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...