galago-object-utils.h
Go to the documentation of this file.00001
00021 #ifndef _GALAGO_OBJECT_UTILS_H_
00022 #define _GALAGO_OBJECT_UTILS_H_
00023
00024 #include <libgalago/galago-object.h>
00025
00026 #define GALAGO_REGISTER_CLASS(name, type, parent_type, dbus_iface) \
00027 static void name##_class_init(GalagoObjectClass *klass); \
00028 static void name##_object_init(type *obj); \
00029 static void *name##_parent_class = NULL; \
00030 static void name##_class_init_internal(GalagoObjectClass *klass) \
00031 { \
00032 name##_parent_class = galago_class_get_parent(klass); \
00033 name##_class_init(klass); \
00034 } \
00035 GalagoObjectClass *\
00036 name##_get_class(void) \
00037 { \
00038 static GalagoObjectClass *klass = NULL; \
00039 \
00040 if (klass == NULL) \
00041 { \
00042 static const GalagoObjectClassInfo info = \
00043 { \
00044 0, \
00045 sizeof(type##Class), \
00046 name##_class_init_internal, \
00047 NULL, \
00048 sizeof(type), \
00049 (GalagoObjectInitFunc)name##_object_init, \
00050 }; \
00051 \
00052 klass = galago_class_register(parent_type, #type, dbus_iface, &info); \
00053 } \
00054 \
00055 return klass; \
00056 }
00057
00058 #endif