2 #ifndef AFW_TABLE_SchemaMapper_h_INCLUDED
3 #define AFW_TABLE_SchemaMapper_h_INCLUDED
5 #include "boost/scoped_ptr.hpp"
9 namespace lsst {
namespace afw {
namespace table {
34 return _impl->_output.addField(newField, doReplace);
88 template <
typename Predicate>
119 template <
typename T>
123 template <
typename T>
140 template <
typename F>
143 std::for_each(
_impl->_map.begin(),
_impl->_map.end(), visitor);
200 static std::vector<SchemaMapper>
join(
201 std::vector<Schema>
const & inputs,
202 std::vector<std::string>
const & prefixes = std::vector<std::string>()
207 template <
typename Predicate>
210 template <
typename T>
228 template <
typename Predicate>
235 #endif // !AFW_TABLE_SchemaMapper_h_INCLUDED
void forEach(F func) const
Call the given functor for each key pair in the mapper.
Defines the fields and offsets for a table.
A functor-wrapper used in the implementation of SchemaMapper::forEach.
void addMinimalSchema(Schema const &minimal, bool doMap=true)
Add the given minimal schema to the output schema.
Schema & editOutputSchema()
Return a reference to the output schema that allows it to be modified in place.
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
A mapping between the keys of two Schemas, used to copy data between them.
SchemaMapper()
Construct an empty mapper; useless unless you assign a fully-constructed one to it.
Key< T > addOutputField(Field< T > const &newField, bool doReplace=false)
Add a new field to the output Schema that is not connected to the input Schema.
A private implementation class to hide the messy details of SchemaMapper.
AddMappingsWhere(SchemaMapper *mapper_, Predicate predicate_, bool doReplace_)
SchemaMapper & operator=(SchemaMapper const &other)
Assignement (copy-on-write).
void invert()
Swap the input and output schemas in-place.
Key< T > addMapping(Key< T > const &inputKey, bool doReplace=false)
Add a new field to the output Schema that is a copy of a field in the input Schema.
A description of a field in a table.
bool isMapped(Key< T > const &inputKey) const
Return true if the given input Key is mapped to an output Key.
Key< T > getMapping(Key< T > const &inputKey) const
Return the output Key corresponding to the given input Key, or raise NotFoundError.
void addMappingsWhere(Predicate predicate, bool doReplace=true)
Add mappings for all fields that match criteria defined by a predicate.
void operator()(SchemaItem< T > const &item) const
static std::vector< SchemaMapper > join(std::vector< Schema > const &inputs, std::vector< std::string > const &prefixes=std::vector< std::string >())
Combine a sequence of schemas into one, creating a SchemaMapper for each.
detail::SchemaMapperImpl Impl
A class used as a handle to a particular field in a table.
boost::scoped_ptr< Impl > _impl
Schema const getInputSchema() const
Return the input schema (copy-on-write).
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...