LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
Go to the documentation of this file.
2 #ifndef AFW_TABLE_SchemaMapper_h_INCLUDED
3 #define AFW_TABLE_SchemaMapper_h_INCLUDED
35 return _impl->_output.
addField(newField, doReplace);
97 template <
typename Predicate>
128 template <
typename T>
132 template <
typename T>
148 template <
typename F>
217 template <
typename Predicate>
218 struct AddMappingsWhere {
219 template <
typename T>
221 if (predicate(item))
mapper->addMapping(item.
key, doReplace);
224 AddMappingsWhere(
SchemaMapper* mapper_, Predicate predicate_,
bool doReplace_)
225 :
mapper(mapper_), predicate(predicate_), doReplace(doReplace_) {}
232 typedef detail::SchemaMapperImpl Impl;
237 template <
typename Predicate>
239 _impl->_input.
forEach(AddMappingsWhere<Predicate>(
this, predicate, doReplace));
245 #endif // !AFW_TABLE_SchemaMapper_h_INCLUDED
void addMappingsWhere(Predicate predicate, bool doReplace=true)
Add mappings for all fields that match criteria defined by a predicate.
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.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
bool isMapped(Key< T > const &inputKey) const
Return true if the given input Key is mapped to an output Key.
void invert()
Swap the input and output schemas in-place.
void forEach(F &&func) const
Call the given functor for each key pair in the mapper.
Schema const getInputSchema() const
Return the input schema (copy-on-write).
Defines the fields and offsets for a table.
Schema & editOutputSchema()
Return a reference to the output schema that allows it to be modified in place.
void forEach(F &&func) const
Apply a functor to each SchemaItem in the Schema.
Key< T > getMapping(Key< T > const &inputKey) const
Return the output Key corresponding to the given input Key, or raise NotFoundError.
A functor-wrapper used in the implementation of SchemaMapper::forEach.
SchemaMapper & operator=(SchemaMapper const &other)
Assignment (copy-on-write).
Key< T > addMapping(Key< T > const &inputKey, char const *outputName, bool doReplace=true)=delete
This deliberately deleted overload ensures we don't accidentally cast string literals to bool.
ItemVariant const * other
A mapping between the keys of two Schemas, used to copy data between them.
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...
SchemaMapper()
Construct an empty mapper; useless unless you assign a fully-constructed one to it.
A class used as a handle to a particular field in a table.
A base class for image defects.
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.
static SchemaMapper removeMinimalSchema(Schema const &input, Schema const &minimal)
Create a mapper by removing fields from the front of a schema.
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 description of a field in a table.
Schema const getOutputSchema() const
Return the output schema (copy-on-write).
void addMinimalSchema(Schema const &minimal, bool doMap=true)
Add the given minimal schema to the output schema.