Public Member Functions

DependentIterator Class Reference

This reference page is linked to from the following overview topics: Plug-in Upgrade Guide, Reference Hierarchy Functions.


Search for all occurrences

Detailed Description

Iterates through all direct dependents of a given ReferenceTarget.

Client code can simply instantiate an object of this type with the ReferenceTarget instance whose direct dependents need to be iterated on. Calling method DependentIterator::Next() will return the next ReferenceMaker that depends on the given ReferenceTarget. For instance, you can count the number of ReferenceMakers that depend on a ReferenceTarget using the following code:

    int CountRefs(ReferenceTarget *rt) {
        DependentIterator di(rt);
        int nrefs = 0;
        ReferenceMaker* rm = NULL;
        while (NULL!=(rm=di.Next())) {
            nrefs++;
        }
        return nrefs;   
    }

All methods of this class are implemented by the system.

Note:
Adding or deleting dependents to the ReferenceTarget after the DependentIterator instance has been created can invalidate the iterator and lead to undefined behaviour.

#include <ref.h>

Inheritance diagram for DependentIterator:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  DependentIterator (ReferenceTarget *rtarg)
  Constructor.
CoreExport  ~DependentIterator ()
  Destructor.
CoreExport ReferenceMaker Next ()
  Returns a pointer to the next ReferenceMaker or NULL when there are no more.
CoreExport void  Reset ()
  Resets the iterator object so it starts at the beginning again with the original ReferenceTarget passed.

Constructor & Destructor Documentation

CoreExport DependentIterator ( ReferenceTarget rtarg )

Constructor.

Parameters:
rtarg - Points to the RefereceTarget whose dependents are iterated through.
CoreExport ~DependentIterator ( )

Destructor.


Member Function Documentation

CoreExport ReferenceMaker* Next ( )

Returns a pointer to the next ReferenceMaker or NULL when there are no more.

CoreExport void Reset ( )

Resets the iterator object so it starts at the beginning again with the original ReferenceTarget passed.


DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator
DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator DependentIterator