Lumiera  0.pre.03
»edityourfreedom«
GenNode Struct Reference

#include "lib/diff/gen-node.hpp"

Description

generic data element node within a tree

Definition at line 213 of file gen-node.hpp.

Public Types

using ChildDataIter = TransformIter< Rec::scopeIter, DataCap const & >
 
using iterator = ScopeExplorerIterator
 

Public Member Functions

template<typename X >
 GenNode (X &&val)
 
template<typename X >
 GenNode (string const &symbolicID, X &&val)
 
 GenNode (string const &symbolicID, const char *text)
 
 GenNode (const char *text)
 
 GenNode (GenNode const &)=default
 
 GenNode (GenNode &&)=default
 
 GenNode (GenNode &o)
 
 GenNode (Ref const &r)
 
 GenNode (Ref &r)
 
 GenNode (Ref &&r)
 
iterator begin ()
 
iterator begin () const
 
template<typename X >
bool contains (X const &elm) const
 
iterator end ()
 
iterator end () const
 
bool isNamed () const
 
bool isTypeID () const
 
bool matches (GenNode const &o) const
 
bool matches (ID const &id) const
 
bool matches (int number) const
 
bool matches (int64_t number) const
 
bool matches (short number) const
 
bool matches (char number) const
 
bool matches (double number) const
 
bool matches (string text) const
 
bool matches (const char *text) const
 
bool matches (time::TimeValue t) const
 
bool matches (bool b) const
 
bool matches (hash::LuidH h) const
 
bool matches (RecRef const &ref) const
 
bool matches (Rec const &rec) const
 
 operator string () const
 
GenNodeoperator= (GenNode const &o)
 copy assignment More...
 
GenNodeoperator= (GenNode &&o)
 

Public Attributes

DataCap data
 
ID idi
 

Classes

class  ID
 
struct  IDComparator
 allow for storage in ordered containers, ordering based on the human-readable ID within the GenNode. More...
 
class  ScopeExplorer
 Building block for monad-like depth-first expansion of a GenNode. More...
 
struct  ScopeExplorerIterator
 

Friends

ChildDataIter childData (GenNode const &n)
 visit the data of nested child elements More...
 
ChildDataIter childData (Rec::scopeIter &&scopeIter)
 
string name (GenNode const &node)
 
bool operator!= (GenNode const &n1, GenNode const &n2)
 
bool operator== (GenNode const &n1, GenNode const &n2)
 

Protected Member Functions

 GenNode (ID &&id, DataCap &&d)
 

Static Protected Member Functions

template<typename X >
static GenNode::ID fabricateRefID (string const &symbolicID)
 

Static Private Member Functions

template<typename X >
static string buildChildID ()
 

Member Typedef Documentation

◆ iterator

Definition at line 356 of file gen-node.hpp.

◆ ChildDataIter

Definition at line 364 of file gen-node.hpp.

Constructor & Destructor Documentation

◆ GenNode() [1/11]

GenNode ( X &&  val)
inline

Definition at line 248 of file gen-node.hpp.

Referenced by Record< VAL >::Mutator::genNode().

+ Here is the caller graph for this function:

◆ GenNode() [2/11]

GenNode ( string const &  symbolicID,
X &&  val 
)
inline

Definition at line 254 of file gen-node.hpp.

◆ GenNode() [3/11]

GenNode ( string const &  symbolicID,
const char *  text 
)
inline

Definition at line 259 of file gen-node.hpp.

◆ GenNode() [4/11]

GenNode ( const char *  text)
inline

Definition at line 263 of file gen-node.hpp.

◆ GenNode() [5/11]

GenNode ( GenNode const &  )
default

◆ GenNode() [6/11]

GenNode ( GenNode &&  )
default

◆ GenNode() [7/11]

GenNode ( GenNode o)
inline

Definition at line 270 of file gen-node.hpp.

References r.

◆ GenNode() [8/11]

GenNode ( Ref const &  r)
inline

Definition at line 763 of file gen-node.hpp.

◆ GenNode() [9/11]

GenNode ( Ref r)
inline

Definition at line 764 of file gen-node.hpp.

◆ GenNode() [10/11]

GenNode ( Ref &&  r)
inline

Definition at line 765 of file gen-node.hpp.

◆ GenNode() [11/11]

GenNode ( ID &&  id,
DataCap &&  d 
)
inlineprotected

for dedicated builder subclasses

Definition at line 439 of file gen-node.hpp.

Member Function Documentation

◆ operator=() [1/2]

GenNode& operator= ( GenNode const &  o)
inline

copy assignment

Remarks
we need to define our own version here for sake of sanity. The reason is that we use inline storage (embedded within lib::Variant) and that we deliberately erase the actual type of data stored inline. Because we still do want copy assignment, in case the payload data supports this, we use a "virtual copy operator", where in the end the storage buffer within lib::Variant has to decide if assignment is possible. Only data with the same type may be assigned and we prevent change of the (implicit) data type through assignment. This check might throw, and for that reason we're better off to perform the data assignment first. The probability for EntryID assignment to fail is low (but it may happen!).
Note
the use of inline storage turns swapping of data into an expensive operation, involving a temporary. This rules out the copy-and-swap idiom.

Definition at line 292 of file gen-node.hpp.

References GenNode::data, and GenNode::idi.

◆ operator=() [2/2]

GenNode& operator= ( GenNode &&  o)
inline

Definition at line 303 of file gen-node.hpp.

◆ operator string()

operator string ( ) const
inline

diagnostics helper

Definition at line 317 of file gen-node.hpp.

◆ isNamed()

bool isNamed ( ) const
inline

Definition at line 323 of file gen-node.hpp.

References BareEntryID::getSym(), and util::startsWith().

Referenced by MockElm::buildMutator(), Record< VAL >::Mutator::genNode(), and GenNodeBasic_test::simpleUsage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTypeID()

bool isTypeID ( ) const
inline

Definition at line 329 of file gen-node.hpp.

References util::contains(), and BareEntryID::getSym().

Referenced by Record< VAL >::Mutator::genNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ contains()

bool contains ( X const &  elm) const
inline

Definition at line 636 of file gen-node.hpp.

◆ matches() [1/14]

bool matches ( GenNode const &  o) const
inline
Note
not comparing payload data. Use equality for that…

Definition at line 338 of file gen-node.hpp.

References GenNode::idi, and GenNode::matches().

Referenced by GenNodeBasic_test::equalityMatch(), TestMutationTarget::getLog(), and GenNode::matches().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ matches() [2/14]

bool matches ( ID const &  id) const
inline

Definition at line 339 of file gen-node.hpp.

◆ matches() [3/14]

bool matches ( int  number) const
inline

Definition at line 340 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [4/14]

bool matches ( int64_t  number) const
inline

Definition at line 341 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [5/14]

bool matches ( short  number) const
inline

Definition at line 342 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [6/14]

bool matches ( char  number) const
inline

Definition at line 343 of file gen-node.hpp.

References DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [7/14]

bool matches ( double  number) const
inline

Definition at line 344 of file gen-node.hpp.

References DataCap::matchDbl().

+ Here is the call graph for this function:

◆ matches() [8/14]

bool matches ( string  text) const
inline

Definition at line 345 of file gen-node.hpp.

References DataCap::matchTxt().

+ Here is the call graph for this function:

◆ matches() [9/14]

bool matches ( const char *  text) const
inline

Definition at line 346 of file gen-node.hpp.

References DataCap::matchTxt().

+ Here is the call graph for this function:

◆ matches() [10/14]

bool matches ( time::TimeValue  t) const
inline

Definition at line 347 of file gen-node.hpp.

References DataCap::matchTime().

+ Here is the call graph for this function:

◆ matches() [11/14]

bool matches ( bool  b) const
inline

Definition at line 348 of file gen-node.hpp.

References DataCap::matchBool().

+ Here is the call graph for this function:

◆ matches() [12/14]

bool matches ( hash::LuidH  h) const
inline

Definition at line 349 of file gen-node.hpp.

References DataCap::matchLuid().

+ Here is the call graph for this function:

◆ matches() [13/14]

bool matches ( RecRef const &  ref) const
inline

Definition at line 350 of file gen-node.hpp.

References DataCap::matchRec().

+ Here is the call graph for this function:

◆ matches() [14/14]

bool matches ( Rec const &  rec) const
inline

Definition at line 351 of file gen-node.hpp.

References DataCap::matchRec().

+ Here is the call graph for this function:

◆ begin() [1/2]

GenNode::iterator begin ( )
inline

Definition at line 629 of file gen-node.hpp.

◆ begin() [2/2]

GenNode::iterator begin ( ) const
inline

Definition at line 630 of file gen-node.hpp.

◆ end() [1/2]

GenNode::iterator end ( )
inline

Definition at line 631 of file gen-node.hpp.

◆ end() [2/2]

GenNode::iterator end ( ) const
inline

Definition at line 632 of file gen-node.hpp.

◆ fabricateRefID()

static GenNode::ID fabricateRefID ( string const &  symbolicID)
inlinestaticprotected

Definition at line 446 of file gen-node.hpp.

◆ buildChildID()

static string buildChildID ( )
inlinestaticprivate

Definition at line 455 of file gen-node.hpp.

Member Data Documentation

◆ idi

◆ data

Friends And Related Function Documentation

◆ childData [1/2]

ChildDataIter childData ( GenNode const &  n)
friend

visit the data of nested child elements

Returns
an iterator over the DataCap elements of all children, in case this GenNode actually holds a Record. Otherwise an empty iterator.
Note
this iterator visits only the children, which are by definition unnamed. It does not visit attributes.

Definition at line 374 of file gen-node.hpp.

◆ childData [2/2]

ChildDataIter childData ( Rec::scopeIter &&  scopeIter)
friend

Definition at line 385 of file gen-node.hpp.

◆ name

string name ( GenNode const &  node)
friend

Definition at line 397 of file gen-node.hpp.

◆ operator==

bool operator== ( GenNode const &  n1,
GenNode const &  n2 
)
friend

Definition at line 403 of file gen-node.hpp.

◆ operator!=

bool operator!= ( GenNode const &  n1,
GenNode const &  n2 
)
friend

Definition at line 410 of file gen-node.hpp.

+ Inheritance diagram for GenNode:
+ Collaboration diagram for GenNode:

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