DescID Class Reference

#include <lib_description.h>

Inheritance diagram for DescID:

Detailed Description

An ID class for description elements. Contains a stack of DescLevel objects.
A description ID is used to exactly identify a parameter value.

  • For first-level values (like a REAL (description element) or LONG (description element) value) it only consists of one DescLevel.
  • For more complex datatypes like VECTOR (description element) and GRADIENT (description element) it can consist of 2 or more levels.

Private Attributes

union {
   maxon::StrongCOWRef< Int >   _refData
 
   maxon::Block< const DescLevel >   _constData
 
}; 
 

Constructor/Destructor

 DescID ()
 
 DescID (const DescID &src)
 
 DescID (DescID &&src)
 
template<int elementCount>
constexpr DescID (maxon::IN_PLACE_TYPE v, const DescLevel(&ids)[elementCount])
 
 DescID (maxon::IN_PLACE_TYPE v, const maxon::Block< const DescLevel > &ids)
 
 ~DescID ()
 
template<typename... T>
static DescID Create (const T &... ids)
 

Set/Push/Pop Level

void SetId (const DescLevel &subid)
 
void PushId (const DescLevel &subid)
 
void PushId (const std::initializer_list< DescLevel > &subids)
 
void PopId ()
 

Operator

const DescLeveloperator[] (Int32 pos) const
 
const DescIDoperator= (const DescID &id)
 
const DescIDoperator= (DescID &&id)
 
Bool operator== (const DescID &d) const
 
Bool operator!= (const DescID &d) const
 
const DescID operator<< (Int32 shift) const
 
const DescIDoperator+= (const DescID &s)
 
const DescID operator+ (const DescID &v1, const DescID &v2)
 

Read/Write

Bool Read (HyperFile *hf)
 
Bool Write (HyperFile *hf) const
 

Miscellaneous

Int32 GetDepth () const
 
Bool IsPopulated () const
 
Bool IsEmpty () const
 
Bool IsPartOf (const DescID &cmp, Int32 *pos) const
 
maxon::HashInt GetHashCode () const
 

Additional Inherited Members

- Static Public Attributes inherited from CustomDataTypeT< TDATATYPEID >
static constexpr Int32 DATATYPEID
 

Constructor & Destructor Documentation

◆ DescID() [1/5]

DescID ( )

Default constructor.

◆ DescID() [2/5]

DescID ( const DescID src)

Copy constructor.

Parameters
[in]srcSource DescID.

◆ DescID() [3/5]

DescID ( DescID &&  src)

Move constructor.

Parameters
[in]srcSource DescID.

◆ DescID() [4/5]

constexpr DescID ( maxon::IN_PLACE_TYPE  v,
const DescLevel(&)  ids[elementCount] 
)
explicitconstexpr

Creates an ID with any number of levels. Must be used only with ConstDescID or memory which is never deleted.

Parameters
[in]idsarray with DescLevels.

◆ DescID() [5/5]

DescID ( maxon::IN_PLACE_TYPE  v,
const maxon::Block< const DescLevel > &  ids 
)
explicit

Creates an ID with any number of levels. Must be used only with ConstDescID or memory which is never deleted.

Parameters
[in]idsarray with DescLevels.

◆ ~DescID()

~DescID ( )

Default destructor.

Member Function Documentation

◆ Create()

static DescID Create ( const T &...  ids)
static

Creates an ID with any number of levels.

Parameters
[in]idsarray with DescLevels.

◆ SetId()

void SetId ( const DescLevel subid)

Sets the highest level to subid.

Parameters
[in]subidNew top level.

◆ PushId() [1/2]

void PushId ( const DescLevel subid)

Pushes a new level onto the stack.

Parameters
[in]subidLevel to push.

◆ PushId() [2/2]

void PushId ( const std::initializer_list< DescLevel > &  subids)

Pushes a new level onto the stack.

Parameters
[in]subidsLevels to push.

◆ PopId()

void PopId ( )

Pop the highest level from the stack.

◆ operator[]()

const DescLevel& operator[] ( Int32  pos) const

Accesses the level at position pos in the stack.

Parameters
[in]posThe position: 0 <= pos < GetDepth()
Returns
The level at the specified position.

◆ operator=() [1/2]

const DescID& operator= ( const DescID id)

Assignment operator. Assigns id to the description ID.

Parameters
[in]idRight operand. Source description ID.
Returns
Left operant.

◆ operator=() [2/2]

const DescID& operator= ( DescID &&  id)

Move Assignment operator. Assigns id to the description ID.

Parameters
[in]idRight operand. Source description ID.
Returns
Left operant.

◆ operator==()

Bool operator== ( const DescID d) const

Equality operator. Checks if all levels are equal.

Parameters
[in]dRight operand description ID.
Returns
true if description IDs are equal, otherwise false.

◆ operator!=()

Bool operator!= ( const DescID d) const

Inequality operator. Checks if any level is different.

Parameters
[in]dRight operand description ID.
Returns
true if description IDs are not equal, otherwise false.

◆ operator<<()

const DescID operator<< ( Int32  shift) const

Get the result of popping levels from the bottom of the stack.

Parameters
[in]shiftNumber of levels to pop. 0 <= shift < GetDepth().
Returns
Resulting description ID after popping level(s).

◆ operator+=()

const DescID& operator+= ( const DescID s)

Add operator. Merges two description IDs.

Parameters
[in]sRight operand. Source description ID.
Returns
Left operant.

◆ Read()

Bool Read ( HyperFile hf)

Reads the description ID from hf.

Parameters
[in]hfThe hyper file to read from. The caller owns the pointed hyper file.
Returns
true if successful, otherwise false.

◆ Write()

Bool Write ( HyperFile hf) const

Writes the description ID to hf.

Parameters
[in]hfThe hyper file to write to. The caller owns the pointed hyper file.
Returns
true if successful, otherwise false.

◆ GetDepth()

Int32 GetDepth ( ) const

Gets the depth of the stack, i.e. the number of levels.

Returns
The depth of the stack.

◆ IsPopulated()

Bool IsPopulated ( ) const

Returns True if Id is set to any value.

◆ IsEmpty()

Bool IsEmpty ( ) const

Returns True if Id is not set to any value.

◆ IsPartOf()

Bool IsPartOf ( const DescID cmp,
Int32 pos 
) const

Checks if the description ID is part of cmp and assigns the length of the match to pos.

Parameters
[in]cmpThe super description ID.
[out]posIf not nullptr this is assigned the length of the match.
Returns
true if the description ID matches the lowest part of cmp, otherwise false.

◆ GetHashCode()

maxon::HashInt GetHashCode ( ) const

Gets a hash code for the description ID.

Since
R17.032
Returns
The hash code.

Friends And Related Function Documentation

◆ operator+

const DescID operator+ ( const DescID v1,
const DescID v2 
)
friend

Add operator. Merges two description IDs.

Parameters
[in]v1Left operand.
[in]v2Right operand.
Returns
Result.

Member Data Documentation

◆ _refData

◆ _constData

maxon::Block<const DescLevel> _constData

◆ 

union { ... }