sipxportlib
Version 3.3
|
#include <UtlIterator.h>
Public Member Functions | |
UtlIterator (const UtlContainer &container) | |
virtual | ~UtlIterator ()=0 |
virtual UtlContainable * | operator() ()=0 |
Return the next element. More... | |
virtual void | reset ()=0 |
Reset the iterator cursor so that it will again return all elements in the container. More... | |
Protected Member Functions | |
void | addToContainer (const UtlContainer *container) |
virtual void | invalidate () |
Protected Attributes | |
OsBSem | mContainerRefLock |
UtlContainer * | mpMyContainer |
Friends | |
class | UtlContainer |
UltIterator defines an abstract Iterator for walking through the elements of UtlContainer derived class.
Example Code:
// Create an iterator that walks through the elements of myContentSource. FooIterator itor(myContentSource); MyObject* pObj; // Fetch a pointer to each element of myContentSource into pObj. while ((pObj = itor())) { // Do something to *pObj. } // Reset itor to its initial state, so itor() starts walking through the // elements of myContentSource all over again. itor.reset(); while ((pObj = itor())) { // Do something else to *pObj. }
(The extra parentheses in the while clauses are to mark that that operation is an assignment, not a comparison.)
UtlIterator | ( | const UtlContainer & | container | ) |
|
pure virtual |
Destructor
|
pure virtual |
Return the next element.
Implemented in UtlHashBagIterator, UtlHashMapIterator, and UtlListIterator.
|
pure virtual |
Reset the iterator cursor so that it will again return all elements in the container.
Implemented in UtlHashBagIterator, UtlHashMapIterator, and UtlListIterator.
|
protected |
|
protectedvirtual |
invalidate is called by the UtlContainer from its destructor. It disconnects the iterator from its container object (sets mpContainerRef to NULL). Any subsequent invocation of this iterator (other than its destructor) must return an error.
:NOTE: Both the sIiteratorListLock and the container lock must be held by the caller.
invalidate is called by the UtlContainer from its destructor. It disconnects the iterator from its container object (sets mpMyContainer to NULL).
Any subsequent invocation of this iterator (other than its destructor) must not attempt to access *mpMyContainer.
|
friend |
|
protected |
The mContainerRefLock must be held whenever the mpMyContainer value is being used or modified. If the mpIteratorListLock in the container is also held, then the mpIteratorListLock must be taken first.
|
protected |