[Top][All Lists]

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

[Qemu-devel] [RFC PATCH v1 4/7] qom/cpu: Introduce CPU super class cast

From: peter . crosthwaite
Subject: [Qemu-devel] [RFC PATCH v1 4/7] qom/cpu: Introduce CPU super class cast macros
Date: Tue, 18 Jun 2013 19:46:19 +1000

From: Peter Crosthwaite <address@hidden>

Add macros CPU_SUPER_CLASS and CPU_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/qom/cpu.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index a5bb515..50d478a 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -39,6 +39,10 @@ typedef int (*WriteCoreDumpFunction)(void *buf, size_t size, 
void *opaque);
 #define CPU(obj) OBJECT_CHECK(CPUState, (obj), TYPE_CPU)
 #define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU)
+#define CPU_SUPER_CLASS(klass, typename) \
+    CPU_CLASS(object_class_get_super(OBJECT_CLASS(klass), typename))
+#define CPU_GET_SUPER_CLASS(obj, typename) \
+    CPU_SUPER_CLASS(CPU_GET_CLASS(obj), typename)
 typedef struct CPUState CPUState;

reply via email to

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