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))
{
}
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))
{
}
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);
}
}