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

[libvirt] [libvirt-glib 03/37] Add gobject boilerplate for GVirConfigClock and GVirConfigTimer



---
 libvirt-gconfig/Makefile.am             |    4 ++
 libvirt-gconfig/libvirt-gconfig-clock.c |   82 +++++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-clock.h |   68 +++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-timer.c |   82 +++++++++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig-timer.h |   68 +++++++++++++++++++++++++
 libvirt-gconfig/libvirt-gconfig.h       |    2 +
 libvirt-gconfig/libvirt-gconfig.sym     |    8 +++
 7 files changed, 314 insertions(+), 0 deletions(-)
 create mode 100644 libvirt-gconfig/libvirt-gconfig-clock.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-clock.h
 create mode 100644 libvirt-gconfig/libvirt-gconfig-timer.c
 create mode 100644 libvirt-gconfig/libvirt-gconfig-timer.h

diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
index 0d15e78..3fd268a 100644
--- a/libvirt-gconfig/Makefile.am
+++ b/libvirt-gconfig/Makefile.am
@@ -8,6 +8,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig.h \
 			libvirt-gconfig-object.h \
 			libvirt-gconfig-capabilities.h \
+			libvirt-gconfig-clock.h \
 			libvirt-gconfig-domain.h \
 			libvirt-gconfig-domain-snapshot.h \
 			libvirt-gconfig-helpers.h \
@@ -16,6 +17,7 @@ GCONFIG_HEADER_FILES = \
 			libvirt-gconfig-network-filter.h \
 			libvirt-gconfig-node-device.h \
 			libvirt-gconfig-secret.h \
+			libvirt-gconfig-timer.h \
 			libvirt-gconfig-storage-pool.h \
 			libvirt-gconfig-storage-vol.h
 noinst_HEADERS = \
@@ -23,6 +25,7 @@ noinst_HEADERS = \
 GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-object.c \
 			libvirt-gconfig-capabilities.c \
+			libvirt-gconfig-clock.c \
 			libvirt-gconfig-domain.c \
 			libvirt-gconfig-domain-snapshot.c \
 			libvirt-gconfig-helpers.c \
@@ -31,6 +34,7 @@ GCONFIG_SOURCE_FILES = \
 			libvirt-gconfig-network-filter.c \
 			libvirt-gconfig-node-device.c \
 			libvirt-gconfig-secret.c \
+			libvirt-gconfig-timer.c \
 			libvirt-gconfig-storage-pool.c \
 			libvirt-gconfig-storage-vol.c
 
diff --git a/libvirt-gconfig/libvirt-gconfig-clock.c b/libvirt-gconfig/libvirt-gconfig-clock.c
new file mode 100644
index 0000000..d2650ad
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-clock.c
@@ -0,0 +1,82 @@
+/*
+ * libvirt-gobject-config_clock.c: libvirt glib integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau redhat com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <libxml/tree.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_CLOCK_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_CLOCK, GVirConfigClockPrivate))
+
+struct _GVirConfigClockPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigClock, gvir_config_clock, GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_clock_class_init(GVirConfigClockClass *klass)
+{
+
+    g_type_class_add_private(klass, sizeof(GVirConfigClockPrivate));
+}
+
+
+static void gvir_config_clock_init(GVirConfigClock *klock)
+{
+    GVirConfigClockPrivate *priv;
+
+    DEBUG("Init GVirConfigClock=%p", klock);
+
+    priv = klock->priv = GVIR_CONFIG_CLOCK_GET_PRIVATE(klock);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigClock *gvir_config_clock_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_CLOCK,
+                                    "clock", NULL);
+    return GVIR_CONFIG_CLOCK(object);
+}
+
+GVirConfigClock *gvir_config_clock_new_from_xml(const gchar *xml,
+                                                GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_CLOCK,
+                                             "clock", NULL, xml, error);
+    return GVIR_CONFIG_CLOCK(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-clock.h b/libvirt-gconfig/libvirt-gconfig-clock.h
new file mode 100644
index 0000000..fc8850a
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-clock.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-clock.h: libvirt gobject integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau redhat com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_CLOCK_H__
+#define __LIBVIRT_GCONFIG_CLOCK_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_CLOCK            (gvir_config_clock_get_type ())
+#define GVIR_CONFIG_CLOCK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_CLOCK, GVirConfigClock))
+#define GVIR_CONFIG_CLOCK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_CLOCK, GVirConfigClockClass))
+#define GVIR_IS_CONFIG_CLOCK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_CLOCK))
+#define GVIR_IS_CONFIG_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_CLOCK))
+#define GVIR_CONFIG_CLOCK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_CLOCK, GVirConfigClockClass))
+
+typedef struct _GVirConfigClock GVirConfigClock;
+typedef struct _GVirConfigClockPrivate GVirConfigClockPrivate;
+typedef struct _GVirConfigClockClass GVirConfigClockClass;
+
+struct _GVirConfigClock
+{
+    GVirConfigObject parent;
+
+    GVirConfigClockPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigClockClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_clock_get_type(void);
+
+GVirConfigClock *gvir_config_clock_new(void);
+GVirConfigClock *gvir_config_clock_new_from_xml(const gchar *xml,
+                                                GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_CLOCK_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig-timer.c b/libvirt-gconfig/libvirt-gconfig-timer.c
new file mode 100644
index 0000000..477cc94
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-timer.c
@@ -0,0 +1,82 @@
+/*
+ * libvirt-gobject-config_timer.c: libvirt glib integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau gmail com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+
+#include <libxml/tree.h>
+
+#include "libvirt-gconfig/libvirt-gconfig.h"
+
+extern gboolean debugFlag;
+
+#define DEBUG(fmt, ...) do { if (G_UNLIKELY(debugFlag)) g_debug(fmt, ## __VA_ARGS__); } while (0)
+
+#define GVIR_CONFIG_TIMER_GET_PRIVATE(obj)                         \
+        (G_TYPE_INSTANCE_GET_PRIVATE((obj), GVIR_TYPE_CONFIG_TIMER, GVirConfigTimerPrivate))
+
+struct _GVirConfigTimerPrivate
+{
+    gboolean unused;
+};
+
+G_DEFINE_TYPE(GVirConfigTimer, gvir_config_timer, GVIR_TYPE_CONFIG_OBJECT);
+
+
+static void gvir_config_timer_class_init(GVirConfigTimerClass *klass)
+{
+
+    g_type_class_add_private(klass, sizeof(GVirConfigTimerPrivate));
+}
+
+
+static void gvir_config_timer_init(GVirConfigTimer *timer)
+{
+    GVirConfigTimerPrivate *priv;
+
+    DEBUG("Init GVirConfigTimer=%p", timer);
+
+    priv = timer->priv = GVIR_CONFIG_TIMER_GET_PRIVATE(timer);
+
+    memset(priv, 0, sizeof(*priv));
+}
+
+
+GVirConfigTimer *gvir_config_timer_new(void)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new(GVIR_TYPE_CONFIG_TIMER, "timer", NULL);
+    return GVIR_CONFIG_TIMER(object);
+}
+
+
+GVirConfigTimer *gvir_config_timer_new_from_xml(const gchar *xml,
+                                                GError **error)
+{
+    GVirConfigObject *object;
+
+    object = gvir_config_object_new_from_xml(GVIR_TYPE_CONFIG_TIMER,
+                                             "timer", NULL, xml, error);
+    return GVIR_CONFIG_TIMER(object);
+}
diff --git a/libvirt-gconfig/libvirt-gconfig-timer.h b/libvirt-gconfig/libvirt-gconfig-timer.h
new file mode 100644
index 0000000..d0c0f4d
--- /dev/null
+++ b/libvirt-gconfig/libvirt-gconfig-timer.h
@@ -0,0 +1,68 @@
+/*
+ * libvirt-gobject-timer.c: libvirt gobject integration
+ *
+ * Copyright (C) 2011 Red Hat
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ * Author: Christophe Fergeau <cfergeau gmail com>
+ */
+
+#if !defined(__LIBVIRT_GCONFIG_H__) && !defined(LIBVIRT_GCONFIG_BUILD)
+#error "Only <libvirt-gconfig/libvirt-gconfig.h> can be included directly."
+#endif
+
+#ifndef __LIBVIRT_GCONFIG_TIMER_H__
+#define __LIBVIRT_GCONFIG_TIMER_H__
+
+G_BEGIN_DECLS
+
+#define GVIR_TYPE_CONFIG_TIMER            (gvir_config_timer_get_type ())
+#define GVIR_CONFIG_TIMER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GVIR_TYPE_CONFIG_TIMER, GVirConfigTimer))
+#define GVIR_CONFIG_TIMER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GVIR_TYPE_CONFIG_TIMER, GVirConfigTimerClass))
+#define GVIR_IS_CONFIG_TIMER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GVIR_TYPE_CONFIG_TIMER))
+#define GVIR_IS_CONFIG_TIMER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GVIR_TYPE_CONFIG_TIMER))
+#define GVIR_CONFIG_TIMER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GVIR_TYPE_CONFIG_TIMER, GVirConfigTimerClass))
+
+typedef struct _GVirConfigTimer GVirConfigTimer;
+typedef struct _GVirConfigTimerPrivate GVirConfigTimerPrivate;
+typedef struct _GVirConfigTimerClass GVirConfigTimerClass;
+
+struct _GVirConfigTimer
+{
+    GVirConfigObject parent;
+
+    GVirConfigTimerPrivate *priv;
+
+    /* Do not add fields to this struct */
+};
+
+struct _GVirConfigTimerClass
+{
+    GVirConfigObjectClass parent_class;
+
+    gpointer padding[20];
+};
+
+
+GType gvir_config_timer_get_type(void);
+
+GVirConfigTimer *gvir_config_timer_new(void);
+GVirConfigTimer *gvir_config_timer_new_from_xml(const gchar *xml,
+                                                GError **error);
+
+G_END_DECLS
+
+#endif /* __LIBVIRT_GCONFIG_TIMER_H__ */
diff --git a/libvirt-gconfig/libvirt-gconfig.h b/libvirt-gconfig/libvirt-gconfig.h
index 4e23f0d..7cb34b0 100644
--- a/libvirt-gconfig/libvirt-gconfig.h
+++ b/libvirt-gconfig/libvirt-gconfig.h
@@ -28,6 +28,7 @@
 
 #include <libvirt-gconfig/libvirt-gconfig-object.h>
 #include <libvirt-gconfig/libvirt-gconfig-capabilities.h>
+#include <libvirt-gconfig/libvirt-gconfig-clock.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain.h>
 #include <libvirt-gconfig/libvirt-gconfig-domain-snapshot.h>
 #include <libvirt-gconfig/libvirt-gconfig-helpers.h>
@@ -36,6 +37,7 @@
 #include <libvirt-gconfig/libvirt-gconfig-node-device.h>
 #include <libvirt-gconfig/libvirt-gconfig-network-filter.h>
 #include <libvirt-gconfig/libvirt-gconfig-secret.h>
+#include <libvirt-gconfig/libvirt-gconfig-timer.h>
 #include <libvirt-gconfig/libvirt-gconfig-storage-pool.h>
 #include <libvirt-gconfig/libvirt-gconfig-storage-vol.h>
 
diff --git a/libvirt-gconfig/libvirt-gconfig.sym b/libvirt-gconfig/libvirt-gconfig.sym
index ed28449..c76faab 100644
--- a/libvirt-gconfig/libvirt-gconfig.sym
+++ b/libvirt-gconfig/libvirt-gconfig.sym
@@ -4,6 +4,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_capabilities_new;
 	gvir_config_capabilities_new_from_xml;
 
+	gvir_config_clock_get_type;
+	gvir_config_clock_new;
+	gvir_config_clock_new_from_xml;
+
 	gvir_config_domain_get_type;
 	gvir_config_domain_new;
 	gvir_config_domain_new_from_xml;
@@ -54,6 +58,10 @@ LIBVIRT_GOBJECT_0.0.1 {
 	gvir_config_storage_vol_new;
 	gvir_config_storage_vol_new_from_xml;
 
+	gvir_config_timer_get_type;
+	gvir_config_timer_new;
+	gvir_config_timer_new_from_xml;
+
   local:
         *;
 };
-- 
1.7.7


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