sipxportlib  Version 3.3
UtlIterator.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _UtlIterator_h_
13 #define _UtlIterator_h_
14 
15 // SYSTEM INCLUDES
16 // APPLICATION INCLUDES
17 #include "utl/UtlDefs.h"
18 #include "os/OsBSem.h"
19 
20 // DEFINES
21 // MACROS
22 // EXTERNAL FUNCTIONS
23 // EXTERNAL VARIABLES
24 // CONSTANTS
25 // STRUCTS
26 // TYPEDEFS
27 // FORWARD DECLARATIONS
28 class UtlContainable ;
29 class UtlContainer;
30 
58 {
59 /* //////////////////////////// PUBLIC //////////////////////////////////// */
60 public:
61 
62 /* ============================ CREATORS ================================== */
63 
64  UtlIterator(const UtlContainer& container);
65 
69  virtual ~UtlIterator() = 0;
70 
71 /* ============================ MANIPULATORS ============================== */
72 
73 
75  virtual UtlContainable* operator()() = 0 ;
76 
78  virtual void reset() = 0 ;
79 
80 /* ============================ ACCESSORS ================================= */
81 
82 /* ============================ INQUIRY =================================== */
83 
84 /* //////////////////////////// PROTECTED ///////////////////////////////// */
85 protected:
86  friend class UtlContainer;
87 
88  /******************************************************************
89  * @par Removing Method - Variable Signature.
90  *
91  * All iterators must have a 'removing' method so that they can be notified
92  * by the container when an element is removed.
93  *
94  * There is no prototype for it here because the signature differs depending
95  * on the container type.
96  *
97  * removing is called by the UtlContainer when an element is about to be
98  * removed from the container. The iterator must ensure that the removed
99  * element is not returned by any subsequent call.
100  * if element != NULL, it points to the element to be removed.
101  * if element == NULL, means all elements to be removed.
102  */
103  // virtual void removing( ... type depends on the class of the iterator... ) = 0;
104 
105 
106  void addToContainer(const UtlContainer* container);
107 
117  virtual void invalidate();
118 
126 
127 /* //////////////////////////// PRIVATE /////////////////////////////////// */
128 private:
132  UtlIterator(const UtlIterator& noCopyAllowed);
133 
137  UtlIterator& operator=(const UtlIterator& noCopyAllowed);
138 
139 } ;
140 
141 /* ============================ INLINE METHODS ============================ */
142 
143 #endif // _UtlIterator_h_
144 
UtlIterator(const UtlContainer &container)
Definition: UtlIterator.cpp:33
void addToContainer(const UtlContainer *container)
Definition: UtlIterator.cpp:70
UtlContainer * mpMyContainer
Definition: UtlIterator.h:125
virtual void reset()=0
Reset the iterator cursor so that it will again return all elements in the container.
Definition: UtlIterator.h:57
Definition: UtlContainable.h:37
virtual ~UtlIterator()=0
Definition: UtlIterator.cpp:44
OsBSem mContainerRefLock
Definition: UtlIterator.h:124
virtual void invalidate()
Definition: UtlIterator.cpp:84
Definition: UtlContainer.h:38
virtual UtlContainable * operator()()=0
Return the next element.