LSSTApplications  1.1.2+25,10.0+13,10.0+132,10.0+133,10.0+224,10.0+41,10.0+8,10.0-1-g0f53050+14,10.0-1-g4b7b172+19,10.0-1-g61a5bae+98,10.0-1-g7408a83+3,10.0-1-gc1e0f5a+19,10.0-1-gdb4482e+14,10.0-11-g3947115+2,10.0-12-g8719d8b+2,10.0-15-ga3f480f+1,10.0-2-g4f67435,10.0-2-gcb4bc6c+26,10.0-28-gf7f57a9+1,10.0-3-g1bbe32c+14,10.0-3-g5b46d21,10.0-4-g027f45f+5,10.0-4-g86f66b5+2,10.0-4-gc4fccf3+24,10.0-40-g4349866+2,10.0-5-g766159b,10.0-5-gca2295e+25,10.0-6-g462a451+1
LSSTDataManagementBasePackage
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
lsst.afw.table::SubSchema Class Reference

A proxy type for name lookups in a Schema. More...

#include <Schema.h>

Public Member Functions

template<typename T >
SchemaItem< T > find (std::string const &name) const
 Find a nested SchemaItem by name. More...
 
SubSchema operator[] (std::string const &name) const
 Return a nested proxy. More...
 
std::string const & getPrefix () const
 Return the prefix that defines this SubSchema relative to its parent Schema. More...
 
std::set< std::string > getNames (bool topOnly=false) const
 Return a set of nested names that start with the SubSchema's prefix. More...
 
template<typename T >
 operator Key< T > () const
 Implicit conversion to the appropriate Key type. More...
 
template<typename T >
 operator Field< T > () const
 Implicit conversion to the appropriate Key type. More...
 

Private Types

typedef detail::SchemaImpl Impl
 

Private Member Functions

 SubSchema (boost::shared_ptr< Impl > impl, boost::shared_ptr< AliasMap > aliases, std::string const &name)
 

Private Attributes

boost::shared_ptr< Impl_impl
 
boost::shared_ptr< AliasMap_aliases
 
std::string _name
 

Friends

class Schema
 

Detailed Description

A proxy type for name lookups in a Schema.

Elements of schema names are assumed to be separated by periods ("a.b.c.d"); an incomplete lookup is one that does not resolve to a field. Not that even complete lookups can have nested names; a Point field, for instance, has "x" and "y" nested names.

This proxy object is implicitly convertible to both the appropriate Key type and the appropriate Field type, if the name is a complete one, and supports additional find() operations for nested names.

SubSchema is implemented as a proxy that essentially calls Schema::find after concatenating strings. It does not provide any performance advantage over using Schema::find directly. It is also lazy, so looking up a name prefix that does not exist within the schema is not considered an error until the proxy is used.

Some examples:

* Schema schema(false);
* Key<int> a_i = schema.addField<int>("a.i", "integer field");
* Key< Point<double> > a_p = schema.addField< Point<double> >("a.p", "point field");
*
* assert(schema["a.i"] == a_i);
* SubSchema a = schema["a"];
* assert(a["i"] == a_i);
* Field<int> f_a_i = schema["a.i"];
* assert(f_a_i.getDoc() == "integer field");
* assert(schema["a.i"] == "a.i");
* assert(schema.find("a.p.x") == a_p.getX());
*

Definition at line 372 of file Schema.h.

Member Typedef Documentation

Definition at line 373 of file Schema.h.

Constructor & Destructor Documentation

lsst.afw.table::SubSchema::SubSchema ( boost::shared_ptr< Impl impl,
boost::shared_ptr< AliasMap aliases,
std::string const &  name 
)
private

Member Function Documentation

template<typename T >
SchemaItem<T> lsst.afw.table::SubSchema::find ( std::string const &  name) const

Find a nested SchemaItem by name.

std::set<std::string> lsst.afw.table::SubSchema::getNames ( bool  topOnly = false) const

Return a set of nested names that start with the SubSchema's prefix.

Returns an instance of Python's builtin set in Python.

See Also
Schema::getNames
std::string const& lsst.afw.table::SubSchema::getPrefix ( ) const
inline

Return the prefix that defines this SubSchema relative to its parent Schema.

Definition at line 384 of file Schema.h.

384 { return _name; }
template<typename T >
lsst.afw.table::SubSchema::operator Field< T > ( ) const
inline

Implicit conversion to the appropriate Key type.

Implicit conversion operators cannot be translated to Python. Instead, the SWIG wrappers provide an equivalent asField() method.

Definition at line 410 of file Schema.h.

410 { return _impl->find<T>(_aliases->apply(_name)).field; }
boost::shared_ptr< AliasMap > _aliases
Definition: Schema.h:419
boost::shared_ptr< Impl > _impl
Definition: Schema.h:418
template<typename T >
lsst.afw.table::SubSchema::operator Key< T > ( ) const
inline

Implicit conversion to the appropriate Key type.

Implicit conversion operators cannot be translated to Python. Instead, the SWIG wrappers provide an equivalent asKey() method.

Definition at line 401 of file Schema.h.

401 { return _impl->find<T>(_aliases->apply(_name)).key; }
boost::shared_ptr< AliasMap > _aliases
Definition: Schema.h:419
boost::shared_ptr< Impl > _impl
Definition: Schema.h:418
SubSchema lsst.afw.table::SubSchema::operator[] ( std::string const &  name) const

Return a nested proxy.

Friends And Related Function Documentation

friend class Schema
friend

Definition at line 414 of file Schema.h.

Member Data Documentation

boost::shared_ptr< AliasMap > lsst.afw.table::SubSchema::_aliases
private

Definition at line 419 of file Schema.h.

boost::shared_ptr< Impl > lsst.afw.table::SubSchema::_impl
private

Definition at line 418 of file Schema.h.

std::string lsst.afw.table::SubSchema::_name
private

Definition at line 420 of file Schema.h.


The documentation for this class was generated from the following file: