2 #ifndef AFW_TABLE_Schema_h_INCLUDED
3 #define AFW_TABLE_Schema_h_INCLUDED
16 namespace lsst {
namespace afw {
namespace table {
69 std::string
join(std::string
const & a, std::string
const &
b)
const;
71 std::string
join(std::string
const & a, std::string
const &
b, std::string
const & c)
const {
75 std::string
const & a, std::string
const &
b, std::string
const & c, std::string
const & d
127 std::set<std::string>
getNames(
bool topOnly=
false)
const;
151 template <
typename T>
162 template <
typename T>
164 std::string
const &
name, std::string
const & doc, std::string
const & units =
"",
178 template <
typename T>
180 std::string
const & name, std::string
const & doc,
FieldBase<T> const & base,
187 template <
typename T>
199 template <
typename F>
202 std::for_each(
_impl->getItems().begin(),
_impl->getItems().end(), visitor);
242 template <
typename T>
345 template <
typename T>
349 SubSchema
operator[](std::string
const & name)
const;
360 std::set<std::string>
getNames(
bool topOnly=
false)
const;
368 template <
typename T>
377 template <
typename T>
391 inline SubSchema
Schema::operator[](std::
string const & name)
const {
397 #endif // !AFW_TABLE_Schema_h_INCLUDED
Defines the fields and offsets for a table.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
Schema()
Construct an empty Schema.
Field base class default implementation (used for numeric scalars and Angle).
A proxy type for name lookups in a Schema.
ComparisonFlags
Bit flags used when comparing schemas.
table::Key< std::string > name
std::string const & _name
Class for storing ordered metadata with comments.
afw::table::Schema schema
static Schema fromFitsMetadata(daf::base::PropertyList &header, bool stripMetadata=true)
Construct from reading a FITS header.
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.
int getFieldCount() const
The total number of fields.
Mapping class that holds aliases for a Schema.
boost::shared_ptr< AliasMap > _aliases
Fields are identical (but aliases may not be).
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
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.
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.
A simple struct that combines the two arguments that must be passed to most cfitsio routines and cont...
int compare(Schema const &other, int flags=EQUAL_KEYS) const
Do a detailed equality comparison of two schemas.
void forEach(F &&func) const
Apply a functor to each SchemaItem in the Schema.
Schemas have identical AliasMaps.
void setAliasMap(boost::shared_ptr< AliasMap > aliases)
Set the alias map.
SubSchema operator[](std::string const &name) const
Look up a (possibly incomplete) name in the Schema.
int getFlagFieldCount() const
The number of Flag fields.
Keys have the same types offsets, and sizes.
std::set< std::string > getNames(bool topOnly=false) const
Return a set of field names in the schema.
Lifetime-management for memory that goes into FITS memory files.
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.
A description of a field in a table.
std::string const & getPrefix() const
Return the prefix that defines this SubSchema relative to its parent Schema.
static Schema readFits(std::string const &filename, int hdu=0)
Construct from reading a FITS file.
boost::shared_ptr< Impl > _impl
Fields have the same documentation (ordered).
void _edit()
Copy on write; should be called by all mutators (except for alias mutators).
A private implementation class to hide the messy details of Schema.
bool operator!=(Schema const &other) const
Equality comparison.
boost::shared_ptr< AliasMap > getAliasMap() const
Return the map of aliases.
A functor-wrapper used in the implementation of Schema::forEach.
friend std::ostream & operator<<(std::ostream &os, Schema const &schema)
Stringification.
A class used as a handle to a particular field in a table.
Fields have the same units (ordered).
SchemaItem< T > find(std::string const &name) const
Find an item by name (used to implement Schema::find).
void replaceField(Key< T > const &key, Field< T > const &field)
Replace the Field (name/description) for an existing Key.
int getRecordSize() const
Return the raw size of a record in bytes.
afw::table::Key< double > b
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
daf::base::Citizen & getCitizen()
Get the Citizen corresponding to this Schema (SchemaImpl is what inherits from Citizen).
Fields have the same names (ordered).
bool operator==(Schema const &other) const
Equality comparison.
int getNonFlagFieldCount() const
The number of non-Flag fields.
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...