]>
git.saurik.com Git - apple/xnu.git/blob - libkern/libkern/c++/OSSet.h 
   2   * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.    4   * @APPLE_LICENSE_HEADER_START@    6   * The contents of this file constitute Original Code as defined in and    7   * are subject to the Apple Public Source License Version 1.1 (the    8   * "License").  You may not use this file except in compliance with the    9   * License.  Please obtain a copy of the License at   10   * http://www.apple.com/publicsource and read it before using this file.   12   * This Original Code and all software distributed under the License are   13   * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER   14   * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,   15   * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,   16   * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the   17   * License for the specific language governing rights and limitations   20   * @APPLE_LICENSE_HEADER_END@   22  /* IOSet.h created by rsulack on Thu 11-Jun-1998 */   23  /* IOSet.h converted to C++ by gvdl on Fri 1998-10-30 */   28  #include <libkern/c++/OSCollection.h>   34      @abstract A collection class for storing OSMetaClassBase derived objects.   36      Instances of OSSet store unique OSMetaClassBase derived objects in a non-ordered manner.   38  class  OSSet 
:  public  OSCollection
  40      OSDeclareDefaultStructors ( OSSet
)   47       * OSCollectionIterator interfaces.   49      virtual  unsigned int  iteratorSize ()  const ;   50      virtual  bool  initIterator ( void  * iterator
)  const ;   51      virtual  bool  getNextObjectForIterator ( void  * iterator
,  OSObject 
** ret
)  const ;   53      struct  ExpansionData 
{ };   56          Reserved for future use.  (Internal use only)  */   57      ExpansionData 
* reserved
;   61          @function withCapacity   62          @abstract A static constructor function to create and initialize an instance of OSSet with a given capacity.   63          @param capacity The initial capacity of the collection. The capacity is the total number of objects that can be stored in the collection.   64          @result Returns an instance of OSSet or 0 on failure.   66      static  OSSet 
* withCapacity ( unsigned int  capacity
);   69          @abstract A static constructor function to create and initialize an instance of OSSet and populate it with the objects provided.   70          @param objects A static array of OSMetaClassBase derived objects which are used to populate the collection.   71          @param count The number of objects passed to the collection.   72          @param capacity The initial storage size of the collection.  The capacity is the total number of objects that can be stored in the collection.  This value must be equal to or larger than the count parameter.   73          @result Returns an instance of OSSet or 0 on failure.   75      static  OSSet 
* withObjects ( const  OSObject 
* objects
[],   77                                   unsigned int  capacity 
=  0 );   80          @abstract A static constructor function to create and initialize an instance of OSSet and populate it with the objects from an OSSArray object.   81          @param array An OSArray object containing a list of OSMetaClassBase derived objects which are used to initially populate the OSSet object.   82          @param capacity The initial storage size of the collection.  This value must be equal to or larger than the number of objects provided by the OSArray object passed as the first parameter.   83          @result Returns an instance of OSSet or 0 on failure.   85      static  OSSet 
* withArray ( const  OSArray 
* array
,   86                              unsigned int  capacity 
=  0 );   89          @abstract A static constructor function to create an instance of OSSet and populate it with the objects from another OSSet object.   90          @param array An OSSet object containing OSMetaClassBase derived objects which are used to initially populate the new OSSet object.   91          @param capacity The initial storage size of the collection.  This value must be equal to or larger than the number of objects provided by the OSSet object passed as the first parameter.   92          @result Returns an instance of OSSet or 0 on failure.   94      static  OSSet 
* withSet ( const  OSSet 
* set
,   95                            unsigned int  capacity 
=  0 );   98          @function initWithCapacity   99          @abstract A member function to initialize an instance of OSSet with a given capacity.  100          @param capacity The initial storage size of the collection.  101          @result Returns true if initialization successful or false on failure.  103      virtual  bool  initWithCapacity ( unsigned int  capacity
);  105          @function initWithObjects  106          @abstract A member function to initialize an instance of OSSet with a given capacity and populate the collection with the objects provided.  107          @param object A static array containing OSMetaClassBase derived objects used to populate the collection.  108          @param count The number of objects provided.  109       @param capacity The initial storage size of the collection. This value must be equal to or larger than the 'count' parameter.  110          @result Returns true if initialization successful or false on failure.  112      virtual  bool  initWithObjects ( const  OSObject 
* objects
[],  114                                   unsigned int  capacity 
=  0 );  116          @function initWithArray  117          @abstract A member function to initialize a new instance of OSSet and populate it with the contents of the OSArray object provided.  118          @param array The OSArray object containing OSMetaClassBase derived objects used to populate the new OSSet object.  119          @param capacity The initial storage capacity of the object.  This value must be equal to or larger than the number of objects provided by the OSArray object passed as the first parameter.  120          @result Returns true if initialization successful or false on failure.  122      virtual  bool  initWithArray ( const  OSArray 
* array
,  123                                 unsigned int  capacity 
=  0 );  125          @function initWithSet  126          @abstract A member function to initialize a new instance of OSSet and populate it with the contents of the OSSet object provided.  127          @param array The OSSet object containing OSMetaClassBase derived objects used to populate the new OSSet object.  128          @param capacity The initial storage capacity of the object.  This value must be equal to or larger than the number of objects provided by the OSSet object passed as the first parameter.  129          @result Returns true if initialization successful or false on failure.  130          @discussion This function should not be called directly, use release() instead.  132      virtual  bool  initWithSet ( const  OSSet 
* set
,  133                               unsigned int  capacity 
=  0 );  136          @abstract A member function to release all resources created or used by the OSArray instance.  142          @abstract A member function which returns the number of objects current in the collection.  143          @result Returns the number of objects in the collection.  145      virtual  unsigned int  getCount ()  const ;  147          @function getCapacity  148          @abstract A member function which returns the storage capacity of the collection.  149          @result Returns the storage size of the collection.  151      virtual  unsigned int  getCapacity ()  const ;  153          @function getCapacityIncrement  154          @abstract A member function which returns the growth factor of the collection.  155          @result Returns the size by which the collection will grow.  157      virtual  unsigned int  getCapacityIncrement ()  const ;  159          @function setCapacityIncrement  160          @abstract A member function which sets the growth factor of the collection.  161          @result Returns the new increment.  163      virtual  unsigned int  setCapacityIncrement ( unsigned  increment
);  166          @function ensureCapacity  167          @abstract A member function to grow the size of the collection.  168          @param newCapacity The new capacity for the collection to expand to.  169          @result Returns the new capacity of the collection or the previous capacity upon error.  171      virtual  unsigned int  ensureCapacity ( unsigned int  newCapacity
);  174          @function flushCollection  175          @abstract A member function which removes and releases all objects within the collection.  177      virtual  void  flushCollection ();  181          @abstract A member function to place objects into the collection.  182          @param anObject The OSMetaClassBase derived object to be placed into the collection.  183          @result Returns true if the object was successfully placed into the collection, false otherwise.  184          @discussion The object added to the collection is automatically retained.  186      virtual  bool  setObject ( const  OSMetaClassBase 
* anObject
);  189          @abstract A member function to merge the contents of an OSArray object with set.  190          @param array The OSArray object which contains the objects to be merged.  191          @result Returns true if the contents of the OSArray were successfully merged into the receiver.  193      virtual  bool  merge ( const  OSArray 
* array
);  196          @abstract A member function to merge the contents of an OSSet object with receiver.  197          @param set The OSSet object which contains the objects to be merged.  198          @result Returns true if the contents of the OSSet were successfully merged into the receiver.  200      virtual  bool  merge ( const  OSSet 
* set
);  203          @function removeObject  204          @abstract A member function to remove objects from the collection.  205          @param anObject The OSMetaClassBase derived object to be removed from the collection.  206          @discussion The object removed from the collection is automatically released.  208      virtual  void  removeObject ( const  OSMetaClassBase 
*  anObject
);  211          @function containsObject  212          @abstract A member function to query the collection for the presence of an object.  213          @param anObject The OSMetaClassBase derived object to be queried for in the collecion.  214          @result Returns true if the object is present within the set, false otherwise.  216      virtual  bool  containsObject ( const  OSMetaClassBase 
* anObject
)  const ;  219          @abstract A member function to query the collection for the presence of an object.  220          @param anObject The OSMetaClassBase derived object to be queried for in the collecion.  221          @result Returns true if the object is present within the set, false otherwise.  223      virtual  bool  member ( const  OSMetaClassBase 
* anObject
)  const ;  225          @function getAnyObject  226          @abstract A member function which returns an object from the set.  227          @result Returns an object if one exists within the set.  229      virtual  OSObject 
* getAnyObject ()  const ;  233          @abstract A member function to test the equality between the receiver and an OSSet object.  234          @param aSet An OSSet object to be compared against the receiver.  235          @result Returns true if the objects are equivalent.  237      virtual  bool  isEqualTo ( const  OSSet 
* aSet
)  const ;  240          @abstract A member function to test the equality between the receiver and an unknown object.  241          @param anObject An object to be compared against the receiver.  242          @result Returns true if the objects are equal.  244      virtual  bool  isEqualTo ( const  OSMetaClassBase 
* anObject
)  const ;  248          @abstract A member function which archives the receiver.  249          @param s The OSSerialize object.  250          @result Returns true if serialization was successful, false if not.  252      virtual  bool  serialize ( OSSerialize 
* s
)  const ;  255      OSMetaClassDeclareReservedUnused ( OSSet
,  0 );  256      OSMetaClassDeclareReservedUnused ( OSSet
,  1 );  257      OSMetaClassDeclareReservedUnused ( OSSet
,  2 );  258      OSMetaClassDeclareReservedUnused ( OSSet
,  3 );  259      OSMetaClassDeclareReservedUnused ( OSSet
,  4 );  260      OSMetaClassDeclareReservedUnused ( OSSet
,  5 );  261      OSMetaClassDeclareReservedUnused ( OSSet
,  6 );  262      OSMetaClassDeclareReservedUnused ( OSSet
,  7 );  265  #endif  /* !_OS_OSSET_H */