Lumiera  0.pre.03
»edityourfreedom«
Record< VAL >::Mutator Class Reference

#include "lib/diff/record.hpp"

Description

template<typename VAL>
class lib::diff::Record< VAL >::Mutator

Definition at line 400 of file record.hpp.

Public Types

using BufferHandle = PlantingHandle< TreeMutator >
 

Public Member Functions

 Mutator ()
 
 Mutator (Rec const &startingPoint)
 
 Mutator (Rec &&startingPoint)
 
VAL const & accessLast ()
 get the tail element. More...
 
MutatorappendAttrib (VAL const &newAttrib)
 
MutatorappendChild (VAL const &newChild)
 
template<typename X , typename... ARGS>
Mutatorattrib (string const &key, X &&initialiser, ARGS &&...args)
 
Mutatorattrib ()
 
template<>
void buildMutator (BufferHandle buff)
 
void buildMutator (BufferHandle)
 attachment point to receive and apply tree-diff changes. More...
 
bool empty () const
 
auto exposeToDiff ()
 
VAL genNode ()
 
VAL genNode (string const &symbolicID)
 
 operator Rec & ()
 
MutatorprependChild (VAL const &newChild)
 
template<typename X , typename... ARGS>
Mutatorscope (X const &initialiser, ARGS &&...args)
 
Mutatorscope ()
 
template<typename X >
Mutatorset (string const &key, X &&content)
 
Mutatorset (VAL &&attribute)
 
void setType (string const &newTypeID)
 
void swap (Rec &existingInstance) noexcept
 
Mutatortype (string const &typeID)
 

Private Types

using Rec = Record< VAL >
 

Private Attributes

Rec record_
 

Additional Inherited Members

- Private Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (NonCopyable const &)=delete
 
 ~NonCopyable ()=default
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Member Typedef Documentation

◆ Rec

using Rec = Record<VAL>
private

Definition at line 403 of file record.hpp.

◆ BufferHandle

Definition at line 507 of file record.hpp.

Constructor & Destructor Documentation

◆ Mutator() [1/3]

Mutator ( )
inline

Definition at line 408 of file record.hpp.

◆ Mutator() [2/3]

Mutator ( Rec const &  startingPoint)
inlineexplicit

Definition at line 413 of file record.hpp.

◆ Mutator() [3/3]

Mutator ( Rec &&  startingPoint)
inlineexplicit

Definition at line 418 of file record.hpp.

Member Function Documentation

◆ operator Rec &()

operator Rec & ( )
inline

Definition at line 422 of file record.hpp.

◆ swap()

void swap ( Rec existingInstance)
inlinenoexcept

Definition at line 428 of file record.hpp.

◆ empty()

bool empty ( ) const
inline

Definition at line 434 of file record.hpp.

References Record< VAL >::empty().

+ Here is the call graph for this function:

◆ setType()

void setType ( string const &  newTypeID)
inline

Definition at line 443 of file record.hpp.

References Record< VAL >::type_.

◆ type()

Mutator& type ( string const &  typeID)
inline

Definition at line 449 of file record.hpp.

Referenced by GenNodeBasic_test::objectShortcut(), and GenNodeBasic_test::symbolReference().

+ Here is the caller graph for this function:

◆ set() [1/2]

Mutator& set ( string const &  key,
X &&  content 
)
inline

◆ set() [2/2]

Mutator& set ( VAL &&  attribute)
inline

Definition at line 464 of file record.hpp.

References Record< VAL >::attribs_, Record< VAL >::extractKey(), and util::isnil().

+ Here is the call graph for this function:

◆ appendAttrib()

Mutator& appendAttrib ( VAL const &  newAttrib)
inline

Definition at line 484 of file record.hpp.

References Record< VAL >::attribs_, and Record< VAL >::isAttribute().

+ Here is the call graph for this function:

◆ appendChild()

Mutator& appendChild ( VAL const &  newChild)
inline

Definition at line 492 of file record.hpp.

References Record< VAL >::children_.

Referenced by MutationMessage_test::demonstrate_treeApplication(), and DiffTreeApplication_test::run().

+ Here is the caller graph for this function:

◆ prependChild()

Mutator& prependChild ( VAL const &  newChild)
inline

Definition at line 499 of file record.hpp.

References Record< VAL >::children_.

◆ buildMutator() [1/2]

void buildMutator ( BufferHandle  )

attachment point to receive and apply tree-diff changes.

implementation is provided by the "diff framework"

The actual implementation needs to be provided for concrete Record payload types; in case of Record<GenNode>, a default implementation for this feature is provided by the "diff framework", which offers a preconfigured binding to create a TreeMutator implementation, which can then be used for a DiffApplicator. This way, a Rec::Mutator can receive diff messages to reorder and reshape the contents.

Parameters
BufferHandlepointing to an (implementation provided) storage location, where this function is expected to construct a suitable TreeMutator, linked to the internals of this Record::Mutator.
See also
lib::diff::mutatorBinding()
lib::diff::DiffApplicationStrategy
tree-diff-application.hpp
DiffTreeApplication_test usage example
tree-mutator-gen-node-binding.hpp
tree-diff.cpp (implementation)

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

+ Here is the caller graph for this function:

◆ exposeToDiff()

auto exposeToDiff ( )
inline

Definition at line 526 of file record.hpp.

References Record< VAL >::attribs_, and Record< VAL >::children_.

◆ accessLast()

VAL const& accessLast ( )
inline

get the tail element.

Returns
either the last child, or the last attribute, when children are empty.
Note
typically this might be used to get back at the element "just added", as when muting a child node in diff application. But there is a loophole: we might have added an attribute even when there are already children.

Definition at line 539 of file record.hpp.

References Record< VAL >::attribs_, Record< VAL >::children_, and Record< VAL >::empty().

+ Here is the call graph for this function:

◆ genNode() [1/2]

GenNode genNode ( )
inline

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

References GenNode::GenNode().

Referenced by MutationMessage_test::demonstrate_treeApplication(), AbstractTangible_test::mutate(), GenNodeBasic_test::objectShortcut(), BusTerm_test::pushDiff(), DiffTreeApplication_test::run(), GenNodeBasic_test::sequenceIteration(), and GenNodeBasic_test::symbolReference().

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

◆ genNode() [2/2]

GenNode genNode ( string const &  symbolicID)
inline

◆ attrib() [1/2]

Mutator& attrib ( string const &  key,
X &&  initialiser,
ARGS &&...  args 
)
inline

Definition at line 563 of file record.hpp.

Referenced by GenNodeBasic_test::objectShortcut(), GenNodeBasic_test::sequenceIteration(), and GenNodeBasic_test::symbolReference().

+ Here is the caller graph for this function:

◆ attrib() [2/2]

Mutator& attrib ( )
inline

Definition at line 568 of file record.hpp.

◆ scope() [1/2]

Mutator& scope ( X const &  initialiser,
ARGS &&...  args 
)
inline

Definition at line 572 of file record.hpp.

References Record< VAL >::scope().

Referenced by GenNodeBasic_test::sequenceIteration(), TupleRecordInit_test::show_simpleUsage(), and TupleRecordInit_test::verify_errorHandling().

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

◆ scope() [2/2]

Mutator& scope ( )
inline

Definition at line 577 of file record.hpp.

◆ buildMutator() [2/2]

void buildMutator ( BufferHandle  buff)

possibly recursive invocation to build a TreeMutator binding to an "object" / scope /child node. This function is invoked when creating a DiffApplicator<Rec::Mutator>, and it is then invoked recursively, when the top level TreeMutator enters a nested scope (child node).

Definition at line 75 of file tree-diff.cpp.

References TreeMutator::build(), and PlantingHandle< BA >::create().

+ Here is the call graph for this function:

Member Data Documentation

◆ record_

Rec record_
private

Definition at line 405 of file record.hpp.

+ Inheritance diagram for Record< VAL >::Mutator:
+ Collaboration diagram for Record< VAL >::Mutator:

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