qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC] QOM design - add instance data to Object


From: Peter Crosthwaite
Subject: Re: [Qemu-devel] [RFC] QOM design - add instance data to Object
Date: Sun, 14 Jun 2015 14:28:21 -0700

On Sun, Jun 14, 2015 at 11:47 AM, Liviu Ionescu <address@hidden> wrote:
>
>> On 13 Jun 2015, at 12:29, Peter Crosthwaite <address@hidden> wrote:
>>
>> There is a way :). Check object_class_get_parent. qdev.c uses it to
>> implement device properties on multiple levels without overriding. You
>> still need to explicit call to superclass in each child class but that
>> is normal of OO syntaxes.
>
> there is a way, but there is a catch, it must be applied to the explicit 
> class of the current level, not of the current device object, since this 
> might be the class of the child class.
>
> so the detailed syntax to call the parent realize() is:
>
>         
> DEVICE_CLASS(object_class_get_parent(object_class_by_name(CURRENT_CLASS_TYPE_NAME)))->realize(dev,
>  &local_err);
>

Yes. We did actually come up with some macros to make this less
verbose at one stage.

Regards,
Peter

>
> regards,
>
> Liviu
>
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]