]> git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSCollectionIterator.h
02699109ebf63df315705373b96ae3338c4eb6a4
[apple/xnu.git] / libkern / libkern / c++ / OSCollectionIterator.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /* IOCollectionIterator.h created by gvdl on Fri 1998-10-30 */
24
25 #ifndef _OS_OSCOLLECTIONITERATOR_H
26 #define _OS_OSCOLLECTIONITERATOR_H
27
28 #include <libkern/c++/OSIterator.h>
29
30 class OSCollection;
31
32 /*!
33 @class OSCollectionIterator
34 @discussion
35 OSCollectionIterator objects provide a consistent mechanism to iterate through all OSCollection derived collections.
36 */
37 class OSCollectionIterator : public OSIterator
38 {
39 OSDeclareDefaultStructors(OSCollectionIterator)
40
41 protected:
42 const OSCollection *collection;
43 void *collIterator;
44 unsigned int initialUpdateStamp;
45 bool valid;
46
47 public:
48 /*!
49 @function withCollection
50 @abstract A static constructor function which creates and initializes an instance of OSCollectionIterator for the provided collection object.
51 @param inColl The OSCollection derived collection object to be iteratated.
52 @result Returns a new instance of OSCollection or 0 on failure.
53 */
54 static OSCollectionIterator *withCollection(const OSCollection *inColl);
55
56 /*!
57 @function withCollection
58 @abstract A member function to initialize the intance of OSCollectionIterator with the provided colleciton object.
59 @param inColl The OSCollection derived collection object to be iteratated.
60 @result Returns true if the initialization was successful or false on failure.
61 */
62 virtual bool initWithCollection(const OSCollection *inColl);
63 /*!
64 @function free
65 @abstract A member function to release and deallocate all resources created or used by the OSCollectionIterator object.
66 @discussion This function should not be called directly, use release() instead.
67 */
68 virtual void free();
69
70 /*!
71 @function reset
72 @abstract A member function which resets the iterator to begin the next iteration from the beginning of the collection.
73 */
74 virtual void reset();
75
76 /*!
77 @function isValid
78 @abstract A member function for determining if the collection was modified during iteration.
79 */
80 virtual bool isValid();
81
82 /*!
83 @function getNextObject
84 @abstract A member function to get the next object in the collection being iterated.
85 @result Returns the next object in the collection or 0 when the end has been reached.
86 */
87 virtual OSObject *getNextObject();
88 };
89
90 #endif /* !_OS_OSCOLLECTIONITERATOR_H */