1 martin 1.10 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.11 //
|
3 martin 1.10 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.11 //
|
10 martin 1.10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.11 //
|
17 martin 1.10 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.11 //
|
20 martin 1.10 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.11 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.10 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.11 //
|
28 martin 1.10 //////////////////////////////////////////////////////////////////////////
|
29 tony 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_List_h
33 #define Pegasus_List_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Listener/Linkage.h>
37
38 PEGASUS_NAMESPACE_BEGIN
39
40 /**
41 * Iterator
42 */
43 class Iterator
44 {
45 public:
|
46 david.dillard 1.3 /**
47 * Destroys the object. This is needed so that an object of a
48 * subclass can be correctly destroyed thru an Iterator pointer.
49 */
|
50 a.arora 1.4 virtual ~Iterator() {};
|
51 david.dillard 1.3
|
52 karl 1.8 /**
|
53 tony 1.1 * Returns <tt>true</tt> if the iteration has more elements. (In other
54 * words, returns <tt>true</tt> if <tt>next</tt> would return an element
55 * rather than throwing an exception.)
56 *
57 * @return <tt>true</tt> if the iterator has more elements.
|
58 karl 1.8 */
59 virtual Boolean hasNext() = 0;
60
61 /**
62 * Returns the next element in the interation.
63 *
64 * @returns the next element in the interation.
65 * @exception NoSuchElementException iteration has no more elements.
66 */
67 virtual void* next() = 0;
68
69 /**
70 *
71 * Removes from the underlying collection the last element returned by the
72 * iterator (optional operation). This method can be called only once per
73 * call to <tt>next</tt>. The behavior of an iterator is unspecified if
74 * the underlying collection is modified while the iteration is in
75 * progress in any way other than by calling this method.
76 *
77 * @exception UnsupportedOperationException if the <tt>remove</tt>
78 * operation is not supported by this Iterator.
79 karl 1.8 */
80 virtual void remove() = 0;
|
81 tony 1.1 };
82
83 /**
84 * PtrList
85 */
86 class PtrList
87 {
88 public:
|
89 karl 1.8 /**
|
90 kumpf 1.9 Constructs a PtrList object.
|
91 karl 1.8 */
92 PtrList();
93 /**
|
94 kumpf 1.9 Destructor of a PtrList object.
|
95 karl 1.8 */
|
96 tony 1.1 ~PtrList();
97
|
98 karl 1.8 /**
|
99 kumpf 1.9 Adds an element into the list.
100 @param element The element pointer to add.
|
101 karl 1.8 */
102 void add(void* element);
103
104 /**
|
105 kumpf 1.9 Removes an element from the list
106 @param element The element pointer to remove.
|
107 karl 1.8 */
108 void remove(void* element);
|
109 tony 1.1
|
110 karl 1.8 /**
|
111 kumpf 1.9 Returns an iterator over the elements in this list in proper sequence.
112 @return an iterator over the elements in this list in proper sequence.
113 */
|
114 karl 1.8 Iterator* iterator();
|
115 tony 1.1
116 private:
|
117 karl 1.8 void* _rep;
|
118 tony 1.1 };
119
120 PEGASUS_NAMESPACE_END
121
122 #endif /* Pegasus_List_h */
123
|