sipxportlib  Version 3.3
UtlList.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 #ifndef _UtlList_h_
12 #define _UtlList_h_
13 
14 //#define GLIST_SANITY_TEST
15 #ifdef LIST_SANITY_TEST
16 # include "assert.h"
17 #endif
18 
19 // SYSTEM INCLUDES
20 // APPLICATION INCLUDES
21 #include "utl/UtlDefs.h"
22 #include "utl/UtlLink.h"
23 #include "utl/UtlContainer.h"
24 
25 // DEFINES
26 // MACROS
27 // EXTERNAL FUNCTIONS
28 // EXTERNAL VARIABLES
29 // CONSTANTS
30 // STRUCTS
31 // TYPEDEFS
32 // FORWARD DECLARATIONS
33 class UtlContainable ;
34 
59 class UtlList : public UtlContainer, public UtlChain
60 {
61 /* //////////////////////////// PUBLIC //////////////////////////////////// */
62 public:
65 /* ============================ CREATORS ================================== */
66 
67 // this base class cannot be instantiated directly - the constructor is protected
68 
69 // Destructor
70  virtual ~UtlList();
71 
72 /* ============================ MANIPULATORS ============================== */
73 
79  UtlContainable* get() ;
80 
88 
92  virtual UtlContainable* remove(const UtlContainable* object) = 0;
93 
99  UtlContainable* removeAt(const size_t N);
100 
106 
110  void destroyAll();
111 
115  void removeAll();
116 
120  void rehash();
121 
122 /* ============================ ACCESSORS ================================= */
123 
128  virtual UtlContainable* find(const UtlContainable*) const = 0;
129 
133  virtual UtlContainable* at(size_t N) const;
134 
138  virtual UtlContainable* first() const ;
139 
143  virtual UtlContainable* last() const ;
144 
145 /* ============================ INQUIRY =================================== */
146 
150  virtual size_t entries() const;
151 
155  virtual UtlBoolean isEmpty() const;
156 
162  virtual UtlBoolean contains(const UtlContainable* object) const;
163 
167  virtual UtlBoolean containsReference(const UtlContainable *) const ;
168 
172  virtual size_t occurrencesOf(const UtlContainable* obj) const = 0;
173 
178  virtual size_t index(const UtlContainable* obj) const = 0;
179 
180 
184  virtual UtlContainableType getContainableType() const;
185 
186 /* //////////////////////////// PROTECTED ///////////////////////////////// */
187 protected:
188 
189 
193  UtlList();
194 
195  friend class UtlListIterator;
196 
200  void notifyIteratorsOfRemove(UtlLink* element);
201 
212  virtual void removeLink(UtlLink* toBeRemoved);
213 
214 #ifdef LIST_SANITY_TEST
215 # define LIST_SANITY_CHECK { if (!sanityCheck()){ assert(FALSE); } }
216  bool sanityCheck() const;
217 #else
218 # define LIST_SANITY_CHECK /* sanityCheck() */
219 #endif
220 
221 /* //////////////////////////// PRIVATE /////////////////////////////////// */
222 private:
223 } ;
224 
225 /* ============================ INLINE METHODS ============================ */
226 
227 #endif // _UtlList_h_
228 
229 
virtual UtlContainable * first() const
Definition: UtlList.cpp:218
virtual UtlBoolean contains(const UtlContainable *object) const
Definition: UtlList.cpp:276
virtual UtlContainableType getContainableType() const
Definition: UtlList.cpp:304
static UtlContainableType TYPE
Definition: UtlList.h:63
virtual void removeLink(UtlLink *toBeRemoved)
Definition: UtlList.cpp:109
virtual size_t entries() const
Definition: UtlList.cpp:255
virtual UtlContainable * at(size_t N) const
Definition: UtlList.cpp:240
Definition: UtlList.h:59
UtlContainable * removeReference(const UtlContainable *obj)
Definition: UtlList.cpp:80
const char *const UtlContainableType
Definition: UtlDefs.h:70
Definition: UtlListIterator.h:37
void destroyAll()
Definition: UtlList.cpp:147
virtual UtlContainable * last() const
Definition: UtlList.cpp:229
Definition: UtlLink.h:49
Definition: UtlContainable.h:37
virtual ~UtlList()
Definition: UtlList.cpp:36
virtual UtlBoolean isEmpty() const
Definition: UtlList.cpp:269
virtual size_t occurrencesOf(const UtlContainable *obj) const =0
virtual UtlBoolean destroy(UtlContainable *)
Definition: UtlList.cpp:127
virtual size_t index(const UtlContainable *obj) const =0
void rehash()
Definition: UtlList.cpp:204
virtual UtlContainable * find(const UtlContainable *) const =0
void notifyIteratorsOfRemove(UtlLink *element)
int UtlBoolean
Definition: UtlDefs.h:41
virtual UtlBoolean containsReference(const UtlContainable *) const
Definition: UtlList.cpp:283
Definition: UtlContainer.h:38
UtlList()
Definition: UtlList.cpp:30
void removeAll()
Definition: UtlList.cpp:189
UtlContainable * removeAt(const size_t N)
Definition: UtlList.cpp:167