|
MorphologicalAttributeFilters
Public API documentation
|
Thin edit-session facade for multi-step topology updates. More...
#include <TreeEditor.hpp>
Public Member Functions | |
| TreeEditor (const TreeEditor &)=delete | |
| TreeEditor & | operator= (const TreeEditor &)=delete |
| TreeEditor (TreeEditor &&other) noexcept | |
| Transfers the open edit-session handle without closing it. | |
| TreeEditor & | operator= (TreeEditor &&)=delete |
| ~TreeEditor ()=default | |
| Leaves an unfinished edit session open. | |
| 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 | moveProperPart (NodeId targetNodeId, NodeId sourceNodeId, NodeId properPartId) |
Transfers one direct proper part from sourceNodeId to targetNodeId. | |
| void | moveProperParts (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. | |
| 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. | |
| void | commitUnchecked () noexcept |
| Finalizes a staged edit without running the linear validation. | |
Friends | |
| class | MorphologicalTree |
Thin edit-session facade for multi-step topology updates.
TreeEditor intentionally does not implement transactions or rollback. 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().
Callers cannot construct TreeEditor directly. Use MorphologicalTree::edit() so the edit boundary remains explicit at the call site.
Definition at line 21 of file TreeEditor.hpp.
|
inlinenoexcept |
Transfers the open edit-session handle without closing it.
Definition at line 75 of file TreeEditor.hpp.
|
default |
Leaves an unfinished edit session open.
There is intentionally no rollback in the destructor. Destroying an active editor without commit(), validateAndCommit(), or commitUnchecked() keeps the tree in editing mode so committed-tree APIs continue to reject it.
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().
Definition at line 143 of file TreeEditor.hpp.
|
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 proper-part domain.
Definition at line 311 of file TreeEditor.hpp.
|
inlinenoexcept |
Finalizes a staged edit without running the linear validation.
This is intended for internal algorithms that preserve the tree invariants by construction and may commit inside a hot loop. Public and test-facing edit sessions should keep using commit().
Definition at line 325 of file TreeEditor.hpp.
|
inline |
Creates a live detached node in the topological hierarchy.
The caller must attach or release the node before a checked commit can succeed.
Definition at line 98 of file TreeEditor.hpp.
Detaches one non-root node from the connected rooted component.
Definition at line 106 of file TreeEditor.hpp.
|
inlinenoexcept |
Returns whether the staged edit still has detached alive nodes.
Definition at line 278 of file TreeEditor.hpp.
Applies the committed-safe parent merge inside the staged edit.
Definition at line 269 of file TreeEditor.hpp.
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.
Definition at line 164 of file TreeEditor.hpp.
|
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 ownership index.
Definition at line 181 of file TreeEditor.hpp.
Transfers every direct proper part from sourceNodeId to targetNodeId.
The underlying splice is linear only in the number of moved direct proper parts.
Definition at line 201 of file TreeEditor.hpp.
Applies the committed-safe subtree prune inside the staged edit.
Definition at line 260 of file TreeEditor.hpp.
Releases an empty detached non-root node slot.
Definition at line 229 of file TreeEditor.hpp.
|
inline |
Detaches a direct child from its parent and optionally releases an empty detached slot.
Definition at line 215 of file TreeEditor.hpp.
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.
Definition at line 123 of file TreeEditor.hpp.
Promotes nodeId to become the connected root.
The previous root becomes detached; callers must reconnect or explicitly tolerate that state before a checked commit.
Definition at line 249 of file TreeEditor.hpp.
|
inlinenoexcept |
Runs strong validation without closing the session.
Definition at line 285 of file TreeEditor.hpp.
|
inlinenoexcept |
Validates and closes the edit session on success.
Definition at line 295 of file TreeEditor.hpp.
|
friend |
Definition at line 22 of file TreeEditor.hpp.