HierarchyObjectIterator< REFTYPE > Class Template Reference

#include <hierarchyobject.h>

Detailed Description

template<typename REFTYPE>
class maxon::HierarchyObjectIterator< REFTYPE >

Iterator Class to run through all the elements of a HierarchyObjectRef in a linear manner.

Example usage:

for (const HierarchyObjectRef& it : HierarchyObjectIterator<HierarchyObjectRef>(rootObject))
{
// do something with it here
}

Since the iterator is templated you can easily filter the hierarchy for certain types. In this example OSWindowRef is (amongst others) derived from HierarchyObjectRef. By passing the type <OSWindowRef> to the iterator you will get only these objects - no matter where they are located in the hierarchy.

for (const OSWindowRef& it : HierarchyObjectIterator<OSWindowRef>(rootObject))
{
// do something with it here
}

Please note that the HierarchyObjectIterator automatically gives you the correct typed object. This saves you from manually checking for the correct type and the do a (potential risky) cast to the target type like in this (not recommended) example.

for (const HierarchyObjectRef& it : HierarchyObjectIterator<HierarchyObjectRef>(rootObject))
{
if (it.IsInstanceOf<OSWindowRef>)
{
OSWindowRef window = Cast<OSWindowRef>(it);
// do something with window here
}
}

Public Member Functions

 HierarchyObjectIterator ()
 
 HierarchyObjectIterator (const HierarchyObjectIterator &src)
 
 HierarchyObjectIterator (HierarchyObjectIterator &&src)
 
 MAXON_OPERATOR_COPY_ASSIGNMENT (HierarchyObjectIterator)
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (HierarchyObjectIterator)
 
 HierarchyObjectIterator (const HierarchyObjectRef<> &first)
 
void operator++ ()
 
 operator Bool () const
 
REFTYPE & operator* ()
 
REFTYPE * operator-> ()
 

Private Attributes

REFTYPE _last
 
HierarchyObjectRef _parent
 

Constructor & Destructor Documentation

◆ HierarchyObjectIterator() [1/4]

◆ HierarchyObjectIterator() [2/4]

HierarchyObjectIterator ( const HierarchyObjectIterator< REFTYPE > &  src)

◆ HierarchyObjectIterator() [3/4]

◆ HierarchyObjectIterator() [4/4]

HierarchyObjectIterator ( const HierarchyObjectRef<> &  first)
explicit

Member Function Documentation

◆ MAXON_OPERATOR_COPY_ASSIGNMENT()

MAXON_OPERATOR_COPY_ASSIGNMENT ( HierarchyObjectIterator< REFTYPE >  )

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( HierarchyObjectIterator< REFTYPE >  )

◆ operator++()

void operator++ ( )

◆ operator Bool()

operator Bool ( ) const
explicit

◆ operator*()

REFTYPE& operator* ( )

◆ operator->()

REFTYPE* operator-> ( )

Member Data Documentation

◆ _last

REFTYPE _last
private

◆ _parent

HierarchyObjectRef _parent
private