HierarchyObjectIterator< REFTYPE > Class Template Reference

#include <hierarchyobject.h>

Inheritance diagram for HierarchyObjectIterator< REFTYPE >:

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
 
const REFTYPE & operator* ()
 
const REFTYPE * operator-> ()
 
- Public Member Functions inherited from ForEachIterator< HierarchyObjectIterator< REFTYPE > >
MAXON_ATTRIBUTE_FORCE_INLINE ForEachIterator (ARGS &&... args)
 
String ToString (const FormatStatement *formatStatement=nullptr)
 
HierarchyObjectIterator< REFTYPE > & Find (const T &v)
 
Int FindIndex (const T &v)
 
MAXON_ATTRIBUTE_FORCE_INLINE Bool Contains (const T &v)
 
MAXON_ATTRIBUTE_FORCE_INLINE Wrapper begin ()
 

Private Attributes

HierarchyObjectInterface_last
 
HierarchyObjectRef _parent
 

Additional Inherited Members

- Public Types inherited from ForEachIterator< HierarchyObjectIterator< REFTYPE > >
using IsForEachIterator = std::true_type
 
- Static Public Member Functions inherited from ForEachIterator< HierarchyObjectIterator< REFTYPE > >
static MAXON_ATTRIBUTE_FORCE_INLINE PRIVATE_MAXON_RBF_SENTINEL (Wrapper) end()
 

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

const REFTYPE& operator* ( )

◆ operator->()

const REFTYPE* operator-> ( )

Member Data Documentation

◆ _last

HierarchyObjectInterface* _last
private

◆ _parent

HierarchyObjectRef _parent
private