|
HDK
|
#include <UN_CustomData.h>
Inheritance diagram for UN_CustomDataT< ID, INDEX >:Public Member Functions | |
| virtual void | setCapacityIfNeeded (UN_DataSize min_capacity)=0 |
| virtual void | merge (const UN_CustomData &other, const UN_DataMergeInfo &data_merge_info)=0 |
| virtual void | addData (ID id, INDEX index)=0 |
| Adds a new data slot to accommodate a new piece of data. More... | |
| virtual void | clearData (ID id, INDEX index)=0 |
| virtual void | removeData (ID id, INDEX index)=0 |
| virtual void | removeAllData ()=0 |
| bool | isValid (ID id) const |
| INDEX | dataIndex (ID id) const |
| Returns the data index into the data buffer arrays given its ID. More... | |
| UN_DataSize | dataBufferSize () const |
Public Member Functions inherited from UN_CustomData | |
| UN_CustomData ()=default | |
| Constructor and destructor. More... | |
| virtual | ~UN_CustomData ()=default |
| const UN_DataIndexMap * | indexMap () const |
Protected Member Functions | |
| template<typename V , typename B > | |
| void | setData (B &buffer, ID 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, ID 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, ID 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, ID id, const V &default_value) const |
| template<typename V , typename B > | |
| V | stealData (B &buffer, ID 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, ID id, const OP &op) |
The interface for custom data containters, templetized for convenience of using spcific IDs (eg, UN_NodeID, UN_PortID, etc), rather than generic UN_DataID. Note, this would normally be part of UN_CustomData, but templates can complicate things, like forward declarations, so using a concrete base class for that.
Definition at line 68 of file UN_CustomData.h.
|
pure virtual |
Adds a new data slot to accommodate a new piece of data.
|
pure virtual |
Clears the data slot of a given ID and at the corresponding index as if it was newly created.
|
inline |
Returns the size of the data buffers that use indexing based on the dataIndex() lookup call that maps IDs to indices. The size is lagest index issued plus one.
Definition at line 120 of file UN_CustomData.h.
|
inline |
Returns the data index into the data buffer arrays given its ID.
Definition at line 110 of file UN_CustomData.h.
|
inlineprotected |
Helper method to return a const ref to an entry in the data buffer.
Definition at line 147 of file UN_CustomData.h.
|
inlineprotected |
Returns 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 161 of file UN_CustomData.h.
|
inline |
Returns true if the given ID refers to a valid data entry in the data buffers. Ie, such a piece of data exists and is valid.
Definition at line 104 of file UN_CustomData.h.
|
pure virtual |
Merge the other custom data into this one. The merge info includes ID remapping as well as buffer spans that can be copied in bulk. The spans don't contain root data, (applicable only to node and subnet data) so this method should merge any desired root data separately.
|
pure virtual |
Frees all the the data slots occupied by all the items, clearing them if necessary.
|
pure virtual |
Frees the data slot occupied by the item given by the id and a corresponding index (either can be used), clearing it if necessary.
|
pure virtual |
Increases the capacity of the data buffer arrays to the given minimum, unless the capacity is already greater or equal to that minimum, in which case the capacity remains unchanged. This is a hint to the custom data, in case it uses data buffer arrays.
|
inlineprotected |
Helper method to copy-assign the value to an entry in the data buffer.
Definition at line 130 of file UN_CustomData.h.
|
inlineprotected |
Helper method to move-assign the value to an entry in the data buffer.
Definition at line 138 of file UN_CustomData.h.
|
inlineprotected |
Helper method to return a value moved from an entry in the data buffer.
Definition at line 170 of file UN_CustomData.h.
|
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 186 of file UN_CustomData.h.