Enzo
Loading...
Searching...
No Matches
enzo::ga::AttributeHandleRO< T > Class Template Reference

Read only accessor for enzo::ga::Attribute. More...

#include <AttributeHandle.h>

Public Member Functions

 AttributeHandleRO (std::shared_ptr< const Attribute > attribute)
 Construct a new typed handle linked to a target attribute.
 
std::vector< T > getAllValues () const
 Gets a vector containing all the values stored in this attribute.
 
size_t getSize () const
 Gets the number of element stored in the attribute.
 
getValue (size_t pos) const
 Gets the value at a given offset.
 
std::string getName () const
 Returs the attribute name as a string.
 

Public Attributes

ga::AttributeType type_
 

Detailed Description

template<typename T>
class enzo::ga::AttributeHandleRO< T >

Read only accessor for enzo::ga::Attribute.

Template Parameters
TC++ value type matching the Attribute’s logical type (e.g., bt::intT, bt::floatT, bt::Vector3, bt::boolT).

An Attribute Handle is a typed view into an attribute’s storage. It binds at construction to a concrete type and exposes operations like reserving capacity, appending values, and reading/writing by index. Because the handle uses templating, most misuse is caught at compile time, and runtime guards raise errors if an attribute/handle type combination isn’t accounted for. In the future implicit casting can be added for convenience. Handles don’t own data, they just reference the attribute’s storage.

There is also a read-only handle variant that provides the same typed accessors without mutation. This is useful when an operator needs to inspect data but must not modify it, when the engine exposes attributes to user code with limited permissions, or when implementing const member functions that require attribute access.

Together, attributes define the schema and storage, while handles provide the typed access that nodes and tools use to operate on data directly.

Constructor & Destructor Documentation

◆ AttributeHandleRO()

template<typename T >
enzo::ga::AttributeHandleRO< T >::AttributeHandleRO ( std::shared_ptr< const Attribute > attribute)
inline

Construct a new typed handle linked to a target attribute.

Parameters
attributeThe target attribute this handle will modify

Member Function Documentation

◆ getAllValues()

template<typename T >
std::vector< T > enzo::ga::AttributeHandleRO< T >::getAllValues ( ) const
inline

Gets a vector containing all the values stored in this attribute.

Todo
Replace with an iterator for accessing many values.
Returns
A vector containing all the values stored in this attribute.

◆ getName()

template<typename T >
std::string enzo::ga::AttributeHandleRO< T >::getName ( ) const
inline

Returs the attribute name as a string.

◆ getSize()

template<typename T >
size_t enzo::ga::AttributeHandleRO< T >::getSize ( ) const
inline

Gets the number of element stored in the attribute.

◆ getValue()

template<typename T >
T enzo::ga::AttributeHandleRO< T >::getValue ( size_t pos) const
inline

Gets the value at a given offset.

Returns
The value stored at a given offset
Todo

protect against invalid positions

Add implicit casting between types (eg. if T is int but the parameter's ga::AttributeType is floatT 5.3 return 5)


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