]> git.saurik.com Git - apple/xnu.git/blobdiff - iokit/IOKit/IORegistryEntry.h
xnu-344.21.74.tar.gz
[apple/xnu.git] / iokit / IOKit / IORegistryEntry.h
index c1a067fc227aa03a39991c4207fd28f7f9479343..daa978ddffce446ee82cc649705ffbb1f2f29e09 100644 (file)
@@ -3,19 +3,22 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this
+ * file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
@@ -56,7 +59,7 @@ enum {
 
 class IORegistryEntry : public OSObject
 {
-    friend IORegistryIterator;
+    friend class IORegistryIterator;
 
     OSDeclareDefaultStructors(IORegistryEntry)
 
@@ -75,12 +78,74 @@ private:
     OSDictionary *     fRegistryTable;
     OSDictionary *     fPropertyTable;
 
+public:
+    /* methods available in Mac OS X 10.1 or later */
+
+/*! @function copyProperty
+    @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. Available in Mac OS X 10.1 or later.
+    @discussion This method will search for a property, starting first with this registry entry's property table, then iterating recusively through either the parent registry entries or the child registry entries of this entry. Once the first occurrence is found, it will lookup and return the value of the property, using the OSDictionary::getObject semantics. The iteration keeps track of entries that have been recursed into previously to avoid loops. This method is synchronized with other IORegistryEntry accesses to the property table(s).
+    @param aKey The property's name as a C-string.
+    @param plane The plane to iterate over, eg. gIOServicePlane.
+    @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
+    @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */
+
+    virtual OSObject * copyProperty( const char *           aKey,
+                                     const IORegistryPlane * plane,
+                                     IOOptionBits            options =
+                                        kIORegistryIterateRecursively |
+                                        kIORegistryIterateParents) const;
+/*! @function copyProperty
+    @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. Available in Mac OS X 10.1 or later.
+    @discussion This method will search for a property, starting first with this registry entry's property table, then iterating recusively through either the parent registry entries or the child registry entries of this entry. Once the first occurrence is found, it will lookup and return the value of the property, using the OSDictionary::getObject semantics. The iteration keeps track of entries that have been recursed into previously to avoid loops. This method is synchronized with other IORegistryEntry accesses to the property table(s).
+    @param aKey The property's name as an OSString.
+    @param plane The plane to iterate over, eg. gIOServicePlane.
+    @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
+    @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */
+
+    virtual OSObject * copyProperty( const OSString *        aKey,
+                                     const IORegistryPlane * plane,
+                                     IOOptionBits            options =
+                                        kIORegistryIterateRecursively |
+                                        kIORegistryIterateParents) const;
+
+/*! @function copyProperty
+    @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. Available in Mac OS X 10.1 or later.
+    @discussion This method will search for a property, starting first with this registry entry's property table, then iterating recusively through either the parent registry entries or the child registry entries of this entry. Once the first occurrence is found, it will lookup and return the value of the property, using the OSDictionary::getObject semantics. The iteration keeps track of entries that have been recursed into previously to avoid loops. This method is synchronized with other IORegistryEntry accesses to the property table(s).
+    @param aKey The property's name as an OSSymbol.
+    @param plane The plane to iterate over, eg. gIOServicePlane.
+    @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
+    @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */
+
+    virtual OSObject * copyProperty( const OSSymbol *        aKey,
+                                     const IORegistryPlane * plane,
+                                     IOOptionBits            options =
+                                        kIORegistryIterateRecursively |
+                                        kIORegistryIterateParents) const;
+
+/*! @function copyParentEntry
+    @abstract Returns an registry entry's first parent entry in a plane. Available in Mac OS X 10.1 or later.
+    @discussion This function will return the parent to which a registry entry was first attached. Since the majority of registry entrys have only one provider, this is a useful simplification.
+    @param plane The plane object.
+    @result Returns the first parent of the registry entry, or zero if the entry is not attached into the registry in that plane. A reference on the entry is returned to caller, which should be released. */
+
+    virtual IORegistryEntry * copyParentEntry( const IORegistryPlane * plane ) const;
+
+/*! @function copyChildEntry
+    @abstract Returns an registry entry's first child entry in a plane. Available in Mac OS X 10.1 or later.
+    @discussion This function will return the child which first attached to a registry entry.
+    @param plane The plane object.
+    @result Returns the first child of the registry entry, or zero if the entry is not attached into the registry in that plane. A reference on the entry is returned to caller, which should be released. */
+
+    virtual IORegistryEntry * copyChildEntry( const IORegistryPlane * plane ) const;
+
 private:
-    OSMetaClassDeclareReservedUnused(IORegistryEntry, 0);
-    OSMetaClassDeclareReservedUnused(IORegistryEntry, 1);
-    OSMetaClassDeclareReservedUnused(IORegistryEntry, 2);
-    OSMetaClassDeclareReservedUnused(IORegistryEntry, 3);
-    OSMetaClassDeclareReservedUnused(IORegistryEntry, 4);
+
+    OSMetaClassDeclareReservedUsed(IORegistryEntry, 0);
+    OSMetaClassDeclareReservedUsed(IORegistryEntry, 1);
+    OSMetaClassDeclareReservedUsed(IORegistryEntry, 2);
+    OSMetaClassDeclareReservedUsed(IORegistryEntry, 3);
+    OSMetaClassDeclareReservedUsed(IORegistryEntry, 4);
+
     OSMetaClassDeclareReservedUnused(IORegistryEntry, 5);
     OSMetaClassDeclareReservedUnused(IORegistryEntry, 6);
     OSMetaClassDeclareReservedUnused(IORegistryEntry, 7);
@@ -362,8 +427,8 @@ public:
     @discussion This method will return a pointer to the live property table as an OSDictionery. Its use is not recommended in most cases, instead use the synchronized accessors and helper functions of IORegistryEntry to access properties. It can only safely be used by one thread, which usually means it can only be used before a registry entry is entered into the registry.
     @result A pointer to the property table as an OSDictionary. The pointer is valid while the registry entry is retained, and should not be released by the caller. */
 
-    inline OSDictionary * getPropertyTable( void ) const
-                       { return(fPropertyTable); }
+    /* inline */ OSDictionary * getPropertyTable( void ) const;
+            /* { return(fPropertyTable); } */
 
     /* Set properties from user level, to be overridden if supported */
 
@@ -394,8 +459,7 @@ public:
     @param plane The plane object.
     @result Returns the first parent of the registry entry, or zero if the entry is not attached into the registry in that plane. The parent is retained while the entry is attached, and should not be released by the caller. */
 
-    virtual IORegistryEntry * getParentEntry( const IORegistryPlane * plane )
-                                                                       const;
+    virtual IORegistryEntry * getParentEntry( const IORegistryPlane * plane ) const;
 
 /*! @function getChildIterator
     @abstract Returns an iterator over an registry entry's child entries in a plane.
@@ -416,8 +480,7 @@ public:
     @param plane The plane object.
     @result Returns the first child of the registry entry, or zero if the entry is not attached into the registry in that plane. The child is retained while the entry is attached, and should not be released by the caller. */
 
-    virtual IORegistryEntry * getChildEntry( const IORegistryPlane * plane )
-                                                                       const;
+    virtual IORegistryEntry * getChildEntry( const IORegistryPlane * plane ) const;
 
 /*! @function isChild
     @abstract Determines whether a registry entry is the child of another in a plane.