133 #ifndef LIB_DIFF_TREE_DIFF_APPLICATION_H 134 #define LIB_DIFF_TREE_DIFF_APPLICATION_H 163 virtual void clear() =0;
165 virtual size_t depth()
const =0;
178 template<
size_t buffSiz>
183 using MutatorStack = std::stack<MutatorBuffer>;
198 throw error::Logic(
"Attempt to access the current scope " 199 "without establishing a root scope beforehand." 200 , error::LUMIERA_ERROR_LIFECYCLE);
201 return *scopes_.top();
213 static_assert (buffSiz >=
sizeof(
typename MutatorStack::value_type)
214 ,
"insufficient working buffer for TreeMutator");
215 return placementHandle;
222 REQUIRE (0 < depth(),
"attempt to return beyond root scope");
223 return *scopes_.top();
229 while (0 < scopes_.size())
232 ENSURE (scopes_.empty());
239 return scopes_.size();
288 void __expect_further_elements (
GenNode const& elm);
289 void __fail_not_found (
GenNode const& elm);
290 void __expect_end_of_scope (
GenNode::ID const& idi);
291 void __expect_valid_parent_scope (
GenNode::ID const& idi);
298 virtual void ins (
GenNode const& n)
override;
299 virtual void del (
GenNode const& n)
override;
300 virtual void pick (
GenNode const& n)
override;
301 virtual void skip (
GenNode const& n)
override;
302 virtual void find (
GenNode const& n)
override;
307 virtual void after(
GenNode const& n)
override;
308 virtual void set (
GenNode const& n)
override;
309 virtual void mut (
GenNode const& n)
override;
310 virtual void emu (
GenNode const& n)
override;
315 : treeMutator_(
nullptr)
316 , scopeManger_(
nullptr)
366 return buffHandle.get();
378 initDiffApplication()
383 buildMutator(target)->init();
384 TreeDiffMutatorBinding::scopeManger_ = &scopes_;
385 TreeDiffMutatorBinding::treeMutator_ = &scopes_.currentScope();
386 REQUIRE (this->treeMutator_);
390 completeDiffApplication()
392 if (not treeMutator_->completeScope())
393 throw error::State(
_Fmt(
"Unsettled content remains after diff application. " 394 "Top level == %s") % subject_
395 , LERR_(DIFF_STRUCTURE));
397 treeMutator_ =
nullptr;
Interpreter interface to define the operations ("verbs"), which describe differences or changes in hi...
Abstraction or descriptor interface for a data structure exposing the ability for mutation by receivi...
virtual TreeMutator::Handle openScope()
virtual void buildMutator(TreeMutator::Handle buffer)=0
build a custom implementation of the TreeMutator interface, suitably wired to cause appropriate chang...
virtual TreeMutator::Handle openScope()=0
virtual ~ScopeManager()
this is an interface
Any copy and copy construction prohibited.
inline string literal This is a marker type to indicate that
A front-end for using printf-style formatting.
Implementation namespace for support and library code.
Definitions and Properties to guide automated tree mutator binding.
Derived specific exceptions within Lumiera's exception hierarchy.
SUB & emplace(SUB &&implementation)
move-construct an instance of a subclass into the opaque buffer
A handle to allow for safe »remote implantation« of an unknown subclass into a given opaque InPlaceBu...
Typical standard implementation of the ScopeManager.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
MutatorStack scopes_
Allocate Heap Storage for nested TreeMutator(s)
Generic building block for tree shaped (meta)data structures.
Extension point: define how a specific diff language can be applied to elements in a concrete contain...
Management interface to deal with storage for TreeMutators dedicated to nested scopes.
A token language to represent structural changes in a tree like hierarchical data structure...
Customisable intermediary to abstract generic tree mutation operations.
Buffer to place and maintain an object instance privately within another object.
TreeDiffTraits< TAR >::Ret mutatorBinding(TAR &subject)
public access point to this configuration machinery
generic data element node within a tree
Marker or capability interface: an otherwise not further disclosed data structure, which can be transformed through "tree diff messages".
Customisable intermediary to abstract mutating operations on arbitrary, hierarchical object-like data...
Implementation of the tree-diff-language to work on arbitrary tree-like data.