2 #ifndef AFW_TABLE_Schema_h_INCLUDED
3 #define AFW_TABLE_Schema_h_INCLUDED
7 #include "boost/shared_ptr.hpp"
8 #include "boost/ref.hpp"
18 namespace lsst {
namespace afw {
namespace table {
71 std::string
join(std::string
const & a, std::string
const &
b)
const;
73 std::string
join(std::string
const & a, std::string
const &
b, std::string
const & c)
const {
77 std::string
const & a, std::string
const &
b, std::string
const & c, std::string
const & d
101 template <
typename T>
129 std::set<std::string>
getNames(
bool topOnly=
false)
const;
153 template <
typename T>
164 template <
typename T>
166 std::string
const &
name, std::string
const & doc, std::string
const & units =
"",
180 template <
typename T>
182 std::string
const & name, std::string
const & doc,
FieldBase<T> const & base,
189 template <
typename T>
203 template <
typename F>
206 std::for_each(
_impl->getItems().begin(),
_impl->getItems().end(), visitor);
246 template <
typename T>
335 template <
typename T>
339 SubSchema
operator[](std::string
const & name)
const;
350 std::set<std::string>
getNames(
bool topOnly=
false)
const;
358 template <
typename T>
367 template <
typename T>
381 inline SubSchema
Schema::operator[](std::
string const & name)
const {
387 #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 Angle).
Schema()
Construct an empty Schema.
void forEach(F func) const
Apply a functor to each SchemaItem in the Schema.
A proxy type for name lookups in a Schema.
boost::shared_ptr< Impl > _impl
ComparisonFlags
Bit flags used when comparing schemas.
Keys have the same types offsets, and sizes.
table::Key< std::string > name
boost::shared_ptr< AliasMap > getAliasMap() const
std::string const & _name
afw::table::Schema schema
Mapping class that holds aliases for a Schema.
void disconnectAliases()
Sever the connection between this schema and any others with which it shares aliases.
Schemas have identical AliasMaps.
std::set< std::string > getNames(bool topOnly=false) const
Return a set of field names in the schema.
Key< T > addField(Field< T > const &field, bool doReplace=false)
Add a new field to the Schema, and return the associated Key.
void _edit()
Copy on write; should be called by all mutators (except for alias mutators).
int getFlagFieldCount() const
The number of Flag fields.
boost::shared_ptr< AliasMap > _aliases
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).
Fields have the same names (ordered).
int getFieldCount() const
The total number of fields.
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 getRecordSize() const
Return the raw size of a record in bytes.
A description of a field in a table.
SubSchema operator[](std::string const &name) const
Look up a (possibly incomplete) name in the Schema.
int compare(Schema const &other, int flags=EQUAL_KEYS) const
Do a detailed equality comparison of two schemas.
A private implementation class to hide the messy details of 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.
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.
A functor-wrapper used in the implementation of Schema::forEach.
friend std::ostream & operator<<(std::ostream &os, Schema const &schema)
Stringification.
int getNonFlagFieldCount() const
The number of non-Flag fields.
int contains(Schema const &other, int flags=EQUAL_KEYS) const
Test whether the given schema is a subset of this.
A class used as a handle to a particular field in a table.
std::string join(std::string const &a, std::string const &b) const
Join strings using the field delimiter appropriate for this Schema.
void replaceField(Key< T > const &key, Field< T > const &field)
Replace the Field (name/description) for an existing Key.
bool operator==(Schema const &other) const
Equality comparison.
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.
afw::table::Key< double > b
SchemaItem< T > find(std::string const &name) const
Find a SchemaItem in the Schema by name.
SchemaItem< T > find(std::string const &name) const
Find an item by name (used to implement Schema::find).
Citizen is a class that should be among all LSST classes base classes, and handles basic memory manag...
void setAliasMap(boost::shared_ptr< AliasMap > aliases)
Fields have the same documentation (ordered).
Fields are identical (but aliases may not be).
A simple pair-like struct for mapping a Field (name and description) with a Key (used for actual data...