Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/include/IOKit/firewire/IOFWUserObjectExporter.h

1/*
2 * Copyright (c) 1998-2008 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23/*! @class IOFWUserObjectExporter
24@discussion An IOFWUserObjectExporter is for internal use only. You should never subclass IOFWUserObjectExporter
25*/
26
27namespace IOFireWireLib
28{
29typedef UInt32 UserObjectHandle;
30}
31
32#ifdef KERNEL
33
34class IOFWUserObjectExporter : public OSObject
35{
36OSDeclareDefaultStructors (IOFWUserObjectExporter )
37
38public :
39
40typedef void (*CleanupFunction)( const OSObject * obj );
41typedef void (*CleanupFunctionWithExporter)( const OSObject * obj, IOFWUserObjectExporter * );
42
43private :
44
45unsignedfCapacity;
46unsignedfObjectCount;
47const OSObject **fObjects;
48CleanupFunctionWithExporter *fCleanupFunctions;
49IOLock *fLock;
50OSObject *fOwner;
51
52public :
53
54static IOFWUserObjectExporter *createWithOwner( OSObject * owner );
55boolinitWithOwner( OSObject * owner );
56
57virtual boolinit();
58
59virtual voidfree ();
60virtual boolserialize ( OSSerialize * s ) const;
61
62// me
63IOReturnaddObject ( OSObject * obj, CleanupFunction cleanup, IOFireWireLib::UserObjectHandle * outHandle );
64voidremoveObject ( IOFireWireLib::UserObjectHandle handle );
65
66// the returned object is retained! This is for thread safety.. if someone else released
67// the object from the pool after you got it, you be in for Trouble
68// Release the returned value when you're done!!
69const OSObject *lookupObject ( IOFireWireLib::UserObjectHandle handle ) const;
70const OSObject *lookupObjectForType( IOFireWireLib::UserObjectHandle handle, const OSMetaClass * toType ) const;
71voidremoveAllObjects ();
72
73voidlock () const;
74voidunlock () const;
75
76OSObject *getOwner() const;
77
78const IOFireWireLib::UserObjectHandlelookupHandle ( OSObject * object ) const;
79
80// don't subclass, but just in case someone does...
81
82private:
83
84OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 0);
85OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 1);
86OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 2);
87OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 3);
88OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 4);
89OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 5);
90OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 6);
91OSMetaClassDeclareReservedUnused(IOFWUserObjectExporter, 7);
92
93};
94
95#endif
96

Archive Download this file

Revision: 1622