|
| std::string | join (std::string const &a, std::string const &b) const |
| | Join strings using the field delimiter appropriate for this Schema. More...
|
| |
| std::string | join (std::string const &a, std::string const &b, std::string const &c) const |
| |
| std::string | join (std::string const &a, std::string const &b, std::string const &c, std::string const &d) const |
| |
| template<typename T > |
| SchemaItem< T > | find (std::string const &name) const |
| | Find a SchemaItem in the Schema by name. More...
|
| |
| template<typename T > |
| SchemaItem< T > | find (Key< T > const &key) const |
| | Find a SchemaItem in the Schema by key. More...
|
| |
| template<typename F > |
| void | findAndApply (std::string const &name, F &&func) const |
| | Find a SchemaItem by name and run a functor on it. More...
|
| |
| SubSchema | operator[] (std::string const &name) const |
| | Look up a (possibly incomplete) name in the Schema. More...
|
| |
| std::set< std::string > | getNames (bool topOnly=false) const |
| | Return a set of field names in the schema. More...
|
| |
| std::size_t | getRecordSize () const |
| | Return the raw size of a record in bytes. More...
|
| |
| std::size_t | getFieldCount () const |
| | The total number of fields. More...
|
| |
| std::size_t | getFlagFieldCount () const |
| | The number of Flag fields. More...
|
| |
| std::size_t | getNonFlagFieldCount () const |
| | The number of non-Flag fields. More...
|
| |
| template<typename T > |
| Key< T > | addField (Field< T > const &field, bool doReplace=false) |
| | Add a new field to the Schema, and return the associated Key. More...
|
| |
| template<typename T > |
| 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. More...
|
| |
| template<typename T > |
| 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. More...
|
| |
| template<typename T > |
| void | replaceField (Key< T > const &key, Field< T > const &field) |
| | Replace the Field (name/description) for an existing Key. More...
|
| |
| template<typename F > |
| void | forEach (F &func) const |
| | Apply a functor to each SchemaItem in the Schema. More...
|
| |
| template<typename F > |
| void | forEach (F const &func) const |
| |
| bool | operator== (Schema const &other) const |
| | Equality comparison. More...
|
| |
| bool | operator!= (Schema const &other) const |
| |
| std::size_t | hash_value () const noexcept |
| | Return a hash of this object. More...
|
| |
| int | compare (Schema const &other, int flags=EQUAL_KEYS) const |
| | Do a detailed equality comparison of two schemas. More...
|
| |
| int | contains (Schema const &other, int flags=EQUAL_KEYS) const |
| | Test whether the given schema is a subset of this. More...
|
| |
| template<typename T > |
| int | contains (SchemaItem< T > const &item, int flags=EQUAL_KEYS) const |
| | Return true if the given item is in this schema. More...
|
| |
| std::shared_ptr< AliasMap > | getAliasMap () const |
| | Return the map of aliases. More...
|
| |
| void | setAliasMap (std::shared_ptr< AliasMap > aliases) |
| | Set the alias map. More...
|
| |
| void | disconnectAliases () |
| | Sever the connection between this schema and any others with which it shares aliases. More...
|
| |
| | Schema () |
| | Construct an empty Schema. More...
|
| |
| | Schema (Schema const &other) |
| | Copy constructor. More...
|
| |
| | Schema (Schema &&other) |
| |
| Schema & | operator= (Schema const &other) |
| |
| Schema & | operator= (Schema &&other) |
| |
| | ~Schema () |
| |
Defines the fields and offsets for a table.
Schema behaves like a container of SchemaItem objects, mapping a descriptive Field object with the Key object used to access record and ColumnView values. A Schema is the most important ingredient in creating a table.
Because offsets for fields are assigned when the field is added to the Schema, Schemas do not support removing fields, though they do allow renaming.
Field names in Schemas are expected to be underscore-separated names (e.g. 'a_b_c', but see Field Names for the full conventions, including when to use underscores vs. CamelCase). The SubSchema class and Schema::operator[] provide a heirarchical interface to these names, but are implemented entirely as string splitting/joining operations that ultimately forward to member functions that operate on the fully-qualified field name, so there is no requirement that names be separated by underscores, and no performance advantage to using a SubSchema.
A SchemaMapper object can be used to define a relationship between two Schemas to be used when copying values from one table to another or loading/saving selected fields to disk.
Schema uses copy-on-write, and hence should always be held by value rather than smart pointer. When creating a Python interface, functions that return Schema by const reference should be converted to return by value (returnCopy) to ensure proper memory management and encapsulation.
Definition at line 51 of file Schema.h.
Return a set of field names in the schema.
If topOnly==true, return a unique list of only the part of the names before the first underscore. For example, if the full list of field names is ['a_b_c', 'a_d', 'e_f'], topOnly==true will return ['a', 'e'].
Returns an instance of Python's builtin set in Python.
Aliases are not returned.
Definition at line 464 of file Schema.cc.