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