2 #ifndef AFW_TABLE_Schema_h_INCLUDED 3 #define AFW_TABLE_Schema_h_INCLUDED 102 template <
typename T>
113 template <
typename F>
115 _impl->findAndApply(_aliases->apply(name), std::forward<F>(func));
167 template <
typename T>
177 template <
typename T>
190 template <
typename T>
192 bool doReplace =
false) {
197 template <
typename T>
209 template <
typename F>
212 std::for_each(_impl->getItems().begin(), _impl->getItems().end(), visitor);
252 template <
typename T>
372 template <
typename T>
383 template <
typename F>
385 _impl->findAndApply(_aliases->apply(join(
_name, name)), std::forward<F>(func));
399 template <
typename F>
401 _impl->findAndApply(_aliases->apply(
_name), std::forward<F>(func));
425 template <
typename T>
427 return _impl->find<T>(_aliases->apply(
_name)).key;
437 template <
typename T>
439 return _impl->find<T>(_aliases->apply(
_name)).field;
459 #endif // !AFW_TABLE_Schema_h_INCLUDED
daf::base::Citizen & getCitizen()
Get the Citizen corresponding to this Schema (SchemaImpl is what inherits from Citizen).
Defines the fields and offsets for a table.
Field base class default implementation (used for numeric scalars and lsst::geom::Angle).
void setAliasMap(std::shared_ptr< AliasMap > aliases)
Set the alias map.
Schema()
Construct an empty Schema.
int getRecordSize() const
Return the raw size of a record in bytes.
A proxy type for name lookups in a Schema.
ComparisonFlags
Bit flags used when comparing schemas.
int compare(Schema const &other, int flags=EQUAL_KEYS) const
Do a detailed equality comparison of two schemas.
Keys have the same types offsets, and sizes.
std::string const & _name
afw::table::Schema schema
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
static Schema fromFitsMetadata(daf::base::PropertyList &header, bool stripMetadata=true)
Construct from reading a FITS header.
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
static Schema readFits(std::string const &filename, int hdu=fits::DEFAULT_HDU)
Construct from reading a FITS file.
Schemas have identical AliasMaps.
void findAndApply(std::string const &name, F &&func) const
Find a nested SchemaItem by name and run a functor on it.
std::string join(std::string const &a, std::string const &b, std::string const &c) const
Join strings using the field delimiter appropriate for this Schema.
ItemVariant const * other
void apply(F &&func) const
Run functor on the SchemaItem represented by this SubSchema.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
bool operator!=(Schema const &other) const
Equality comparison.
std::string const & getPrefix() const
Return the prefix that defines this SubSchema relative to its parent Schema.
void forEach(F &&func) const
Apply a functor to each SchemaItem in the Schema.
Key< T > addField(std::string const &name, std::string const &doc, std::string const &units="", FieldBase< T > const &base=FieldBase< T >(), bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
Fields have the same units (ordered).
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Fields have the same names (ordered).
A base class for image defects.
Key< T > addField(std::string const &name, std::string const &doc, FieldBase< T > const &base, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
Lifetime-management for memory that goes into FITS memory files.
A description of a field in a table.
int getFlagFieldCount() const
The number of Flag fields.
std::string join(std::string const &a, std::string const &b, std::string const &c) const
Join strings using the field delimiter appropriate for this Schema.
int getFieldCount() const
The total number of fields.
A private implementation class to hide the messy details of Schema.
A functor-wrapper used in the implementation of Schema::forEach.
std::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
friend std::ostream & operator<<(std::ostream &os, Schema const &schema)
Stringification.
SubSchema operator[](std::string const &name) const
Look up a (possibly incomplete) name in the Schema.
A class used as a handle to a particular field in a table.
bool operator==(Schema const &other) const
Equality comparison.
void replaceField(Key< T > const &key, Field< T > const &field)
Replace the Field (name/description) for an existing Key.
std::string join(std::string const &a, std::string const &b, std::string const &c, std::string const &d) const
Join strings using the field delimiter appropriate for this Schema.
std::string join(std::string const &a, std::string const &b, std::string const &c, std::string const &d) const
Join strings using the field delimiter appropriate for this Schema.
Fields have the same documentation (ordered).
std::set< std::string > getNames(bool topOnly=false) const
Return a set of field names in the schema.
Schema & operator=(Schema const &other)
Fields are identical (but aliases may not be).
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
int getNonFlagFieldCount() const
The number of non-Flag fields.
const int DEFAULT_HDU
Specify that the default HDU should be read.
void findAndApply(std::string const &name, F &&func) const
Find a SchemaItem by name and run a functor on it.
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...