Lumiera 0.pre.04
»edit your freedom«
Loading...
Searching...
No Matches
GenNode Struct Reference

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

Description

generic data element node within a tree

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

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
 

Public Types

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

Public Attributes

ID idi
 
DataCap data
 

Static Public Member Functions

template<typename X >
static GenNode asAttribute (idi::BareEntryID &&rawID, X &&payload)
 fabricate a GenNode with the literally given ID
 

Public Member Functions

template<typename X >
 GenNode (X &&val)
 
template<typename X >
 GenNode (string const &symbolicID, X &&val)
 
 GenNode (string const &symbolicID, CStr text)
 
 GenNode (CStr text)
 
 GenNode (GenNode const &)=default
 
 GenNode (GenNode &&)=default
 
 GenNode (GenNode &o)
 
 GenNode (Ref const &r)
 
 GenNode (Ref &r)
 
 GenNode (Ref &&r)
 
GenNodeoperator= (GenNode const &o)
 copy assignment
 
GenNodeoperator= (GenNode &&o)
 
 operator string () const
 
bool isNamed () const
 
bool isTypeID () const
 
template<typename X >
bool contains (X const &elm) 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
 
iterator begin ()
 
iterator begin () const
 
iterator end ()
 
iterator end () const
 
template<typename X >
std::optional< X > retrieveAttribute (string key) const
 mismatch tolerant convenience shortcut to peek into the attributes of a nested Record
 
bool hasAttribute (string key) const
 
bool isNested () const
 
bool hasChildren () const
 
Rec::scopeIter getChildren () const
 

Friends

ChildDataIter childData (GenNode const &n)
 visit the data of nested child elements
 
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 ()
 

Constructor & Destructor Documentation

◆ GenNode() [1/11]

template<typename X >
GenNode ( X &&  val)
inline

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

◆ GenNode() [2/11]

template<typename X >
GenNode ( string const &  symbolicID,
X &&  val 
)
inline

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

◆ GenNode() [3/11]

GenNode ( string const &  symbolicID,
CStr  text 
)
inline

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

◆ GenNode() [4/11]

GenNode ( CStr  text)
inline

Definition at line 277 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 284 of file gen-node.hpp.

◆ GenNode() [8/11]

GenNode ( Ref const &  r)
inline

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

◆ GenNode() [9/11]

GenNode ( Ref r)
inline

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

◆ GenNode() [10/11]

GenNode ( Ref &&  r)
inline

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

◆ GenNode() [11/11]

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

for dedicated builder subclasses

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

Member Typedef Documentation

◆ iterator

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

◆ ChildDataIter

Definition at line 378 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 306 of file gen-node.hpp.

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

◆ operator=() [2/2]

GenNode & operator= ( GenNode &&  o)
inline

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

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

◆ operator string()

operator string ( ) const
inline

diagnostics helper

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

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

◆ isNamed()

bool isNamed ( ) const
inline

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

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

Referenced by ObjectTypeHandler< PAR >::assignElm(), Builder< PAR >::attach(), Opaque::buildMutator(), MockElm::buildMutator(), GenNode_test::convenienceRecAccess(), ObjectTypeHandler< PAR >::injectNew(), AttributeBindingBase< PAR >::isApplicable(), lib::diff::anonymous_namespace{test-mutation-target.hpp}::renderNode(), and GenNode_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 343 of file gen-node.hpp.

References BareEntryID::getSym(), and GenNode::idi.

Referenced by ObjectTypeHandler< PAR >::assignElm(), and ObjectTypeHandler< PAR >::injectNew().

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

◆ contains()

template<typename X >
bool contains ( X const &  elm) const
inline

Definition at line 679 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 352 of file gen-node.hpp.

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

Referenced by TestWireTap< PAR >::accept_until(), ChildCollectionMutator< PAR, BIN >::accept_until(), TestWireTap< PAR >::acceptSrc(), _DefaultBinding< ELM, enable_if< can_wrap_in_GenNode< ELM > > >::attachTo(), _DefaultBinding< GenNode >::attachTo(), GenNode_test::equalityMatch(), GenNode::matches(), and TestWireTap< PAR >::matchSrc().

+ 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 353 of file gen-node.hpp.

References GenNode::idi.

◆ matches() [3/14]

bool matches ( int  number) const
inline

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

References GenNode::data, and DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [4/14]

bool matches ( int64_t  number) const
inline

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

References GenNode::data, and DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [5/14]

bool matches ( short  number) const
inline

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

References GenNode::data, and DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [6/14]

bool matches ( char  number) const
inline

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

References GenNode::data, and DataCap::matchNum().

+ Here is the call graph for this function:

◆ matches() [7/14]

bool matches ( double  number) const
inline

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

References GenNode::data, and DataCap::matchDbl().

+ Here is the call graph for this function:

◆ matches() [8/14]

bool matches ( string  text) const
inline

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

References GenNode::data, and DataCap::matchTxt().

+ Here is the call graph for this function:

◆ matches() [9/14]

bool matches ( const char *  text) const
inline

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

References GenNode::data, and DataCap::matchTxt().

+ Here is the call graph for this function:

◆ matches() [10/14]

bool matches ( time::TimeValue  t) const
inline

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

References GenNode::data, and DataCap::matchTime().

+ Here is the call graph for this function:

◆ matches() [11/14]

bool matches ( bool  b) const
inline

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

References GenNode::data, and DataCap::matchBool().

+ Here is the call graph for this function:

◆ matches() [12/14]

bool matches ( hash::LuidH  h) const
inline

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

References GenNode::data, and DataCap::matchLuid().

+ Here is the call graph for this function:

◆ matches() [13/14]

bool matches ( RecRef const &  ref) const
inline

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

References GenNode::data, and DataCap::matchRec().

+ Here is the call graph for this function:

◆ matches() [14/14]

bool matches ( Rec const &  rec) const
inline

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

References GenNode::data, and DataCap::matchRec().

+ Here is the call graph for this function:

◆ begin() [1/2]

GenNode::iterator begin ( )
inline

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

Referenced by GenNode_test::sequenceIteration().

+ Here is the caller graph for this function:

◆ begin() [2/2]

GenNode::iterator begin ( ) const
inline

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

◆ end() [1/2]

GenNode::iterator end ( )
inline

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

◆ end() [2/2]

GenNode::iterator end ( ) const
inline

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

◆ asAttribute()

template<typename X >
static GenNode asAttribute ( idi::BareEntryID &&  rawID,
X &&  payload 
)
inlinestatic

fabricate a GenNode with the literally given ID

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

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

+ Here is the caller graph for this function:

◆ retrieveAttribute()

template<typename X >
std::optional< X > retrieveAttribute ( string  key) const
inline

mismatch tolerant convenience shortcut to peek into the attributes of a nested Record

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

References GenNode::data, and DataCap::retrieveAttribute().

Referenced by TrackPresenter::buildMutator(), ClipPresenter::buildMutator(), MockSegmentation::buildRuntime(), MockSegmentation::buildSeed(), and GenNode_test::convenienceRecAccess().

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

◆ hasAttribute()

bool hasAttribute ( string  key) const
inline

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

References GenNode::data, and DataCap::hasAttribute().

Referenced by GenNode_test::convenienceRecAccess().

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

◆ isNested()

bool isNested ( ) const
inline

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

References GenNode::data, and DataCap::isNested().

Referenced by GenNode_test::convenienceRecAccess(), and DataSource< diff::GenNode >::findNode().

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

◆ hasChildren()

bool hasChildren ( ) const
inline

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

References DataCap::childIter(), and GenNode::data.

Referenced by GenNode_test::convenienceRecAccess(), and GenNode_test::sequenceIteration().

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

◆ getChildren()

Rec::scopeIter getChildren ( ) const
inline

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

References DataCap::childIter(), and GenNode::data.

Referenced by MockSegmentation::buildPrerequisites().

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

◆ fabricateRefID()

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

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

◆ buildChildID()

template<typename X >
static string buildChildID ( )
inlinestaticprivate

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

Member Data Documentation

◆ idi

ID idi

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

Referenced by AttributeBindingBase< PAR >::__ifApplicable_refuse_to(), TestWireTap< PAR >::accept_until(), TestNexus::act(), CoreService::act(), TestWireTap< PAR >::assignElm(), _DefaultBinding< GenNode >::attachTo(), _DefaultBinding< ELM, enable_if< can_recursively_bind_DiffMutable< ELM > > >::attachTo(), TimelineController::buildMutator(), TrackPresenter::buildMutator(), Opaque::buildMutator(), ClipPresenter::buildMutator(), MockElm::buildMutator(), MutationMessage_test::demonstrate_treeApplication(), Tangible::doMark(), NotificationHub::doMark(), TreeDiffMutatorBinding::emu(), GenNode_test::equalityMatch(), TestWireTap< PAR >::findSrc(), InteractionDirector::injectTimeline(), AttributeBindingBase< PAR >::isApplicable(), GenNode::isNamed(), GenNode::isTypeID(), TestMutationTarget::logAssignment(), TestMutationTarget::logMutation(), TestMutationTarget::logSkip(), steam::mobject::session::anonymous_namespace{dummy-session-connection.cpp}::makeName(), Tangible::mark(), TestNexus::markAll(), GenNode::matches(), GenNode::matches(), TreeDiffMutatorBinding::mut(), TestWireTap< PAR >::mutateChild(), ChildCollectionMutator< PAR, BIN >::mutateChild(), TreeMutatorBinding_test::mutateCollection(), TreeMutatorBinding_test::mutateDummy(), DiffTreeApplication_test::mutationDiff(), MutationMessage_test::mutationDiff(), GenNode::operator string(), GenNode::IDComparator::operator()(), GenNode::operator=(), GenNode::operator=(), stage::model::test::anonymous_namespace{abstract-tangible-test.cpp}::processCommandInvocation(), lib::diff::anonymous_namespace{test-mutation-target.hpp}::renderAttribute(), SimulatedCommandHandler::retrieveCommand(), DiffTreeApplication_test::run(), GenNode_test::simpleUsage(), and GenNode_test::symbolReference().

◆ data

DataCap data

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

Referenced by SimulatedCommandHandler::SimulatedCommandHandler(), TestNexus::act(), CoreService::act(), ChangeOperation< PAR, CLO >::assignElm(), ObjectTypeHandler< PAR >::assignElm(), _DefaultBinding< ELM, enable_if< can_wrap_in_GenNode< ELM > > >::attachTo(), _DefaultBinding< GenNode >::attachTo(), InteractionDirector::buildMutator(), TimelineController::buildMutator(), TrackPresenter::buildMutator(), Opaque::buildMutator(), DiffTreeMutationListener_test::buildMutator(), ClipPresenter::buildMutator(), MockElm::buildMutator(), lib::diff::test::anonymous_namespace{diff-tree-application-simple-test.cpp}::contents(), GenNode_test::convenienceRecAccess(), Tangible::doMark(), NotificationHub::doMark(), GenNode_test::equalityMatch(), DataSource< diff::GenNode >::findNode(), DiffIgnoreChanges_test::fish_for_content(), GenNode::getChildren(), GenNode::hasAttribute(), GenNode::hasChildren(), ChangeOperation< PAR, CLO >::injectNew(), ObjectTypeHandler< PAR >::injectNew(), GenNode::isNested(), TestMutationTarget::logAssignment(), TestMutationTarget::logMutation(), Tangible::mark(), TestNexus::markAll(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), GenNode::matches(), TreeMutatorBinding_test::mutateCollection(), TreeMutatorBinding_test::mutateGenNode(), GenNode_test::objectShortcut(), GenNode::operator string(), GenNode::operator=(), GenNode::operator=(), stage::model::test::anonymous_namespace{abstract-tangible-test.cpp}::processCommandInvocation(), lib::diff::anonymous_namespace{test-mutation-target.hpp}::renderAttribute(), lib::diff::anonymous_namespace{test-mutation-target.hpp}::renderChild(), GenNode::retrieveAttribute(), DiffComplexApplication_test::run(), GenNode_test::simpleUsage(), GenNode_test::symbolReference(), and stage::interact::anonymous_namespace{interaction-director.cpp}::verifyDiffStructure_and_extract_RootTrack().

Friends And Related Symbol 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 388 of file gen-node.hpp.

◆ childData [2/2]

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

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

◆ name

string name ( GenNode const &  node)
friend

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

◆ operator==

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

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

◆ operator!=

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

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

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

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