[aravis/dom] gc_group_node: new.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis/dom] gc_group_node: new.
- Date: Thu, 1 Mar 2012 14:49:38 +0000 (UTC)
commit e56bbcaa5ff7c5457066c9670ae795aad788d45c
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Thu Mar 1 15:47:43 2012 +0100
gc_group_node: new.
src/Makefile.am | 2 +
src/arvgc.c | 3 +
src/arvgcgroupnode.c | 108 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/arvgcgroupnode.h | 55 +++++++++++++++++++++++++
src/arvtypes.h | 3 +-
5 files changed, 170 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 431d42b..a4c1d30 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -51,6 +51,7 @@ ARAVIS_SRCS = \
arvgcvariablenode.c \
arvgcfeaturenode.c \
arvgcregisterdescriptionnode.c \
+ arvgcgroupnode.c \
arvgccategory.c \
arvgcboolean.c \
arvgcenumeration.c \
@@ -109,6 +110,7 @@ ARAVIS_HDRS = \
arvgcvariablenode.h \
arvgcfeaturenode.h \
arvgcregisterdescriptionnode.h \
+ arvgcgroupnode.h \
arvgccategory.h \
arvgcboolean.h \
arvgcenumeration.h \
diff --git a/src/arvgc.c b/src/arvgc.c
index b1fef26..30a1255 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -35,6 +35,7 @@
#include <arvgcindexnode.h>
#include <arvgcvariablenode.h>
#include <arvgcregisterdescriptionnode.h>
+#include <arvgcgroupnode.h>
#include <arvgccategory.h>
#include <arvgcenumeration.h>
#include <arvgcenumentry.h>
@@ -161,6 +162,8 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
node = arv_gc_property_node_new_expression ();
else if (strcmp (tag_name, "Constant") == 0)
node = arv_gc_property_node_new_constant ();
+ else if (strcmp (tag_name, "Group") == 0)
+ node = arv_gc_group_node_new ();
else
arv_debug_dom ("[Genicam::create_element] Unknow tag (%s)", tag_name);
diff --git a/src/arvgcgroupnode.c b/src/arvgcgroupnode.c
new file mode 100644
index 0000000..29f44cd
--- /dev/null
+++ b/src/arvgcgroupnode.c
@@ -0,0 +1,108 @@
+/* Aravis - Digital camera library
+ *
+ * Copyright  2009-2012 Emmanuel Pacaud
+ *
+ * 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 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: Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+/**
+ * SECTION: arvgcgroupnode
+ * @short_description: Class for GroupNode nodes
+ */
+
+#include <arvgcgroupnode.h>
+#include <arvgc.h>
+#include <string.h>
+
+static GObjectClass *parent_class = NULL;
+
+/* ArvDomNode implementation */
+
+static const char *
+arv_gc_group_node_get_node_name (ArvDomNode *node)
+{
+ return "Group";
+}
+
+/* ArvGcFeatureNode implementation */
+
+static void
+arv_gc_group_node_set_attribute (ArvDomElement *self, const char* name, const char *value)
+{
+ ArvGcGroupNode *node = ARV_GC_GROUP_NODE (self);
+
+ if (strcmp (name, "Comment") == 0) {
+ g_free (node->comment);
+ node->comment = g_strdup (value);
+ }
+}
+
+static const char *
+arv_gc_group_node_get_attribute (ArvDomElement *self, const char *name)
+{
+ ArvGcGroupNode *node = ARV_GC_GROUP_NODE (self);
+
+ if (strcmp (name, "ModelName") == 0)
+ return node->comment;
+
+ return NULL;
+}
+
+/* ArvGcGroupNode implementation */
+
+ArvGcNode *
+arv_gc_group_node_new (void)
+{
+ ArvGcNode *node;
+
+ node = g_object_new (ARV_TYPE_GC_GROUP_NODE, NULL);
+
+ return node;
+}
+
+static void
+arv_gc_group_node_init (ArvGcGroupNode *gc_group_node)
+{
+}
+
+static void
+arv_gc_group_node_finalize (GObject *object)
+{
+ ArvGcGroupNode *group_node = ARV_GC_GROUP_NODE (object);
+
+ g_free (group_node->comment);
+
+ parent_class->finalize (object);
+}
+
+static void
+arv_gc_group_node_class_init (ArvGcGroupNodeClass *this_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (this_class);
+ ArvDomNodeClass *dom_node_class = ARV_DOM_NODE_CLASS (this_class);
+ ArvDomElementClass *dom_element_class = ARV_DOM_ELEMENT_CLASS (this_class);
+
+ parent_class = g_type_class_peek_parent (this_class);
+
+ object_class->finalize = arv_gc_group_node_finalize;
+ dom_node_class->get_node_name = arv_gc_group_node_get_node_name;
+ dom_element_class->set_attribute = arv_gc_group_node_set_attribute;
+ dom_element_class->get_attribute = arv_gc_group_node_get_attribute;
+}
+
+G_DEFINE_TYPE (ArvGcGroupNode, arv_gc_group_node, ARV_TYPE_GC_FEATURE_NODE)
diff --git a/src/arvgcgroupnode.h b/src/arvgcgroupnode.h
new file mode 100644
index 0000000..4bb1400
--- /dev/null
+++ b/src/arvgcgroupnode.h
@@ -0,0 +1,55 @@
+/* Aravis - Digital camera library
+ *
+ * Copyright  2009-2012 Emmanuel Pacaud
+ *
+ * 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 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: Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#ifndef ARV_GC_GROUP_NODE_H
+#define ARV_GC_GROUP_NODE_H
+
+#include <arvtypes.h>
+#include <arvgcfeaturenode.h>
+
+G_BEGIN_DECLS
+
+#define ARV_TYPE_GC_GROUP_NODE (arv_gc_group_node_get_type ())
+#define ARV_GC_GROUP_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_GC_GROUP_NODE, ArvGcGroupNode))
+#define ARV_GC_GROUP_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_GC_GROUP_NODE, ArvGcGroupNodeClass))
+#define ARV_IS_GC_GROUP_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ARV_TYPE_GC_GROUP_NODE))
+#define ARV_IS_GC_GROUP_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ARV_TYPE_GC_GROUP_NODE))
+#define ARV_GC_GROUP_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ARV_TYPE_GC_GROUP_NODE, ArvGcGroupNodeClass))
+
+typedef struct _ArvGcGroupNodeClass ArvGcGroupNodeClass;
+
+struct _ArvGcGroupNode {
+ ArvGcFeatureNode base;
+
+ char *comment;
+};
+
+struct _ArvGcGroupNodeClass {
+ ArvGcFeatureNodeClass parent_class;
+};
+
+GType arv_gc_group_node_get_type (void);
+ArvGcNode * arv_gc_group_node_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/src/arvtypes.h b/src/arvtypes.h
index bbd1d97..defa45d 100644
--- a/src/arvtypes.h
+++ b/src/arvtypes.h
@@ -43,11 +43,12 @@ typedef struct _ArvDomText ArvDomText;
typedef struct _ArvGc ArvGc;
typedef struct _ArvGcNode ArvGcNode;
-typedef struct _ArvGcFeatureNode ArvGcFeatureNode;
typedef struct _ArvGcPropertyNode ArvGcPropertyNode;
typedef struct _ArvGcIndexNode ArvGcIndexNode;
typedef struct _ArvGcVariableNode ArvGcVariableNode;
+typedef struct _ArvGcFeatureNode ArvGcFeatureNode;
typedef struct _ArvGcRegisterDescriptionNode ArvGcRegisterDescriptionNode;
+typedef struct _ArvGcGroupNode ArvGcGroupNode;
typedef struct _ArvGcCategory ArvGcCategory;
typedef struct _ArvGcBoolean ArvGcBoolean;
typedef struct _ArvGcEnumeration ArvGcEnumeration;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]