mmcfilters
Public API documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mmcfilters::NodeAttributeSampleLayout Class Reference

Layout for node attributes sampled at signed ancestor/current/descendant offsets. More...

#include <AttributeNames.hpp>

Public Member Functions

 NodeAttributeSampleLayout (std::unordered_map< NodeAttributeSampleKey, int > &&map)
 Constructs a layout from an already validated offset map.
 
int getIndex (Attribute attribute, int sampleOffset) const
 Returns the per-node offset associated with (attribute, sampleOffset).
 
int getIndex (NodeAttributeSampleKey sampleKey) const
 Returns the per-node offset associated with a composite sample key.
 
int linearIndex (int nodeIndex, Attribute attribute, int sampleOffset) const
 Returns the linear index in the flat buffer for a given node and sampled attribute.
 
int linearIndex (int nodeIndex, NodeAttributeSampleKey sampleKey) const
 Convenience overload taking a NodeAttributeSampleKey.
 

Static Public Member Functions

static NodeAttributeSampleLayout create (int samplingRadius, const std::vector< Attribute > &attributes)
 Builds the canonical dense layout for offsets in [-samplingRadius, samplingRadius].
 
static std::string toString (NodeAttributeSampleKey sampleKey)
 Returns a human-readable label for a composite key.
 
static std::string toString (Attribute attribute, int sampleOffset)
 Returns a serialized label for an attribute at a sample offset.
 

Public Attributes

std::unordered_map< NodeAttributeSampleKey, intindexMap
 Maps each (attribute, sampleOffset) key to its per-node offset.
 
const int NUM_ATTRIBUTES
 Number of sampled entries stored for each node.
 

Detailed Description

Layout for node attributes sampled at signed ancestor/current/descendant offsets.

The layout is node-major: for a given node, all requested sample positions are stored contiguously. NUM_ATTRIBUTES therefore counts the number of (attribute, sampleOffset) entries associated with each node.

Definition at line 32 of file AttributeNames.hpp.

Constructor & Destructor Documentation

◆ NodeAttributeSampleLayout()

mmcfilters::NodeAttributeSampleLayout::NodeAttributeSampleLayout ( std::unordered_map< NodeAttributeSampleKey, int > &&  map)
inline

Constructs a layout from an already validated offset map.

The constructor takes ownership of map and derives the per-node stride from its final size.

Parameters
mapMapping used to initialize the layout.

Definition at line 48 of file AttributeNames.hpp.

Member Function Documentation

◆ create()

static NodeAttributeSampleLayout mmcfilters::NodeAttributeSampleLayout::create ( int  samplingRadius,
const std::vector< Attribute > &  attributes 
)
inlinestatic

Builds the canonical dense layout for offsets in [-samplingRadius, samplingRadius].

Parameters
samplingRadiusMaximum ancestor/descendant sample offset.
attributesAttributes requested by the operation.
Returns
The resulting canonical dense sampled layout.

Definition at line 58 of file AttributeNames.hpp.

◆ getIndex() [1/2]

int mmcfilters::NodeAttributeSampleLayout::getIndex ( Attribute  attribute,
int  sampleOffset 
) const
inline

Returns the per-node offset associated with (attribute, sampleOffset).

Parameters
attributeAttribute requested by the operation.
sampleOffsetSigned sample coordinate.
Returns
The per-node offset associated with the key.

Definition at line 79 of file AttributeNames.hpp.

◆ getIndex() [2/2]

int mmcfilters::NodeAttributeSampleLayout::getIndex ( NodeAttributeSampleKey  sampleKey) const
inline

Returns the per-node offset associated with a composite sample key.

Parameters
sampleKeyComposite sampled-attribute key.
Returns
The per-node offset associated with the key.

Definition at line 89 of file AttributeNames.hpp.

◆ linearIndex() [1/2]

int mmcfilters::NodeAttributeSampleLayout::linearIndex ( int  nodeIndex,
Attribute  attribute,
int  sampleOffset 
) const
inline

Returns the linear index in the flat buffer for a given node and sampled attribute.

Parameters
nodeIndexIndex.
attributeAttribute requested by the operation.
sampleOffsetSigned sample coordinate.
Returns
The linear index in the flat buffer.

Definition at line 100 of file AttributeNames.hpp.

◆ linearIndex() [2/2]

int mmcfilters::NodeAttributeSampleLayout::linearIndex ( int  nodeIndex,
NodeAttributeSampleKey  sampleKey 
) const
inline

Convenience overload taking a NodeAttributeSampleKey.

Parameters
nodeIndexIndex.
sampleKeyComposite sampled-attribute key.
Returns
Value returned by the convenience overload.

Definition at line 111 of file AttributeNames.hpp.

◆ toString() [1/2]

static std::string mmcfilters::NodeAttributeSampleLayout::toString ( Attribute  attribute,
int  sampleOffset 
)
inlinestatic

Returns a serialized label for an attribute at a sample offset.

Parameters
attributeAttribute requested by the operation.
sampleOffsetSigned sample coordinate.
Returns
The canonical serialized label.

Definition at line 132 of file AttributeNames.hpp.

◆ toString() [2/2]

static std::string mmcfilters::NodeAttributeSampleLayout::toString ( NodeAttributeSampleKey  sampleKey)
inlinestatic

Returns a human-readable label for a composite key.

Parameters
sampleKeyComposite sampled-attribute key.
Returns
A human-readable label for a composite key.

Definition at line 121 of file AttributeNames.hpp.

Member Data Documentation

◆ indexMap

std::unordered_map<NodeAttributeSampleKey, int> mmcfilters::NodeAttributeSampleLayout::indexMap

Maps each (attribute, sampleOffset) key to its per-node offset.

Definition at line 35 of file AttributeNames.hpp.

◆ NUM_ATTRIBUTES

const int mmcfilters::NodeAttributeSampleLayout::NUM_ATTRIBUTES

Number of sampled entries stored for each node.

Definition at line 38 of file AttributeNames.hpp.


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