9 #ifndef __PDG_ATTRIBUTE_ARRAY_H__
10 #define __PDG_ATTRIBUTE_ARRAY_H__
53 return (myData.size() > 0);
61 inline bool valid(
int component)
const
63 return (component >= 0) && (component < myData.size());
68 int real_index = component;
73 if (!valid(real_index))
76 data = myData[real_index];
82 return myData[component];
87 return myData[component];
102 expand(value, component);
107 myData.setSizeIfNeeded(data.size());
108 for (
exint i = 0; i < data.size(); i++)
114 myData.append(value);
115 return myData.last();
135 myData.truncate(length);
140 myData.concat(other->
myData);
146 myData.setSize(myData.size() +
offset);
152 myData.setSize(size);
162 hash_value = SYShashRange(myData.begin(), myData.end());
163 else if (index > myData.size())
166 hash_value =
SYShash(myData[index]);
173 myData.swap(other->
myData);
195 myData.setSizeIfNeeded(data.size());
196 for (
int i = 0; i < data.size(); i++)
206 return ((
const Self*)(other))->myData == myData;
232 exint step = step_opt.value_or(1);
246 if (i < 0 || i >= len)
249 result.append(myData[i]);
252 if (step < 0 && i <= end)
255 if (step >= 0 && i >= end)
267 myData.append(value);
271 myData.setSizeIfNeeded(component+1);
272 myData[component] =
value;
282 myData.append(default_value);
284 else if (component >= myData.size())
286 myData.setSizeIfNeeded(component+1);
287 myData[component] = default_value;
DataType & value(int component)
Append to the existing attribute if it exists and matches.
constexpr size_t SYShash(const SYS_Flicks f)
bool hash(SYS_HashType &hash_value, exint index, UT_WorkBuffer &errors) const override
Return a hash value derived from the attribute data.
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
GLsizei const GLfloat * value
void setValues(const ArrayType &data)
std::size_t SYS_HashType
Define the type for hash values.
GLuint GLsizei GLsizei * length
bool slice(ArrayType &result, exint start, UT_Optional< exint > end_opt=UT_Optional< exint >(), UT_Optional< exint > step_opt=UT_Optional< exint >()) const
**But if you need a result
void setValue(const DataType &value, int component)
void truncate(int length)
std::optional< T > UT_Optional
const DataType & value(int component) const
void copy(const Self *other, PDG_AttributeCopyOp copy_op)
const ArrayType & values() const
bool concat(const Self *other)
const DataType & appendValue(const DataType &value)
void setValue(const ArrayType &&data)
void setValue(const ArrayType &data)
virtual PDG_AttributeMergeError merge(PDG_AttributeMergeOp merge_op, int stride)=0
Applies a merge op to the data in this attribute.
PDG_AttributeArray(const ArrayType &data)
GLint GLenum GLboolean GLsizei stride
bool valid(int component) const
void expand(const DataType &value, int component)
PDG_AttributeType
Enumeration of possible attribute types.
~PDG_AttributeArray() override
PDG_AttributeMergeOp
Enumeration of different ways that attributes can be combined.
Prepend to the existing attribute if it exists and matches.
bool adjustSize(int offset)
void expandIfNeeded(const DataType &default_value, int component)
bool value(DataType &data, int component) const
PDG_AttributeMergeError
Enumerations of errors that can occur when merging attributes.
PDG_AttributeMergeError merge(PDG_AttributeMergeOp merge_op, int stride) override
Applies a merge op to the data in this attribute.
void copy(const ArrayType &data, PDG_AttributeCopyOp copy_op)
size_t hash_value(const CH_ChannelRef &ref)
bool compare(const PDG_AttributeData *other) const override
Compares this data object with another data object.
PDG_AttributeCopyOp
Enumeration of attribute copy operations.