Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: helper class instance creation



Thanks Godfrey.
 
My helper classes are not used for driver matching and stuff like that.
I already have things in place for driver.
I am going to add support for another hardware, and it has very little difference.
so my single driver class can will handle it.
 
There is very few card-hardware specific stuff, so I have now one abstract class and 2 diff class for each one. These are just helper classes not the driver classes.
 
I don't need IOService and also multiple kext binaries.
 
I was curious so, I checked that OSObject size is just 8 bytes.
 
So I can use the OSObject as my base class.
Like
                   OSObject
                         |
                  HBA_Class ( abstract one)
                         |
    --------------------------------------------
   |                                            |
HBA_TYPE1                     HBA_TYPE2
 
 
and will use OSTypeAlloc() method to create and object and release() to free the object.
 
Parav


Godfrey van der Linden <email@hidden> wrote:
OSObject doesn't come with that much overhead. It implements a
reference counting mechanism and that is about it.

However that isn't really the issue. You will need to implement at
least one object that IS an IOService subclass otherwise your drivers
wont match. Since multiple inheritance is not allowed it means that
your abstract class will probably need to inherit from IOService.
Fortunately this is exactly the model that Families provide and you
can use our Family infrastructure to help you, It may even be
possible to deliver your project as three kexts, a family and 2
driver kexts.

Finally if you don't inherit from OSObject (or IOService) then you
can use 'new' or even just create static or automatic classes.
Remember thought that you will have significant binary compatibility
issues if you split your code into mul! tiple kexts.

Check out IOKit's use of

OSDeclareAbstractStructors() & OSDefineMetaClassAndAbstractStructors()

Godfrey

On 06/02/2005, at 12:41 , Parav Pandit wrote:

> Hi,
>
> have one abstact class which represent my HBA card.
> and 2 other classes derived from this abstract class.
> Each one for different HBA.
>
> This is not a driver class. It is just helper class.
>
> This absract class is NOT derived any IOService or
> OSObject or any other OS classes.
>
> But I need the inheritance capability.
>
> My question is :
> How to create an instace of this independent class?
>
> Can I use the "new" operator?
>
> Or should I derive from OSObject?
> But I don't want that big overhead for small
> functionalies.
>
> Or something else?
>
> Regards,
> Parav
>
>
>
>
> __________________________________________________________
> How much free photo storage do you get? Store your friends 'n
> family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-drivers mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/darwin-drivers/email@hidden
>
> This email sent to email@hidden
>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden


Free antispam, antivirus and 1GB to save all your messages
Only in Yahoo! Mail: http://in.mail.yahoo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-drivers mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-drivers/email@hidden

This email sent to email@hidden

References: 
 >Re: helper class instance creation (From: Godfrey van der Linden <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.