HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UN_DataIDRemap Class Reference

#include <UN_Include.h>

+ Inheritance diagram for UN_DataIDRemap:

Public Member Functions

 UN_DataIDRemap ()=default
 Default constructor. More...
 
 UN_DataIDRemap (UN_DataID old_id_end, UN_DataID new_id_start, bool combine_id_zero=false)
 
UN_DataID newStartOffset () const
 
UN_DataID oldEndOffset () const
 Returns the limit for the old IDs source range. More...
 
UN_DataSize size () const
 Returns the number of IDs reserved by this merge map. More...
 
 operator bool () const
 
UN_DataID operator[] (UN_DataID old_id) const
 
UN_DataID nextDataID () const
 Returns the data ID that should be used for the data created next time. More...
 

Static Public Member Functions

static UN_DataID remapIDFromOffsets (UN_DataID old_id, UN_DataID old_offset, UN_DataID new_offset)
 

Detailed Description

Class that remaps data IDs. Eg, between merged data conainers, like UN_NodeData. It's a lightweight object representing a mapping of old IDs to new ones. NOTE: Assumes the underlying mapping is representable as a constant shift. However it has a few range checks for consistency.

Definition at line 325 of file UN_Include.h.

Constructor & Destructor Documentation

UN_DataIDRemap::UN_DataIDRemap ( )
default

Default constructor.

UN_DataIDRemap::UN_DataIDRemap ( UN_DataID  old_id_end,
UN_DataID  new_id_start,
bool  combine_id_zero = false 
)
inline

Convenience constructor. old_id_end - the limit on the original IDs in the source. Used for rudimentary range checks. new_id_start - the base destination ID at which the entries copied from the source begin their new IDs in the destination. If combine_id_zero is true, the data for the ID zero is not mapped to a brand new data slot, but is remapped to an existing ID of zero. Some data containers use ID of zero for a special entry that is treated differently than the other ones. 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 in dest. Instead, src root ID maps to dst root ID and their data is combined.

Definition at line 343 of file UN_Include.h.

Member Function Documentation

UN_DataID UN_DataIDRemap::newStartOffset ( ) const
inline

Returns the start offset for the destination ID range. I.e. the ID which source ID zero would be mapped to. Can be used with remapIdFromOffsets to map between ID sets with identical structure.

Definition at line 355 of file UN_Include.h.

UN_DataID UN_DataIDRemap::nextDataID ( ) const
inline

Returns the data ID that should be used for the data created next time.

Definition at line 389 of file UN_Include.h.

UN_DataID UN_DataIDRemap::oldEndOffset ( ) const
inline

Returns the limit for the old IDs source range.

Definition at line 359 of file UN_Include.h.

UN_DataIDRemap::operator bool ( ) const
inlineexplicit

Return true if the mergemap was constructed with a valid newStartOffset(). Default-constructed instances will return false.

Definition at line 369 of file UN_Include.h.

UN_DataID UN_DataIDRemap::operator[] ( UN_DataID  old_id) const
inline

Returns the new ID corresponding to the old ID, if the old ID is an ID contained within the source ID range; otherwise, returns an invalid ID.

Definition at line 375 of file UN_Include.h.

static UN_DataID UN_DataIDRemap::remapIDFromOffsets ( UN_DataID  old_id,
UN_DataID  old_offset,
UN_DataID  new_offset 
)
inlinestatic

Let O be some object in an ID set S. If S is remapped multiple times at offsets A and B, with I being its ID within A, then {remapIdFromOffsets(I, A, B)} will return the ID of O within the remapping starting at B. If these conditions are not met, an undefined ID is returned.

Definition at line 401 of file UN_Include.h.

UN_DataSize UN_DataIDRemap::size ( void  ) const
inline

Returns the number of IDs reserved by this merge map.

Definition at line 363 of file UN_Include.h.


The documentation for this class was generated from the following file: