qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [RFC PATCH v1 3/7] qdev-core: Introduce DEVICE super class


From: peter . crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 3/7] qdev-core: Introduce DEVICE super class cast macros
Date: Tue, 18 Jun 2013 19:45:36 +1000

From: Peter Crosthwaite <address@hidden>

Add macros DEVICE_SUPER_CLASS and DEVICE_GET_SUPER_CLASS. These are the
similar to their respective non SUPER versions, except instead of
returning the class object for the concrete class, they return their
parent classes implementation (usually some form of abstract class).

Signed-off-by: Peter Crosthwaite <address@hidden>
---

 include/hw/qdev-core.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 7fbffcb..96647c4 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -16,6 +16,10 @@ enum {
 #define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE)
 #define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), 
TYPE_DEVICE)
 #define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE)
+#define DEVICE_SUPER_CLASS(klass, typename) \
+    DEVICE_CLASS(object_class_get_super(OBJECT_CLASS(klass), typename))
+#define DEVICE_GET_SUPER_CLASS(obj, typename) \
+    DEVICE_SUPER_CLASS(DEVICE_GET_CLASS(obj), typename)
 
 typedef int (*qdev_initfn)(DeviceState *dev);
 typedef int (*qdev_event)(DeviceState *dev);
-- 
1.8.3.rc1.44.gb387c77.dirty




reply via email to

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