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
Defines the fields and offsets for a table.
A functor-wrapper used in the implementation of SchemaMapper::forEach.
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
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.
SchemaMapper()
Construct an empty mapper; useless unless you assign a fully-constructed one to it.
Schema const getInputSchema() const
Return the input schema (copy-on-write).
A mapping between the keys of two Schemas, used to copy data between them.
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.
void operator()(SchemaItem< T > const &item) const
SchemaMapper & operator=(SchemaMapper const &other)
Assignement (copy-on-write).
void addMappingsWhere(Predicate predicate, bool doReplace=true)
Add mappings for all fields that match criteria defined by a predicate.
A description of a field in a table.
Schema & editOutputSchema()
Return a reference to the output schema that allows it to be modified in place.
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.
A class used as a handle to a particular field in a table.
void addMinimalSchema(Schema const &minimal, bool doMap=true)
Add the given minimal schema to the output schema.
detail::SchemaMapperImpl Impl
void forEach(F func) const
Call the given functor for each key pair in the mapper.
Key< T > getMapping(Key< T > const &inputKey) const
Return the output Key corresponding to the given input Key, or raise NotFoundError.
void invert()
Swap the input and output schemas in-place.
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
bool isMapped(Key< T > const &inputKey) const
Return true if the given input Key is mapped to an output Key.
boost::scoped_ptr< Impl > _impl
AddMappingsWhere(SchemaMapper *mapper_, Predicate predicate_, bool doReplace_)
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...