mmcfilters
Public API documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Friends | List of all members
mmcfilters::TreeEditor Class Reference

Thin edit-session facade for multi-step topology updates. More...

#include <TreeEditor.hpp>

Classes

class  IncrementalProof
 Move-only evidence that the current edit revision satisfies the generic topology invariants. More...
 

Public Member Functions

 TreeEditor (const TreeEditor &)=delete
 Disables copy construction.
 
TreeEditoroperator= (const TreeEditor &)=delete
 Disables copy assignment.
 
 TreeEditor (TreeEditor &&other) noexcept
 Transfers the open edit-session handle without closing it.
 
TreeEditoroperator= (TreeEditor &&)=delete
 Disables move assignment.
 
 ~TreeEditor ()
 Rolls back an unfinished recoverable public edit.
 
bool canRollback () const noexcept
 Tests whether this editor owns a delta rollback journal.
 
void rollback ()
 Aborts a recoverable edit and restores its original state.
 
NodeId createDetachedNode ()
 Creates a live detached node in the topological hierarchy.
 
void detach (NodeId nodeId)
 Detaches one non-root node from the connected rooted component.
 
void reparent (NodeId nodeId, NodeId newParentId)
 Reparents one live non-root node under another live node.
 
void attach (NodeId parentId, NodeId detachedNodeId)
 Attaches one detached node back under the connected rooted tree.
 
void moveChildren (NodeId parentId, NodeId sourceId)
 Transfers every direct child of sourceId under parentId.
 
void movePixelToProperPart (NodeId targetNodeId, NodeId sourceNodeId, PixelId pixel)
 Transfers one direct proper part from sourceNodeId to targetNodeId.
 
void mergeProperParts (NodeId targetNodeId, NodeId sourceNodeId)
 Transfers every direct proper part from sourceNodeId to targetNodeId.
 
void removeChild (NodeId parentNodeId, NodeId childId, bool releaseNodeFlag)
 Detaches a direct child from its parent and optionally releases an empty detached slot.
 
void releaseNode (NodeId nodeId)
 Releases an empty detached non-root node slot.
 
void setRoot (NodeId nodeId)
 Promotes nodeId to become the connected root.
 
void pruneNode (NodeId nodeId)
 Applies the committed-safe subtree prune inside the staged edit.
 
void mergeNodeIntoParent (NodeId nodeId)
 Applies the committed-safe parent merge inside the staged edit.
 
bool hasDetachedAliveNodes () const noexcept
 Returns whether the staged edit still has detached alive nodes.
 
IncrementalProof proveIncremental ()
 Produces move-only evidence for the current edit revision.
 
void commit (IncrementalProof &&proof)
 Commits the exact edit revision represented by proof.
 
TreeValidationResult validate () const noexcept
 Runs strong validation without closing the session.
 
TreeValidationResult validateAndCommit () noexcept
 Validates and closes the edit session on success.
 
void commit ()
 Finalizes the edit by validating that the tree is connected again.
 

Friends

class MorphologicalTree
 
template<AltitudeValue T>
class ValuedMorphologicalTreeEditor
 

Detailed Description

Thin edit-session facade for multi-step topology updates.

Its role is to make explicit that the caller is performing a staged edit where the tree may become temporarily disconnected, and to centralize the final strong validation in validateAndCommit() / commit(). Public editors keep an undo journal proportional to the mutation delta; the internal by-construction editor remains journal-free.

Callers cannot construct TreeEditor directly. Use MorphologicalTree::edit() so the edit boundary remains explicit at the call site.

Definition at line 28 of file TreeEditor.hpp.

Constructor & Destructor Documentation

◆ TreeEditor()

mmcfilters::TreeEditor::TreeEditor ( TreeEditor &&  other)
inlinenoexcept

Transfers the open edit-session handle without closing it.

Parameters
otherObject to compare with or transfer from.

Definition at line 653 of file TreeEditor.hpp.

◆ ~TreeEditor()

mmcfilters::TreeEditor::~TreeEditor ( )
inline

Rolls back an unfinished recoverable public edit.

The internal by-construction editor is deliberately journal-free and therefore still requires its algorithm to publish explicitly.

Definition at line 679 of file TreeEditor.hpp.

Member Function Documentation

◆ attach()

void mmcfilters::TreeEditor::attach ( NodeId  parentId,
NodeId  detachedNodeId 
)
inline

Attaches one detached node back under the connected rooted tree.

The node must be self-parented. Full connectivity and cycle validation remains the responsibility of commit() / validateAndCommit().

Parameters
parentIdIdentifier of the parent node.
detachedNodeIdNode identifier.

Definition at line 806 of file TreeEditor.hpp.

◆ canRollback()

bool mmcfilters::TreeEditor::canRollback ( ) const
inlinenoexcept

Tests whether this editor owns a delta rollback journal.

Returns
True if this editor owns a delta rollback journal; otherwise false.

Definition at line 686 of file TreeEditor.hpp.

◆ commit() [1/2]

void mmcfilters::TreeEditor::commit ( )
inline

Finalizes the edit by validating that the tree is connected again.

This validation is linear in the current dense internal-node domain plus the direct pixel domain.

Definition at line 1295 of file TreeEditor.hpp.

◆ commit() [2/2]

void mmcfilters::TreeEditor::commit ( IncrementalProof &&  proof)
inline

Commits the exact edit revision represented by proof.

Parameters
proofValidation proof consumed by the operation.

Definition at line 1252 of file TreeEditor.hpp.

◆ createDetachedNode()

NodeId mmcfilters::TreeEditor::createDetachedNode ( )
inline

Creates a live detached node in the topological hierarchy.

The caller must attach or release the node before a checked commit can succeed.

Returns
The created live detached node in the topological hierarchy.

Definition at line 709 of file TreeEditor.hpp.

◆ detach()

void mmcfilters::TreeEditor::detach ( NodeId  nodeId)
inline

Detaches one non-root node from the connected rooted component.

Parameters
nodeIdDense internal node identifier.

Definition at line 735 of file TreeEditor.hpp.

◆ hasDetachedAliveNodes()

bool mmcfilters::TreeEditor::hasDetachedAliveNodes ( ) const
inlinenoexcept

Returns whether the staged edit still has detached alive nodes.

Returns
Whether the staged edit still has detached alive nodes.

Definition at line 1135 of file TreeEditor.hpp.

◆ mergeNodeIntoParent()

void mmcfilters::TreeEditor::mergeNodeIntoParent ( NodeId  nodeId)
inline

Applies the committed-safe parent merge inside the staged edit.

Parameters
nodeIdDense internal node identifier.

Definition at line 1097 of file TreeEditor.hpp.

◆ mergeProperParts()

void mmcfilters::TreeEditor::mergeProperParts ( NodeId  targetNodeId,
NodeId  sourceNodeId 
)
inline

Transfers every direct proper part from sourceNodeId to targetNodeId.

The underlying splice is linear only in the number of moved direct proper parts.

Parameters
targetNodeIdNode identifier.
sourceNodeIdNode identifier.

Definition at line 913 of file TreeEditor.hpp.

◆ moveChildren()

void mmcfilters::TreeEditor::moveChildren ( NodeId  parentId,
NodeId  sourceId 
)
inline

Transfers every direct child of sourceId under parentId.

This keeps the operation local and does not run an ancestry check; callers that move children inside a subtree must repair or reject cycles before committing.

Parameters
parentIdIdentifier of the parent node.
sourceIdInput.

Definition at line 842 of file TreeEditor.hpp.

◆ movePixelToProperPart()

void mmcfilters::TreeEditor::movePixelToProperPart ( NodeId  targetNodeId,
NodeId  sourceNodeId,
PixelId  pixel 
)
inline

Transfers one direct proper part from sourceNodeId to targetNodeId.

Moving one proper part is proportional to the linked-list update only; it does not rebuild the full smallest-node map.

Parameters
targetNodeIdNode identifier.
sourceNodeIdNode identifier.
pixelProper-part identifier.

Definition at line 878 of file TreeEditor.hpp.

◆ proveIncremental()

IncrementalProof mmcfilters::TreeEditor::proveIncremental ( )
inline

Produces move-only evidence for the current edit revision.

Supported primitives are checked only on the mutation delta and changed parent paths. An edit containing a primitive without incremental support falls back to the complete validator.

Returns
The produced move-only evidence for the current edit revision.

Definition at line 1245 of file TreeEditor.hpp.

◆ pruneNode()

void mmcfilters::TreeEditor::pruneNode ( NodeId  nodeId)
inline

Applies the committed-safe subtree prune inside the staged edit.

Parameters
nodeIdDense internal node identifier.

Definition at line 1050 of file TreeEditor.hpp.

◆ releaseNode()

void mmcfilters::TreeEditor::releaseNode ( NodeId  nodeId)
inline

Releases an empty detached non-root node slot.

Parameters
nodeIdDense internal node identifier.

Definition at line 982 of file TreeEditor.hpp.

◆ removeChild()

void mmcfilters::TreeEditor::removeChild ( NodeId  parentNodeId,
NodeId  childId,
bool  releaseNodeFlag 
)
inline

Detaches a direct child from its parent and optionally releases an empty detached slot.

Parameters
parentNodeIdIdentifier of the parent node.
childIdIdentifier of the child node.
releaseNodeFlagFlag controlling release node flag.

Definition at line 946 of file TreeEditor.hpp.

◆ reparent()

void mmcfilters::TreeEditor::reparent ( NodeId  nodeId,
NodeId  newParentId 
)
inline

Reparents one live non-root node under another live node.

This is a staged structural edit: cycle freedom is enforced at commit time rather than by an ancestry walk on every call.

Parameters
nodeIdDense internal node identifier.
newParentIdParent-node value.

Definition at line 766 of file TreeEditor.hpp.

◆ rollback()

void mmcfilters::TreeEditor::rollback ( )
inline

Aborts a recoverable edit and restores its original state.

Definition at line 691 of file TreeEditor.hpp.

◆ setRoot()

void mmcfilters::TreeEditor::setRoot ( NodeId  nodeId)
inline

Promotes nodeId to become the connected root.

The previous root becomes detached; callers must reconnect or explicitly tolerate that state before a checked commit.

Parameters
nodeIdDense internal node identifier.

Definition at line 1019 of file TreeEditor.hpp.

◆ validate()

TreeValidationResult mmcfilters::TreeEditor::validate ( ) const
inlinenoexcept

Runs strong validation without closing the session.

Returns
Result produced by running strong validation without closing the session.

Definition at line 1268 of file TreeEditor.hpp.

◆ validateAndCommit()

TreeValidationResult mmcfilters::TreeEditor::validateAndCommit ( )
inlinenoexcept

Validates and closes the edit session on success.

Returns
Validation result for and closes the edit session on success.

Definition at line 1280 of file TreeEditor.hpp.

Friends And Related Symbol Documentation

◆ MorphologicalTree

Definition at line 29 of file TreeEditor.hpp.

◆ ValuedMorphologicalTreeEditor

template<AltitudeValue T>
friend class ValuedMorphologicalTreeEditor
friend

Definition at line 30 of file TreeEditor.hpp.


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