[aravis/dom] dom: add ArvGcPropertyNode.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis/dom] dom: add ArvGcPropertyNode.
- Date: Tue, 28 Feb 2012 13:37:09 +0000 (UTC)
commit 1f599d97cf4629fe68bbb2fef4277325f5882ed3
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Tue Feb 28 14:20:34 2012 +0100
dom: add ArvGcPropertyNode.
src/Makefile.am | 2 +
src/arvgc.c | 16 +++++-
src/arvgcpropertynode.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++
src/arvgcpropertynode.h | 71 ++++++++++++++++++++++++
src/arvtypes.h | 1 +
5 files changed, 225 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 71fb4f9..8be286b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -46,6 +46,7 @@ ARAVIS_SRCS = \
arvcamera.c \
arvgc.c \
arvgcnode.c \
+ arvgcpropertynode.c \
arvgcregisterdescriptionnode.c \
arvgccategory.c \
arvgcboolean.c \
@@ -100,6 +101,7 @@ ARAVIS_HDRS = \
arvcamera.h \
arvgc.h \
arvgcnode.h \
+ arvgcpropertynode.h \
arvgcregisterdescriptionnode.h \
arvgccategory.h \
arvgcboolean.h \
diff --git a/src/arvgc.c b/src/arvgc.c
index b4d11bb..04dfce0 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -30,6 +30,8 @@
*/
#include <arvgc.h>
+#include <arvgcpropertynode.h>
+#include <arvgcregisterdescriptionnode.h>
#include <arvgccategory.h>
#include <arvgcenumeration.h>
#include <arvgcenumentry.h>
@@ -64,7 +66,7 @@ arv_gc_can_append_child (ArvDomNode *self, ArvDomNode *child)
static ArvDomElement *
arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
{
- ArvGcNode *node = NULL;
+ ArvDomNode *node = NULL;
if (strcmp (tag_name, "Category") == 0)
node = arv_gc_category_new ();
@@ -98,6 +100,18 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
node = arv_gc_swiss_knife_new_integer ();
else if (strcmp (tag_name, "Port") == 0)
node = arv_gc_port_new ();
+ else if (strcmp (tag_name, "RegisterDescription") == 0)
+ node = arv_gc_register_description_node_new ();
+ else if (strcmp (tag_name, "Description") == 0)
+ node = arv_gc_property_node_new_description ();
+ else if (strcmp (tag_name, "Tooltip") == 0)
+ node = arv_gc_property_node_new_tooltip ();
+ else if (strcmp (tag_name, "DisplayName") == 0)
+ node = arv_gc_property_node_new_display_name ();
+ else if (strcmp (tag_name, "pIsImplemented") == 0)
+ node = arv_gc_property_node_new_p_is_implemented ();
+ else if (strcmp (tag_name, "pIsAvailable") == 0)
+ node = arv_gc_property_node_new_p_is_available ();
else
arv_debug_dom ("[Genicam::create_element] Unknow tag (%s)", tag_name);
diff --git a/src/arvgcpropertynode.c b/src/arvgcpropertynode.c
new file mode 100644
index 0000000..b8021aa
--- /dev/null
+++ b/src/arvgcpropertynode.c
@@ -0,0 +1,136 @@
+/* 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: arvgcnode
+ * @short_description: Base class for all Genicam nodes
+ *
+ * #ArvGcPropertyNode provides a base class for the implementation of the different
+ * types of Genicam node.
+ */
+
+#include <arvgcpropertynode.h>
+#include <arvgc.h>
+#include <arvmisc.h>
+#include <arvdebug.h>
+#include <string.h>
+
+static GObjectClass *parent_class = NULL;
+
+/* ArvDomNode implementation */
+
+static const char *
+arv_gc_property_node_get_node_name (ArvDomNode *node)
+{
+ ArvGcPropertyNode *property_node = ARV_GC_PROPERTY_NODE (node);
+
+ switch (property_node->type) {
+ case ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION:
+ return "Description";
+ case ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP:
+ return "Tooltip";
+ case ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME:
+ return "DisplayName";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED:
+ return "pIsImplemented";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE:
+ return "pIsAvailable";
+ default:
+ return "Unknown";
+ }
+}
+
+/* ArvGcPropertyNode implementation */
+
+const char *
+arv_gc_property_node_get_content (ArvGcPropertyNode *node)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
+static ArvGcPropertyNode *
+arv_gc_property_node_new (ArvGcPropertyNodeType type)
+{
+ ArvGcPropertyNode *node;
+
+ node = g_object_new (ARV_TYPE_GC_PROPERTY_NODE, NULL);
+ node->type = type;
+
+ return node;
+}
+
+ArvGcPropertyNode *
+arv_gc_property_node_new_description (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION);
+}
+
+ArvGcPropertyNode *
+arv_gc_property_node_new_tooltip (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP);
+}
+
+ArvGcPropertyNode *
+arv_gc_property_node_new_display_name (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME);
+}
+
+ArvGcPropertyNode *
+arv_gc_property_node_new_p_is_implemented (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED);
+}
+
+ArvGcPropertyNode *
+arv_gc_property_node_new_p_is_available (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE);
+}
+
+static void
+arv_gc_property_node_init (ArvGcPropertyNode *gc_property_node)
+{
+ gc_property_node->type = 0;
+}
+
+static void
+arv_gc_property_node_finalize (GObject *object)
+{
+ parent_class->finalize (object);
+}
+
+static void
+arv_gc_property_node_class_init (ArvGcPropertyNodeClass *this_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (this_class);
+ ArvDomNodeClass *dom_node_class = ARV_DOM_NODE_CLASS (this_class);
+
+ parent_class = g_type_class_peek_parent (this_class);
+
+ object_class->finalize = arv_gc_property_node_finalize;
+ dom_node_class->get_node_name = arv_gc_property_node_get_node_name;
+}
+
+G_DEFINE_TYPE (ArvGcPropertyNode, arv_gc_property_node, ARV_TYPE_DOM_ELEMENT)
diff --git a/src/arvgcpropertynode.h b/src/arvgcpropertynode.h
new file mode 100644
index 0000000..927392b
--- /dev/null
+++ b/src/arvgcpropertynode.h
@@ -0,0 +1,71 @@
+/* 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_PROPERTY_NODE_H
+#define ARV_GC_PROPERTY_NODE_H
+
+#include <arvtypes.h>
+#include <arvdomelement.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ ARV_GC_PROPERTY_NODE_TYPE_UNKNOWN,
+ ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION,
+ ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP,
+ ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME,
+ ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED,
+ ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE
+} ArvGcPropertyNodeType;
+
+#define ARV_TYPE_GC_PROPERTY_NODE (arv_gc_property_node_get_type ())
+#define ARV_GC_PROPERTY_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_GC_PROPERTY_NODE, ArvGcPropertyNode))
+#define ARV_GC_PROPERTY_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_GC_PROPERTY_NODE, ArvGcPropertyNodeClass))
+#define ARV_IS_GC_PROPERTY_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ARV_TYPE_GC_PROPERTY_NODE))
+#define ARV_IS_GC_PROPERTY_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ARV_TYPE_GC_PROPERTY_NODE))
+#define ARV_GC_PROPERTY_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ARV_TYPE_GC_PROPERTY_NODE, ArvGcPropertyNodeClass))
+
+typedef struct _ArvGcPropertyNodePrivate ArvGcPropertyNodePrivate;
+typedef struct _ArvGcPropertyNodeClass ArvGcPropertyNodeClass;
+
+struct _ArvGcPropertyNode {
+ ArvDomElement base;
+
+ ArvGcPropertyNodeType type;
+};
+
+struct _ArvGcPropertyNodeClass {
+ ArvDomElementClass parent_class;
+};
+
+GType arv_gc_property_node_get_type (void);
+
+ArvGcPropertyNode * arv_gc_property_node_new_description (void);
+ArvGcPropertyNode * arv_gc_property_node_new_tooltip (void);
+ArvGcPropertyNode * arv_gc_property_node_new_display_name (void);
+ArvGcPropertyNode * arv_gc_property_node_new_p_is_implemented (void);
+ArvGcPropertyNode * arv_gc_property_node_new_p_is_available (void);
+const char * arv_gc_property_node_get_content (ArvGcPropertyNode *node);
+
+G_END_DECLS
+
+#endif
diff --git a/src/arvtypes.h b/src/arvtypes.h
index 686150e..6106fae 100644
--- a/src/arvtypes.h
+++ b/src/arvtypes.h
@@ -43,6 +43,7 @@ typedef struct _ArvDomText ArvDomText;
typedef struct _ArvGc ArvGc;
typedef struct _ArvGcNode ArvGcNode;
+typedef struct _ArvGcPropertyNode ArvGcPropertyNode;
typedef struct _ArvGcRegisterDescriptionNode ArvGcRegisterDescriptionNode;
typedef struct _ArvGcCategory ArvGcCategory;
typedef struct _ArvGcBoolean ArvGcBoolean;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]