|
| | UN_Data (const UN_Data &) |
| |
| UN_Data & | operator= (const UN_Data &) |
| |
| UN_DataMergeInfo | mergeData (const UN_Data &src_data, bool combine_id_zero=false) |
| |
std::pair< UN_DataID,
UN_DataIndex > | addData () |
| |
std::pair< UN_DataID,
UN_DataIndex > | findOrAddData (UN_DataID data_id) |
| |
| bool | removeData (UN_DataID data_id) |
| |
| void | removeAllData (bool reset_next_id) |
| |
| bool | isValid (UN_DataID data_id) const |
| |
| UN_DataIndex | dataIndex (UN_DataID id) const |
| |
| UN_DataSize | dataBufferSize () const |
| |
| UN_DataSize | freeDataBufferSize () const |
| |
| UN_DataSize | usedDataBufferSize () const |
| |
| template<typename V , typename B > |
| void | setData (B &buffer, UN_DataID id, const V &value) |
| | Helper method to copy-assign the value to an entry in the data buffer. More...
|
| |
| template<typename V , typename B > |
| void | setData (B &buffer, UN_DataID id, V &&value) |
| | Helper method to move-assign the value to an entry in the data buffer. More...
|
| |
| template<typename V , typename B > |
| 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. More...
|
| |
| template<typename V , typename B > |
| V | getDataVal (const B &buffer, UN_DataID id, const V &default_value) const |
| |
| template<typename V , typename B > |
| 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. More...
|
| |
| template<typename OP , typename B > |
| void | updateData (B &buffer, UN_DataID id, const OP &op) |
| |
| template<typename T > |
| 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. More...
|
| |
| template<typename T > |
| void | setGenericData (UN_GenericBufferID buf_id, UN_DataID id, T &&value) |
| | Sets the data value in a generic buffer via move. More...
|
| |
| template<typename T > |
| const T & | genericDataRef (UN_GenericBufferID buf_id, UN_DataID id) const |
| | Returns a const ref to the data value in a generic buffer. More...
|
| |
| template<typename T > |
| T | genericDataVal (UN_GenericBufferID buf_id, UN_DataID id) const |
| |
| template<typename T > |
| T | stealGenericData (UN_GenericBufferID buf_id, UN_DataID id) |
| | Moves the data value out of a generic buffer. More...
|
| |
| template<typename T , typename OP > |
| 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. More...
|
| |
| void | addGenericData (UN_DataIndex index) |
| | Adds a data slot at the given index to all generic buffers. More...
|
| |
| void | clearGenericData (UN_DataIndex index) |
| | Clears the generic data at the given index to defaults. More...
|
| |
| void | removeAllGenericData () |
| | Removes all data from all generic buffers. More...
|
| |
| void | setGenericDataCapacityIfNeeded (UN_DataSize min_capacity) |
| | Grows all generic buffers to the given minimum capacity. More...
|
| |
| void | mergeGenericData (const UN_Data &src, const UN_DataMergeInfo &merge_info) |
| | Merges generic data from another UN_Data container. More...
|
| |
| bool | isGenericDataSizeConsistent (UN_DataSize expected_size) const |
| | Returns true if all generic buffers have the expected size. More...
|
| |
A generic container of the data buffers.
NOTE: This class is generally not trivially relocatable, because it sets a pointer to its member (myIndexMap) on another member (myCustomData).
Definition at line 28 of file UN_Data.h.
Adds a slot for new data in the data buffers of this container, and returns the data ID by which this slot can be refered to, and also at which index in a buffer the data slot is expected to be. A slot usually corresponds to a concrete graph element (eg, a node), and data buffer slots store some info about it, (eg, a name or a type). NOTE: The derived classes must insert a corresponding entry in all of their data buffers, at the given index. The index can also be found by dataIndex(ID).
Definition at line 112 of file UN_Data.h.
template<typename V , typename B >
| V UN_Data::getDataVal |
( |
const B & |
buffer, |
|
|
UN_DataID |
id, |
|
|
const V & |
default_value |
|
) |
| const |
|
inlineprotected |
Helper method to return a value constructed from an entry in the data buffer. This is useful when the type returned here differs from the underlying entry type. In particular, this is needed for UN_BoolDataBuffer whose underlying entries are bits (for which we can't return a const reference) while here we are returning bool (byte).
Definition at line 204 of file UN_Data.h.
Merges another data container into this one.
If fuse_id_zero is true, the data for the ID zero is not copied to a brand new data slot, but is combined with existing slot ID of zero. Some data containers (subclasses) use ID of zero for a special entity that is treated differently than the rest. Notably, the node data container uses ID of zero for the root node, and the root node from the src should not become a regular node here. Instead, src root ID maps to dst root ID and their data is combined.
Definition at line 95 of file UN_Data.h.
template<typename OP , typename B >
| void UN_Data::updateData |
( |
B & |
buffer, |
|
|
UN_DataID |
id, |
|
|
const OP & |
op |
|
) |
| |
|
inlineprotected |
Helper method to update an entry value in the data buffer. It updates a data value in-place in the data buffer, which for complex data values (eg, dictionaries or arrays) is faster than getting and setting the value (although stealing and setting may be comparable). This is a convenient and useful idiom, that tries to avoid the buffer data aliasing issues. Intended usage: updateData(buff, id, [&key, &value](auto &x) { x[key] = value; });
Definition at line 229 of file UN_Data.h.