MorphologicalAttributeFilters
Public API documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
mmcfilters::WeightedTreeView< T > Class Template Reference

Non-owning view pairing a topology with an external altitude span. More...

#include <WeightedTreeView.hpp>

Public Types

using altitude_type = T
 Altitude scalar type borrowed by this view.
 

Public Member Functions

 WeightedTreeView (const MorphologicalTree &topology, AltitudeSpan< T > altitude)
 Builds a view over caller-owned topology and altitude storage.
 
 WeightedTreeView (const MorphologicalTree &topology, const AltitudeBuffer< T > &altitude)
 Builds a view over a caller-owned altitude buffer.
 
 WeightedTreeView (const MorphologicalTree &, AltitudeBuffer< T > &&)=delete
 Rejects temporary altitude buffers that would leave a dangling span.
 
const MorphologicalTreetopology () const noexcept
 Returns the borrowed tree topology.
 
AltitudeSpan< Taltitude () const noexcept
 Returns the borrowed altitude span indexed by internal NodeId.
 
void requireTopologyUnchanged (const char *context) const
 Throws if the borrowed topology changed since view construction.
 
T getAltitude (NodeId nodeId) const
 Returns the altitude associated with an internal node id.
 
AltitudeDiff< TgetNodeResidue (NodeId nodeId) const
 Returns the altitude difference between a live node and its parent.
 

Detailed Description

template<AltitudeValue T>
class mmcfilters::WeightedTreeView< T >

Non-owning view pairing a topology with an external altitude span.

WeightedTreeView is the lightweight C++ representation of the Higra-like model used by generic-altitude kernels: topology ownership stays elsewhere, and altitude is borrowed as a contiguous read-only span indexed by the dense internal NodeId domain. The caller must keep both the topology and the altitude storage alive for the lifetime of the view. The view intentionally carries no ownership or canonical-tree identity; operations that need owned weighted state must receive a WeightedMorphologicalTree<T> instead.

Definition at line 24 of file WeightedTreeView.hpp.

Member Typedef Documentation

◆ altitude_type

template<AltitudeValue T>
using mmcfilters::WeightedTreeView< T >::altitude_type = T

Altitude scalar type borrowed by this view.

Definition at line 41 of file WeightedTreeView.hpp.

Constructor & Destructor Documentation

◆ WeightedTreeView() [1/2]

template<AltitudeValue T>
mmcfilters::WeightedTreeView< T >::WeightedTreeView ( const MorphologicalTree topology,
AltitudeSpan< T altitude 
)
inlineexplicit

Builds a view over caller-owned topology and altitude storage.

The span must be indexed by the dense internal NodeId domain and remain alive for the full lifetime of the view.

Definition at line 49 of file WeightedTreeView.hpp.

◆ WeightedTreeView() [2/2]

template<AltitudeValue T>
mmcfilters::WeightedTreeView< T >::WeightedTreeView ( const MorphologicalTree topology,
const AltitudeBuffer< T > &  altitude 
)
inlineexplicit

Builds a view over a caller-owned altitude buffer.

This overload is equivalent to passing std::span<const T>(altitude) and exists so WeightedTreeView(tree, buffer) deduces the altitude type.

Definition at line 60 of file WeightedTreeView.hpp.

Member Function Documentation

◆ altitude()

template<AltitudeValue T>
AltitudeSpan< T > mmcfilters::WeightedTreeView< T >::altitude ( ) const
inlinenoexcept

Returns the borrowed altitude span indexed by internal NodeId.

Definition at line 80 of file WeightedTreeView.hpp.

◆ getAltitude()

template<AltitudeValue T>
T mmcfilters::WeightedTreeView< T >::getAltitude ( NodeId  nodeId) const
inline

Returns the altitude associated with an internal node id.

Definition at line 94 of file WeightedTreeView.hpp.

◆ getNodeResidue()

template<AltitudeValue T>
AltitudeDiff< T > mmcfilters::WeightedTreeView< T >::getNodeResidue ( NodeId  nodeId) const
inline

Returns the altitude difference between a live node and its parent.

Root-like nodes, whose parent is invalid or themselves, use their own altitude as residue.

Definition at line 107 of file WeightedTreeView.hpp.

◆ requireTopologyUnchanged()

template<AltitudeValue T>
void mmcfilters::WeightedTreeView< T >::requireTopologyUnchanged ( const char context) const
inline

Throws if the borrowed topology changed since view construction.

Definition at line 87 of file WeightedTreeView.hpp.

◆ topology()

template<AltitudeValue T>
const MorphologicalTree & mmcfilters::WeightedTreeView< T >::topology ( ) const
inlinenoexcept

Returns the borrowed tree topology.

Definition at line 73 of file WeightedTreeView.hpp.


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