1 // File: NIS_ObjectsIterator.hxx
2 // Created: 02.09.07 23:47
3 // Author: Alexander GRIGORIEV
4 // Copyright: Open Cascade 2007
7 #ifndef NIS_ObjectsIterator_HeaderFile
8 #define NIS_ObjectsIterator_HeaderFile
10 #include <NCollection_Vector.hxx>
11 #include <Handle_NIS_InteractiveObject.hxx>
13 class Handle_NIS_InteractiveContext;
16 * Iterator of objects contained in a NIS_InteractiveContext instance. The
17 * iteration is always in the ascending sense of object ID. Examples:
19 * // Erase all objects in the Context
20 * NIS_ObjectsIterator anIter (myContext);
21 * for (; anIter.More(); anIter.Next())
22 * myContext->Erase (anIter.Value(), Standard_False);
24 * // Set object attributes to their IDs (hardly useful outside the example)
25 * anIter.Initialize (myContext);
26 * Handle(NIS_InteractiveObject) anObj;
27 * while (!(anObj = anIter.Value().IsNull())) {
28 * anObj->SetAttribute (static_cast<void *> (anObj->ID()));
34 class NIS_ObjectsIterator
37 // ---------- PUBLIC METHODS ----------
43 inline NIS_ObjectsIterator () {}
48 * Interactive context that is to be iterated for all objects.
50 inline NIS_ObjectsIterator (const Handle_NIS_InteractiveContext& theCtx)
51 { Initialize (theCtx); }
54 * Reset the Iterator to start the iterations of objects.
56 * Interactive context that is to be iterated for all objects.
58 Standard_EXPORT void Initialize
59 (const Handle_NIS_InteractiveContext& theCtx);
62 * Query if the Iterator has an object (not yet finished the iteration
65 inline Standard_Boolean More () const
66 { return myIter.More(); }
69 * Returns the current object at the iteration pointer. If the iteration is
70 * over (More() == False) this method returns NULL Handle.
72 Standard_EXPORT const Handle_NIS_InteractiveObject&
76 * Step forward to the next valid InteractiveObject instance.
78 Standard_EXPORT void Next ();
81 // ---------- PROTECTED FIELDS ----------
83 NCollection_Vector <Handle_NIS_InteractiveObject>::Iterator myIter;