48 {
return myCustomData.get(); }
50 {
return myCustomData.get(); }
56 {
return myIndexMap.idRange(); }
61 {
return myIndexMap.orderedIDRange(); }
65 {
return myIndexMap.ids(); }
69 {
return myIndexMap.sortedIDs(); }
73 {
return myIndexMap.size(); }
78 {
return myIndexMap.indexSize(); }
83 {
return myIndexMap.idSize(); }
96 bool combine_id_zero =
false )
98 return myIndexMap.merge(
111 std::pair< UN_DataID, UN_DataIndex >
113 {
return myIndexMap.addEntry(); }
118 std::pair< UN_DataID, UN_DataIndex >
120 {
return myIndexMap.findOrAddEntry( data_id ); }
129 {
return myIndexMap.removeEntry( data_id ); }
134 { myIndexMap.removeAllEntries( reset_next_id );}
141 {
return myIndexMap.isValid( data_id ); }
148 {
return myIndexMap.indexFromID(
id); }
155 {
return myIndexMap.dataBufferSize(); }
161 {
return myIndexMap.freeDataBufferSize(); }
167 {
return myIndexMap.usedDataBufferSize(); }
171 template<
typename V,
typename B>
175 UN_DataBufferUtils::setData( buffer, dataIndex(
id), value );
179 template<
typename V,
typename B>
183 UN_DataBufferUtils::setData( buffer, dataIndex(
id),
184 std::forward<V>(
value));
188 template<
typename V,
typename B>
192 return UN_DataBufferUtils::getDataRef( buffer, dataIndex(
id),
202 template<
typename V,
typename B>
211 template<
typename V,
typename B>
215 return UN_DataBufferUtils::stealData( buffer, dataIndex(
id),
227 template<
typename OP,
typename B>
231 UN_DataBufferUtils::updateData( buffer, dataIndex(
id), op );
243 const D &default_value )
245 return myGenericData.addBuffer( name, type, default_value,
253 return myGenericData.bufferType(
id );
261 return myGenericData.findBuffer( name );
268 return myGenericData.bufferName(
id );
278 myGenericData.setData( buf_id, dataIndex(
id), value );
286 myGenericData.setData( buf_id, dataIndex(
id),
287 std::forward<T>(
value) );
295 return myGenericData.getDataRef<
T>( buf_id, dataIndex(
id) );
305 return myGenericData.getDataVal<
T>( buf_id, dataIndex(
id) );
313 return myGenericData.stealData<
T>( buf_id, dataIndex(
id) );
317 template<
typename T,
typename OP>
322 myGenericData.updateData<
T>( buf_id, dataIndex(
id),
op );
329 { myGenericData.addData( index ); }
333 { myGenericData.clearData( index ); }
337 { myGenericData.removeAllData(); }
342 { myGenericData.setCapacityIfNeeded(
348 { myGenericData.mergeData(
349 src.myGenericData, merge_info ); }
354 {
return myGenericData.isDataSizeConsistent(
UN_GenericBufferType
Supported types for generic data buffers.
V getDataVal(const B &buffer, UN_DataIndex index, const V &default_value)
UN_DataSize indexSize() const
GLsizei const GLfloat * value
void addGenericData(UN_DataIndex index)
Adds a data slot at the given index to all generic buffers.
UN_DataSize idSize() const
T genericDataVal(UN_GenericBufferID buf_id, UN_DataID id) const
std::pair< UN_DataID, UN_DataIndex > findOrAddData(UN_DataID data_id)
bool isValid(UN_DataID data_id) const
void updateGenericData(UN_GenericBufferID buf_id, UN_DataID id, const OP &op)
Updates the data value in a generic buffer in-place via a callable.
std::pair< UN_DataID, UN_DataIndex > addData()
UN_DataSize usedDataBufferSize() const
bool removeData(UN_DataID data_id)
UT_IteratorRange< IDIterator > IDRange
UN_DataIndex dataIndex(UN_DataID id) const
UN_DataSize dataBufferSize() const
void setData(B &buffer, UN_DataID id, V &&value)
Helper method to move-assign the value to an entry in the data buffer.
GLint GLint GLsizei GLint GLenum GLenum type
V stealData(B &buffer, UN_DataID id, const V &default_value)
Helper method to return a value moved from an entry in the data buffer.
UN_CustomData * customData()
Returns the custom data container, if one was provided.
void setGenericData(UN_GenericBufferID buf_id, UN_DataID id, const T &value)
Sets the data value in a generic buffer for a given data ID.
const UN_CustomData * customData() const
Returns the custom data container, if one was provided.
const T & genericDataRef(UN_GenericBufferID buf_id, UN_DataID id) const
Returns a const ref to the data value in a generic buffer.
void setGenericData(UN_GenericBufferID buf_id, UN_DataID id, T &&value)
Sets the data value in a generic buffer via move.
UN_DataIDList dataIDs() const
Returns a list of all the valid IDs in this container.
UN_DataSize freeDataBufferSize() const
GLuint const GLchar * name
T stealGenericData(UN_GenericBufferID buf_id, UN_DataID id)
Moves the data value out of a generic buffer.
V getDataVal(const B &buffer, UN_DataID id, const V &default_value) const
void updateData(B &buffer, UN_DataID id, const OP &op)
void removeAllGenericData()
Removes all data from all generic buffers.
Maintains a mapping from data ID to data index in the data buffer.
void setGenericDataCapacityIfNeeded(UN_DataSize min_capacity)
Grows all generic buffers to the given minimum capacity.
bool isGenericDataSizeConsistent(UN_DataSize expected_size) const
Returns true if all generic buffers have the expected size.
const UT_StringHolder & genericBufferName(UN_GenericBufferID id) const
Returns the name of the generic buffer identified by the given ID.
void mergeGenericData(const UN_Data &src, const UN_DataMergeInfo &merge_info)
Merges generic data from another UN_Data container.
LeafData & operator=(const LeafData &)=delete
void setData(B &buffer, UN_DataID id, const V &value)
Helper method to copy-assign the value to an entry in the data buffer.
void removeAllData(bool reset_next_id)
UN_GenericBufferType genericBufferType(UN_GenericBufferID id) const
Returns the type of the generic buffer identified by the given ID.
UN_GenericBufferID findGenericBuffer(const UT_StringRef &name) const
UN_DataMergeInfo mergeData(const UN_Data &src_data, bool combine_id_zero=false)
UN_DataSize size() const
Returns the number of valid data items in the buffer.
UN_DataIDList sortedDataIDs() const
Returns a sorted list of all the valid IDs in this container.
void clearGenericData(UN_DataIndex index)
Clears the generic data at the given index to defaults.
UT_UniquePtr< UN_CustomData > UN_CustomDataPtr
UN_GenericBufferID addGenericBuffer(const UT_StringRef &name, UN_GenericBufferType type, const D &default_value)
const V & getDataRef(const B &buffer, UN_DataID id, const V &default_value) const
Helper method to return a const ref to an entry in the data buffer.
UT_IteratorRange< OrderedIDIterator > OrderedIDRange
OrderedIDRange orderedIDRange() const