Enzo
Loading...
Searching...
No Matches
enzo::attr::Attribute Class Reference

Containers for geometry data. More...

#include <Attribute.h>

Public Member Functions

 Attribute (std::string name, attr::AttributeType type, bool intrinsic=false, bool isPrivate=false)
 Construct a new attribute and initialize its typed storage.
 
 Attribute (const Attribute &other)
 
AttributeType getType () const
 Returns the attribute type this attribute stores.
 
std::string getName () const
 Returns the name of this attribute.
 
Vector3 getVector3 (Offset offset) const
 
Matrix4 getMatrix4 (Offset offset) const
 
size_t getSize () const
 
unsigned int getTypeSize () const
 Returns the number of components in the type (eg. StringT is 1, vectorT is 3).
 
bool isIntrinsic () const
 Returns whether the attribute is intrinsic.
 
bool isPrivate () const
 Returns whether the attribute is private.
 
void resize (size_t size)
 Changes the number of elements stored.
 
void compact (const std::vector< bool > &keep)
 Removes entries marked as deleted, defragmenting the storage so offsets are contiguous again.
 

Friends

template<typename T >
class AttributeHandle
 
template<typename T >
class AttributeHandleRO
 

Detailed Description

Containers for geometry data.

Attributes are the containers for geometry data in the engine. Each attribute is a single column in the spreadsheet that makes up your geometry. The column has a single name and type. Based on the attribute owner it will also have a value for each element. For example, if the owner is a point then your attribute might be Color, your type might be a vector, and the attribute will have a color value for each point in the mesh. Attributes own the underlying storage for their values, which is contiguous and strongly typed (e.g., ints, floats, vectors, bools). This allows a single attribute class to store data regardless of the type without templates. Attributes cannot be read or written from by themselves. For that an attribute handle is required, (see enzo::attr::AttributeHandle).

Note
Values are strongly typed; invalid type combinations are guarded both at compile time (via handles) and at runtime (defensive checks).

Constructor & Destructor Documentation

◆ Attribute()

enzo::attr::Attribute::Attribute ( std::string name,
attr::AttributeType type,
bool intrinsic = false,
bool isPrivate = false )

Construct a new attribute and initialize its typed storage.

Parameters
nameHuman-readable identifier, spaces are not permitted (unique within a collection/scope).
typeAttribute data type that values will be stored in.

Member Function Documentation

◆ isIntrinsic()

bool enzo::attr::Attribute::isIntrinsic ( ) const

Returns whether the attribute is intrinsic.

An intrinsic attribute is an inherent property of the geometry created with the geometry automatically and cannot be deleted.

◆ isPrivate()

bool enzo::attr::Attribute::isPrivate ( ) const

Returns whether the attribute is private.

A private attribute is hidden from the user (e.g. not shown in the spreadsheet). It is engine-internal state used during cooks.


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