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

std::aligned_storage< sizeof(maxon::BaseArray< DescLevel >), alignof(maxon::BaseArray< DescLevel >)>::type _private
 

Constructor/Destructor

 DescID ()
 
 DescID (const DescID &src)
 
 DescID (Int32 id1)
 
 DescID (const DescLevel &id1)
 
 DescID (const DescLevel &id1, const DescLevel &id2)
 
 DescID (const DescLevel &id1, const DescLevel &id2, const DescLevel &id3)
 
 ~DescID ()
 

Set/Push/Pop Level

void SetId (const DescLevel &subid)
 
void PushId (const DescLevel &subid)
 
void PopId ()
 

Operator

const DescLeveloperator[] (Int32 pos) const
 
const DescIDoperator= (const 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)
 

Miscellaneous

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

Constructor & Destructor Documentation

◆ DescID() [1/6]

DescID ( )

Default constructor.

◆ DescID() [2/6]

DescID ( const DescID src)

Copy constructor.

Parameters
[in]srcSource DescID.

◆ DescID() [3/6]

DescID ( Int32  id1)

Creates a description ID with one level.

Parameters
[in]id1First level.

◆ DescID() [4/6]

DescID ( const DescLevel id1)

Creates a description ID with one level.

Parameters
[in]id1First level.

◆ DescID() [5/6]

DescID ( const DescLevel id1,
const DescLevel id2 
)

Creates a description ID with two levels.

Parameters
[in]id1First level.
[in]id2Second level.

◆ DescID() [6/6]

DescID ( const DescLevel id1,
const DescLevel id2,
const DescLevel id3 
)

Creates an ID with three levels.

Parameters
[in]id1First level.
[in]id2Second level.
[in]id3Third level.

◆ ~DescID()

~DescID ( )

Default destructor.

Member Function Documentation

◆ SetId()

void SetId ( const DescLevel subid)

Sets the highest level to subid.

Parameters
[in]subidNew top level.

◆ PushId()

void PushId ( const DescLevel subid)

Pushes a new level onto the stack.

Parameters
[in]subidLevel 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=()

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==()

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)

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.

◆ 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

◆ _private

std::aligned_storage<sizeof(maxon::BaseArray<DescLevel>), alignof(maxon::BaseArray<DescLevel>)>::type _private
private