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();
212 return placementHandle;
219 REQUIRE (0 < depth(),
"attempt to return beyond root scope");
220 return *scopes_.top();
226 while (0 < scopes_.size())
229 ENSURE (scopes_.empty());
236 return scopes_.size();
284 void __expect_further_elements (
GenNode const& elm);
285 void __fail_not_found (
GenNode const& elm);
286 void __expect_end_of_scope (
GenNode::ID const& idi);
287 void __expect_valid_parent_scope (
GenNode::ID const& idi);
294 virtual void ins (
GenNode const& n)
override;
295 virtual void del (
GenNode const& n)
override;
296 virtual void pick (
GenNode const& n)
override;
297 virtual void skip (
GenNode const& n)
override;
298 virtual void find (
GenNode const& n)
override;
303 virtual void after(
GenNode const& n)
override;
304 virtual void set (
GenNode const& n)
override;
305 virtual void mut (
GenNode const& n)
override;
306 virtual void emu (
GenNode const& n)
override;
311 : treeMutator_(
nullptr)
312 , scopeManger_(
nullptr)
362 return buffHandle.get();
374 initDiffApplication()
379 buildMutator(target)->init();
380 TreeDiffMutatorBinding::scopeManger_ = &scopes_;
381 TreeDiffMutatorBinding::treeMutator_ = &scopes_.currentScope();
382 REQUIRE (this->treeMutator_);
386 completeDiffApplication()
388 if (not treeMutator_->completeScope())
389 throw error::State(
_Fmt(
"Unsettled content remains after diff application. " 390 "Top level == %s") % subject_
391 , LERR_(DIFF_STRUCTURE));
393 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.