12 #ifndef __UN_CustomData_h__
13 #define __UN_CustomData_h__
41 {
return myIndexMap; }
67 template <
typename ID,
typename INDEX>
92 virtual void clearData( ID
id, INDEX index ) = 0;
96 virtual void removeData( ID
id, INDEX index ) = 0;
113 ? INDEX(
indexMap()->indexFromID(
id ))
128 template<
typename V,
typename B>
132 UN_DataBufferUtils::setData( buffer,
dataIndex(
id), value );
136 template<
typename V,
typename B>
140 UN_DataBufferUtils::setData( buffer,
dataIndex(
id),
141 std::forward<V>(
value));
145 template<
typename V,
typename B>
149 return UN_DataBufferUtils::getDataRef( buffer,
dataIndex(
id),
159 template<
typename V,
typename B>
168 template<
typename V,
typename B>
172 return UN_DataBufferUtils::stealData( buffer,
dataIndex(
id),
184 template<
typename OP,
typename B>
188 UN_DataBufferUtils::updateData( buffer,
dataIndex(
id), op );
V getDataVal(const B &buffer, UN_DataIndex index, const V &default_value)
void setData(B &buffer, ID id, V &&value)
Helper method to move-assign the value to an entry in the data buffer.
V getDataVal(const B &buffer, ID id, const V &default_value) const
V stealData(B &buffer, ID id, const V &default_value)
Helper method to return a value moved from an entry in the data buffer.
GLsizei const GLfloat * value
UN_DataSize dataBufferSize() const
void updateData(B &buffer, ID id, const OP &op)
virtual void setCapacityIfNeeded(UN_DataSize min_capacity)=0
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
UN_DataSize dataBufferSize() const
virtual void removeData(ID id, INDEX index)=0
UN_CustomData()=default
Constructor and destructor.
bool isValid(ID id) const
void setData(B &buffer, ID id, const V &value)
Helper method to copy-assign the value to an entry in the data buffer.
INDEX dataIndex(ID id) const
Returns the data index into the data buffer arrays given its ID.
virtual void removeAllData()=0
Maintains a mapping from data ID to data index in the data buffer.
virtual void merge(const UN_CustomData &other, const UN_DataMergeInfo &data_merge_info)=0
bool isValid(UN_DataID data_id) const
Returns true if the given ID refers to a valid entry in the map.
virtual void addData(ID id, INDEX index)=0
Adds a new data slot to accommodate a new piece of data.
virtual void clearData(ID id, INDEX index)=0
UT_UniquePtr< UN_CustomData > UN_CustomDataPtr
const UN_DataIndexMap * indexMap() const
virtual ~UN_CustomData()=default
const V & getDataRef(const B &buffer, ID id, const V &default_value) const
Helper method to return a const ref to an entry in the data buffer.