Lumiera
0.pre.03
»edit your freedom«
|
#include "lib/diff/record.hpp"
object-like record of data.
For symbolic representation of "objects". A Record holds both attributes (key-value data) plus a list of enclosed children, which are conceived to be within the "scope" of this Record. Optionally, a typeID (metadata) may be defined. Otherwise, this typeID defaults to "NIL"
. The representation of attributes depends on the actual value type, which somehow need the ability to encode the keys within the value data. By default, a specialisation is given for string, using the "key = val"
syntax. Yet the most relevant use case is Record<GenNode>
– using the embedded name-ID of the GenNode elements as key for attributes.
Record elements are meant to be immutable; they can be created from a defining collection. However, we provide a #Mutator mechanism to allow for rebuilding and mutating symbolic data structures based on Records and GenNode. Essentially, Lumiera's diff framework relies on this.
Definition at line 150 of file record.hpp.
Public Types | |
using | iterator = IterAdapter< ElmIter, const Record * > |
using | keyIter = TransformIter< scopeIter, string > |
using | scopeIter = typename iter_stl::_SeqT< const Storage >::Range |
using | valIter = TransformIter< scopeIter, Access > |
Public Member Functions | |
template<typename A , typename C > | |
Record (Symbol typeID, A &&att, C &&chi) | |
template<typename A , typename C > | |
Record (Symbol typeID, std::initializer_list< A > const &&att, std::initializer_list< C > const &&chi) | |
template<typename SEQ > | |
Record (SEQ const &con) | |
Record (std::initializer_list< VAL > const &&ili) | |
Record (Mutator const &mut) | |
copy-initialise (or convert) from the given Mutator instance. More... | |
Record (Mutator &&mut) | |
scopeIter | attribs () const |
size_t | attribSize () const |
iterator | begin () const |
default iteration exposes all data within this "object", starting with the attributes | |
Access | child (size_t idx) const |
size_t | childSize () const |
bool | contains (VAL const &val) const |
bool | empty () const |
iterator | end () const |
Access | get (string key) const |
string | getType () const |
bool | hasAttribute (string key) const |
keyIter | keys () const |
operator std::string () const | |
for diagnostic purpose | |
scopeIter | scope () const |
valIter | vals () const |
Static Public Attributes | |
static const string | TYPE_NIL = string(TYPE_NIL_SYM) |
static const Symbol | TYPE_NIL_SYM = "NIL" |
Classes | |
class | Mutator |
Friends | |
bool | checkPoint (const Record *src, ElmIter &pos) |
Implementation of Iteration-logic: detect iteration end. More... | |
void | iterNext (const Record *, ElmIter &pos) |
Implementation of Iteration-logic: pull next element. More... | |
class | Mutator |
bool | operator!= (Record const &r1, Record const &r2) |
bool | operator== (Record const &r1, Record const &r2) |
Private Types | |
using | Access = typename RecordSetup< VAL >::Access |
using | ElmIter = typename RecordSetup< VAL >::ElmIter |
using | Storage = typename RecordSetup< VAL >::Storage |
Private Attributes | |
Storage | attribs_ |
Storage | children_ |
string | type_ |
copy-initialise (or convert) from the given Mutator instance.
Definition at line 298 of file record.hpp.
|
friend |
Implementation of Iteration-logic: pull next element.
Definition at line 331 of file record.hpp.
|
friend |
Implementation of Iteration-logic: detect iteration end.
ITER()
to mark iteration end. Definition at line 342 of file record.hpp.