HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMX_Attribute Class Reference

#include <IMX_Attribute.h>

Public Member Functions

 IMX_Attribute ()
 An un-allocated null-Attribute, but with default meta data. More...
 
 IMX_Attribute (const IMX_Attribute &other)
 
 IMX_Attribute (IMX_Attribute &&other) noexcept
 
 ~IMX_Attribute ()
 
void copy (const IMX_Attribute &other)
 Assignment operators. More...
 
IMX_Attributeoperator= (const IMX_Attribute &other)
 
void swap (IMX_Attribute &other)
 
IMX_Attributeoperator= (IMX_Attribute &&other)
 
bool save (std::ostream &os) const
 Returns true for successful save. More...
 
bool saveJSON (UT_JSONWriter &w) const
 
bool buildFromAttribute (const GA_Attribute *attrib, GA_AttributeOwner owner)
 
void buildFromEntries (GA_StorageClass storage, int tuplesize, const IMX_Attribute *src)
 
void buildFromEntries (GA_StorageClass storage, int tuplesize, GA_Precision precision, GA_TypeInfo typeinfo, bool isarray, exint entries)
 
void copyMetadataToOptions (UT_Options &opt) const
 
void updateMetadataFromOptions (const UT_Options &opt)
 Load ourselves from the options, ignoring fields we don't know. More...
 
GA_CEAttributeAccessorPtr getCEAttributeAccessor (bool read, bool write)
 
GA_CEAttributeAccessorPtr getCEAttributeAccessorR () const
 
GA_CEAttributeAccessorPtr getCEAttributeAccessorW ()
 
GA_CEAttributeAccessorPtr getCEAttributeAccessorRW ()
 
GA_Size entries () const
 
int tupleSize () const
 
int getChannels () const
 
GA_StorageClass storage () const
 
GA_Precision precision () const
 
bool isArray () const
 
void setTypeInfo (GA_TypeInfo typeinfo)
 
GA_TypeInfo typeInfo () const
 
void setDefaults (const GA_Defaults &def)
 
const GA_Defaultsdefaults () const
 
GA_AttributeOwner owner () const
 
void setOwner (GA_AttributeOwner owner)
 
bool isOnGPU () const
 
bool isOnCPU () const
 
void setInUseGPUFlag () const
 
void clearInUseGPUFlag () const
 
GA_CEAttributePtr data ()
 
GA_CEAttributeConstPtr data () const
 
bool stealable () const
 
void setStealable (bool v) const
 
bool isDirty () const
 True if there are no VDB grids on GPU or CPU. More...
 
void freeBuffers ()
 Frees all buffers and marks dirty. More...
 
void destroy ()
 Frees all the memory. More...
 
bool allocated () const
 
int64 getMemoryUsage () const
 
int64 getDeviceMemoryUsage () const
 
void setProperties (const UT_OptionsHolder &props)
 
UT_OptionsHolder properties () const
 
template<typename OP >
void updateProperties (const OP &op)
 
bool rawData (UT_WorkBuffer &data) const
 Returns the contiguous raw bytes for a numeric non-array attribute. More...
 
bool setRawData (const char *data, exint length)
 Replaces the contiguous raw bytes for a numeric non-array attribute. More...
 
template<typename OP >
void dispatch (const OP &op) const
 
fpreal64 computeMin (int channel=0) const
 
fpreal64 computeMax (int channel=0) const
 
fpreal64 computeMinLength () const
 
fpreal64 computeMaxLength () const
 
fpreal64 computeAverage (int channel=0) const
 
exint computeMinI (int channel=0) const
 
exint computeMaxI (int channel=0) const
 

Static Public Member Functions

static IMX_AttributePtr load (UT_IStream &is)
 
static IMX_AttributePtr loadJSON (UT_JSONParser &p)
 
static int registerAttribute (IMX_AttributeConstPtr vdb, UT_IntArray &registered)
 
static void unregisterAttributes (UT_IntArray &registered)
 
static IMX_AttributeConstPtr lookupAttribute (int handle)
 Look up a registered vdb by handle. More...
 
template<typename T , typename OP >
static void dispatch (const OP &op, int channels)
 

Protected Attributes

UT_SharedPtr< GA_CEAttributemyData
 
UT_OptionsHolder myProperties
 
GA_TypeInfo myTypeInfo = GA_TypeInfo::GA_TYPE_VOID
 
GA_AttributeOwner myOwner = GA_ATTRIB_INVALID
 
GA_Defaults myDefaults
 
bool myStealable = true
 

Friends

IMX_API size_t UTformatBuffer (char *buffer, size_t buffer_size, const IMX_Attribute &v)
 

Detailed Description

Definition at line 40 of file IMX_Attribute.h.

Constructor & Destructor Documentation

IMX_Attribute::IMX_Attribute ( )

An un-allocated null-Attribute, but with default meta data.

IMX_Attribute::IMX_Attribute ( const IMX_Attribute other)
inline

Definition at line 46 of file IMX_Attribute.h.

IMX_Attribute::IMX_Attribute ( IMX_Attribute &&  other)
inlinenoexcept

Definition at line 47 of file IMX_Attribute.h.

IMX_Attribute::~IMX_Attribute ( )

Member Function Documentation

bool IMX_Attribute::allocated ( ) const
inline

True if there are any CPU or GPU buffers, they may not have valid data - use isDirty() to see that.

Definition at line 149 of file IMX_Attribute.h.

bool IMX_Attribute::buildFromAttribute ( const GA_Attribute attrib,
GA_AttributeOwner  owner 
)
void IMX_Attribute::buildFromEntries ( GA_StorageClass  storage,
int  tuplesize,
const IMX_Attribute src 
)

If the storage/tuple match we get a direct copy, otherwise zero init.

void IMX_Attribute::buildFromEntries ( GA_StorageClass  storage,
int  tuplesize,
GA_Precision  precision,
GA_TypeInfo  typeinfo,
bool  isarray,
exint  entries 
)
void IMX_Attribute::clearInUseGPUFlag ( ) const
fpreal64 IMX_Attribute::computeAverage ( int  channel = 0) const
fpreal64 IMX_Attribute::computeMax ( int  channel = 0) const
exint IMX_Attribute::computeMaxI ( int  channel = 0) const
fpreal64 IMX_Attribute::computeMaxLength ( ) const
fpreal64 IMX_Attribute::computeMin ( int  channel = 0) const
exint IMX_Attribute::computeMinI ( int  channel = 0) const
fpreal64 IMX_Attribute::computeMinLength ( ) const
void IMX_Attribute::copy ( const IMX_Attribute other)

Assignment operators.

void IMX_Attribute::copyMetadataToOptions ( UT_Options opt) const

Write our fields into the provided options: This does not include properties.

GA_CEAttributePtr IMX_Attribute::data ( )
inline

The actual attribute data. This should be accessed via an accessor normally but can be used to trigger sharing.

Definition at line 127 of file IMX_Attribute.h.

GA_CEAttributeConstPtr IMX_Attribute::data ( ) const
inline

Definition at line 128 of file IMX_Attribute.h.

const GA_Defaults& IMX_Attribute::defaults ( ) const
inline

Definition at line 110 of file IMX_Attribute.h.

void IMX_Attribute::destroy ( )

Frees all the memory.

template<typename OP >
void IMX_Attribute::dispatch ( const OP &  op) const
inline

This function calls operator() on op with a zero-initialized value matching the attribute's storage type and number of channels.

Definition at line 187 of file IMX_Attribute.h.

template<typename T , typename OP >
static void IMX_Attribute::dispatch ( const OP &  op,
int  channels 
)
inlinestatic

This function calls operator() on op with a zero-initialized value matching the storage type and number of channels.

Definition at line 212 of file IMX_Attribute.h.

GA_Size IMX_Attribute::entries ( ) const
inline

Definition at line 99 of file IMX_Attribute.h.

void IMX_Attribute::freeBuffers ( )

Frees all buffers and marks dirty.

GA_CEAttributeAccessorPtr IMX_Attribute::getCEAttributeAccessor ( bool  read,
bool  write 
)

Builds an accessor to the underlying GA_CEAttribute. NOTE: The GA_CEAttributeAccessor should have its lifetime go until after the kernel has been dispatched.

GA_CEAttributeAccessorPtr IMX_Attribute::getCEAttributeAccessorR ( ) const
inline

Definition at line 91 of file IMX_Attribute.h.

GA_CEAttributeAccessorPtr IMX_Attribute::getCEAttributeAccessorRW ( )
inline

Definition at line 95 of file IMX_Attribute.h.

GA_CEAttributeAccessorPtr IMX_Attribute::getCEAttributeAccessorW ( )
inline

Definition at line 93 of file IMX_Attribute.h.

int IMX_Attribute::getChannels ( ) const
inline

Definition at line 101 of file IMX_Attribute.h.

int64 IMX_Attribute::getDeviceMemoryUsage ( ) const
int64 IMX_Attribute::getMemoryUsage ( ) const
bool IMX_Attribute::isArray ( ) const
inline

Definition at line 104 of file IMX_Attribute.h.

bool IMX_Attribute::isDirty ( ) const
inline

True if there are no VDB grids on GPU or CPU.

Definition at line 139 of file IMX_Attribute.h.

bool IMX_Attribute::isOnCPU ( ) const
inline

Definition at line 118 of file IMX_Attribute.h.

bool IMX_Attribute::isOnGPU ( ) const
inline

Definition at line 117 of file IMX_Attribute.h.

static IMX_AttributePtr IMX_Attribute::load ( UT_IStream is)
static

Returns a newly created Attribute loaded from the stream, or null if load failure.

static IMX_AttributePtr IMX_Attribute::loadJSON ( UT_JSONParser p)
static
static IMX_AttributeConstPtr IMX_Attribute::lookupAttribute ( int  handle)
static

Look up a registered vdb by handle.

IMX_Attribute& IMX_Attribute::operator= ( const IMX_Attribute other)
inline

Definition at line 53 of file IMX_Attribute.h.

IMX_Attribute& IMX_Attribute::operator= ( IMX_Attribute &&  other)
inline

Definition at line 56 of file IMX_Attribute.h.

GA_AttributeOwner IMX_Attribute::owner ( ) const
inline

The owner represents what they came from, that can be help in debugging and tracking.

Definition at line 114 of file IMX_Attribute.h.

GA_Precision IMX_Attribute::precision ( ) const
inline

Definition at line 103 of file IMX_Attribute.h.

UT_OptionsHolder IMX_Attribute::properties ( ) const
inline

Definition at line 156 of file IMX_Attribute.h.

bool IMX_Attribute::rawData ( UT_WorkBuffer data) const

Returns the contiguous raw bytes for a numeric non-array attribute.

static int IMX_Attribute::registerAttribute ( IMX_AttributeConstPtr  vdb,
UT_IntArray registered 
)
static

Attribute registration to allow vdbs to be converted to integers across HOM boundaries. Registers & returns the handle, adding the handle to the registered list

bool IMX_Attribute::save ( std::ostream &  os) const

Returns true for successful save.

bool IMX_Attribute::saveJSON ( UT_JSONWriter w) const
void IMX_Attribute::setDefaults ( const GA_Defaults def)
inline

Definition at line 109 of file IMX_Attribute.h.

void IMX_Attribute::setInUseGPUFlag ( ) const

In Use flags pass through to the underlying structure. This is suspect, you should be holding an accessor instead.

void IMX_Attribute::setOwner ( GA_AttributeOwner  owner)
inline

Definition at line 115 of file IMX_Attribute.h.

void IMX_Attribute::setProperties ( const UT_OptionsHolder props)
inline

Definition at line 154 of file IMX_Attribute.h.

bool IMX_Attribute::setRawData ( const char *  data,
exint  length 
)

Replaces the contiguous raw bytes for a numeric non-array attribute.

void IMX_Attribute::setStealable ( bool  v) const
inline

Can be used to control what stealable() subsequently returns. If set to true, indicates to the verbs that this buffer may be stolen from.

Definition at line 136 of file IMX_Attribute.h.

void IMX_Attribute::setTypeInfo ( GA_TypeInfo  typeinfo)
inline

Definition at line 106 of file IMX_Attribute.h.

bool IMX_Attribute::stealable ( ) const
inline

True if data in this buffer may be stolen from (or changed) by the verbs even if it's an input.

Definition at line 132 of file IMX_Attribute.h.

GA_StorageClass IMX_Attribute::storage ( ) const
inline

Definition at line 102 of file IMX_Attribute.h.

void IMX_Attribute::swap ( IMX_Attribute other)
int IMX_Attribute::tupleSize ( ) const
inline

Definition at line 100 of file IMX_Attribute.h.

GA_TypeInfo IMX_Attribute::typeInfo ( ) const
inline

Definition at line 107 of file IMX_Attribute.h.

static void IMX_Attribute::unregisterAttributes ( UT_IntArray registered)
static

Unregister all vdbs corresponding to the provided list, erase the list afterwards. Assertion if handle wasn't regsitered

void IMX_Attribute::updateMetadataFromOptions ( const UT_Options opt)

Load ourselves from the options, ignoring fields we don't know.

template<typename OP >
void IMX_Attribute::updateProperties ( const OP &  op)
inline

Updates the contents of the properties, first making sure it is unique. The provided operator should take a reference to a UT_Options that it will update. this->update([](UT_Options &opt) { opt.setOptionS("test", "bar"); });

Definition at line 164 of file IMX_Attribute.h.

Friends And Related Function Documentation

IMX_API size_t UTformatBuffer ( char *  buffer,
size_t  buffer_size,
const IMX_Attribute v 
)
friend

Member Data Documentation

UT_SharedPtr<GA_CEAttribute> IMX_Attribute::myData
protected

Definition at line 235 of file IMX_Attribute.h.

GA_Defaults IMX_Attribute::myDefaults
protected

Definition at line 240 of file IMX_Attribute.h.

GA_AttributeOwner IMX_Attribute::myOwner = GA_ATTRIB_INVALID
protected

Definition at line 239 of file IMX_Attribute.h.

UT_OptionsHolder IMX_Attribute::myProperties
protected

Definition at line 236 of file IMX_Attribute.h.

bool IMX_Attribute::myStealable = true
mutableprotected

Can data of this buffer be stolen by the verbs? TODO: who should reset this and when?

Definition at line 244 of file IMX_Attribute.h.

GA_TypeInfo IMX_Attribute::myTypeInfo = GA_TypeInfo::GA_TYPE_VOID
protected

Definition at line 238 of file IMX_Attribute.h.


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