[aravis/dom] gc_property_node: add pVariable, Constant, Expression, FormulaTo and FormulaFrom.



commit 23e846affcac85b6fbc940c404cbff79b6e577da
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Thu Mar 1 14:43:49 2012 +0100

    gc_property_node: add pVariable, Constant, Expression, FormulaTo and FormulaFrom.

 src/Makefile.am         |    2 +
 src/arvgc.c             |   11 ++++
 src/arvgcpropertynode.c |   35 +++++++++++++
 src/arvgcpropertynode.h |   11 ++++-
 src/arvgcvariablenode.c |  125 +++++++++++++++++++++++++++++++++++++++++++++++
 src/arvgcvariablenode.h |   56 +++++++++++++++++++++
 src/arvtypes.h          |    1 +
 7 files changed, 240 insertions(+), 1 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 00f1077..431d42b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -48,6 +48,7 @@ ARAVIS_SRCS =					\
 	arvgcnode.c				\
 	arvgcpropertynode.c			\
 	arvgcindexnode.c			\
+	arvgcvariablenode.c			\
 	arvgcfeaturenode.c			\
 	arvgcregisterdescriptionnode.c		\
 	arvgccategory.c				\
@@ -105,6 +106,7 @@ ARAVIS_HDRS = 					\
 	arvgcnode.h				\
 	arvgcpropertynode.h			\
 	arvgcindexnode.h			\
+	arvgcvariablenode.h			\
 	arvgcfeaturenode.h			\
 	arvgcregisterdescriptionnode.h		\
 	arvgccategory.h				\
diff --git a/src/arvgc.c b/src/arvgc.c
index ab16ea1..19e9df6 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -33,6 +33,7 @@
 #include <arvgcnode.h>
 #include <arvgcpropertynode.h>
 #include <arvgcindexnode.h>
+#include <arvgcvariablenode.h>
 #include <arvgcregisterdescriptionnode.h>
 #include <arvgccategory.h>
 #include <arvgcenumeration.h>
@@ -148,6 +149,16 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
 		node = arv_gc_property_node_new_p_length ();
 	else if (strcmp (tag_name, "pPort") == 0)
 		node = arv_gc_property_node_new_p_port ();
+	else if (strcmp (tag_name, "pVariable") == 0)
+		node = arv_gc_variable_node_new ();
+	else if (strcmp (tag_name, "FormulaTo") == 0)
+		node = arv_gc_property_node_new_formula_to ();
+	else if (strcmp (tag_name, "FormulaFrom") == 0)
+		node = arv_gc_property_node_new_formula_from ();
+	else if (strcmp (tag_name, "Expression") == 0)
+		node = arv_gc_property_node_new_expression ();
+	else if (strcmp (tag_name, "Constant") == 0)
+		node = arv_gc_property_node_new_constant ();
 	else
 		arv_debug_dom ("[Genicam::create_element] Unknow tag (%s)", tag_name);
 
diff --git a/src/arvgcpropertynode.c b/src/arvgcpropertynode.c
index 01243ab..09b3be0 100644
--- a/src/arvgcpropertynode.c
+++ b/src/arvgcpropertynode.c
@@ -70,6 +70,15 @@ arv_gc_property_node_get_node_name (ArvDomNode *node)
 			return "OffValue";
 		case ARV_GC_PROPERTY_NODE_TYPE_LENGTH:
 			return "Length";
+		case ARV_GC_PROPERTY_NODE_TYPE_FORMULA_TO:
+			return "FormulaTo";
+		case ARV_GC_PROPERTY_NODE_TYPE_FORMULA_FROM:
+			return "FormulaFrom";
+		case ARV_GC_PROPERTY_NODE_TYPE_EXPRESSION:
+			return "Expression";
+		case ARV_GC_PROPERTY_NODE_TYPE_CONSTANT:
+			return "Constant";
+
 		case ARV_GC_PROPERTY_NODE_TYPE_P_FEATURE:
 			return "pFeature";
 		case ARV_GC_PROPERTY_NODE_TYPE_P_VALUE:
@@ -90,6 +99,8 @@ arv_gc_property_node_get_node_name (ArvDomNode *node)
 			return "pLength";
 		case ARV_GC_PROPERTY_NODE_TYPE_P_PORT:
 			return "pPort";
+		case ARV_GC_PROPERTY_NODE_TYPE_P_VARIABLE:
+			return "pVariable";
 		default:
 			return "Unknown";
 	}
@@ -377,6 +388,30 @@ arv_gc_property_node_new_p_port (void)
 	return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_PORT);
 }
 
+ArvGcNode *
+arv_gc_property_node_new_formula_to (void)
+{
+	return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_FORMULA_TO);
+}
+
+ArvGcNode *
+arv_gc_property_node_new_formula_from (void)
+{
+	return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_FORMULA_FROM);
+}
+
+ArvGcNode *
+arv_gc_property_node_new_expression (void)
+{
+	return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_EXPRESSION);
+}
+
+ArvGcNode *
+arv_gc_property_node_new_constant (void)
+{
+	return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_CONSTANT);
+}
+
 static void
 arv_gc_property_node_init (ArvGcPropertyNode *gc_property_node)
 {
diff --git a/src/arvgcpropertynode.h b/src/arvgcpropertynode.h
index f8425aa..f28ef71 100644
--- a/src/arvgcpropertynode.h
+++ b/src/arvgcpropertynode.h
@@ -42,6 +42,10 @@ typedef enum {
 	ARV_GC_PROPERTY_NODE_TYPE_ON_VALUE,
 	ARV_GC_PROPERTY_NODE_TYPE_OFF_VALUE,
 	ARV_GC_PROPERTY_NODE_TYPE_LENGTH,
+	ARV_GC_PROPERTY_NODE_TYPE_FORMULA_TO,
+	ARV_GC_PROPERTY_NODE_TYPE_FORMULA_FROM,
+	ARV_GC_PROPERTY_NODE_TYPE_EXPRESSION,
+	ARV_GC_PROPERTY_NODE_TYPE_CONSTANT,
 
 	ARV_GC_PROPERTY_NODE_TYPE_P_UNKNONW	= 1000,
 	ARV_GC_PROPERTY_NODE_TYPE_P_FEATURE,
@@ -54,7 +58,8 @@ typedef enum {
 	ARV_GC_PROPERTY_NODE_TYPE_P_INCREMENT,
 	ARV_GC_PROPERTY_NODE_TYPE_P_INDEX,
 	ARV_GC_PROPERTY_NODE_TYPE_P_LENGTH,
-	ARV_GC_PROPERTY_NODE_TYPE_P_PORT
+	ARV_GC_PROPERTY_NODE_TYPE_P_PORT,
+	ARV_GC_PROPERTY_NODE_TYPE_P_VARIABLE
 } ArvGcPropertyNodeType;
 
 #define ARV_TYPE_GC_PROPERTY_NODE             (arv_gc_property_node_get_type ())
@@ -101,6 +106,10 @@ ArvGcNode * 	arv_gc_property_node_new_p_is_available 	(void);
 ArvGcNode * 	arv_gc_property_node_new_length			(void);
 ArvGcNode * 	arv_gc_property_node_new_p_length		(void);
 ArvGcNode * 	arv_gc_property_node_new_p_port 		(void);
+ArvGcNode * 	arv_gc_property_node_new_formula_to		(void);
+ArvGcNode * 	arv_gc_property_node_new_formula_from		(void);
+ArvGcNode * 	arv_gc_property_node_new_expression		(void);
+ArvGcNode * 	arv_gc_property_node_new_constant		(void);
 
 const char * 		arv_gc_property_node_get_string 	(ArvGcPropertyNode *node);
 void	 		arv_gc_property_node_set_string 	(ArvGcPropertyNode *node, const char *string);
diff --git a/src/arvgcvariablenode.c b/src/arvgcvariablenode.c
new file mode 100644
index 0000000..f118e7c
--- /dev/null
+++ b/src/arvgcvariablenode.c
@@ -0,0 +1,125 @@
+/* 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: arvgcvariable_node
+ * @short_description: Class for VariableNode elements
+ */
+
+#include <arvgcvariablenode.h>
+#include <arvgcpropertynode.h>
+#include <arvgc.h>
+#include <arvdomtext.h>
+#include <arvmisc.h>
+#include <string.h>
+
+static GObjectClass *parent_class = NULL;
+
+/* ArvDomNode implementation */
+
+static const char *
+arv_gc_variable_node_get_node_name (ArvDomNode *node)
+{
+	return "pVariable";
+}
+
+static gboolean
+arv_gc_variable_node_can_append_child (ArvDomNode *parent, ArvDomNode *child)
+{
+	return ARV_IS_DOM_TEXT (child);
+}
+
+/* ArvDomElement implementation */
+
+static void
+arv_gc_variable_node_set_attribute (ArvDomElement *self, const char *name, const char *value)
+{
+	ArvGcVariableNode *variable_node = ARV_GC_VARIABLE_NODE (self);
+
+	if (strcmp (name, "Name") == 0) {
+		g_free (variable_node->name);
+		variable_node->name = g_strdup (value);
+	} else
+		ARV_DOM_ELEMENT_CLASS (parent_class)->set_attribute (self, name, value);
+}
+
+static const char *
+arv_gc_variable_node_get_attribute (ArvDomElement *self, const char *name)
+{
+	g_assert_not_reached ();
+
+	return NULL;
+}
+
+/* ArvGcVariableNode implementation */
+
+const char *
+arv_gc_variable_node_get_name (ArvGcVariableNode *variable_node)
+{
+	g_return_val_if_fail (ARV_IS_GC_VARIABLE_NODE (variable_node), NULL);
+
+	return variable_node->name;
+}
+
+ArvGcNode *
+arv_gc_variable_node_new (void)
+{
+	ArvGcPropertyNode *node;
+
+	node = g_object_new (ARV_TYPE_GC_VARIABLE_NODE, NULL);
+	node->type = ARV_GC_PROPERTY_NODE_TYPE_P_VARIABLE;
+
+	return ARV_GC_NODE (node);
+}
+
+static void
+arv_gc_variable_node_init (ArvGcVariableNode *variable_node)
+{
+}
+
+static void
+arv_gc_variable_node_finalize (GObject *object)
+{
+	ArvGcVariableNode *variable_node = ARV_GC_VARIABLE_NODE (object);
+
+	g_free (variable_node->name);
+
+	parent_class->finalize (object);
+}
+
+static void
+arv_gc_variable_node_class_init (ArvGcVariableNodeClass *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_variable_node_finalize;
+	dom_node_class->get_node_name = arv_gc_variable_node_get_node_name;
+	dom_node_class->can_append_child = arv_gc_variable_node_can_append_child;
+	dom_element_class->set_attribute = arv_gc_variable_node_set_attribute;
+	dom_element_class->get_attribute = arv_gc_variable_node_get_attribute;
+}
+
+G_DEFINE_TYPE (ArvGcVariableNode, arv_gc_variable_node, ARV_TYPE_GC_PROPERTY_NODE)
diff --git a/src/arvgcvariablenode.h b/src/arvgcvariablenode.h
new file mode 100644
index 0000000..16ba670
--- /dev/null
+++ b/src/arvgcvariablenode.h
@@ -0,0 +1,56 @@
+/* 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_VARIABLE_NODE_H
+#define ARV_GC_VARIABLE_NODE_H
+
+#include <arvtypes.h>
+#include <arvgcpropertynode.h>
+
+G_BEGIN_DECLS
+
+#define ARV_TYPE_GC_VARIABLE_NODE             (arv_gc_variable_node_get_type ())
+#define ARV_GC_VARIABLE_NODE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_GC_VARIABLE_NODE, ArvGcVariableNode))
+#define ARV_GC_VARIABLE_NODE_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_GC_VARIABLE_NODE, ArvGcVariableNodeClass))
+#define ARV_IS_GC_VARIABLE_NODE(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ARV_TYPE_GC_VARIABLE_NODE))
+#define ARV_IS_GC_VARIABLE_NODE_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), ARV_TYPE_GC_VARIABLE_NODE))
+#define ARV_GC_VARIABLE_NODE_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), ARV_TYPE_GC_VARIABLE_NODE, ArvGcVariableNodeClass))
+
+typedef struct _ArvGcVariableNodeClass ArvGcVariableNodeClass;
+
+struct _ArvGcVariableNode {
+	ArvGcPropertyNode	base;
+
+	char *name;
+};
+
+struct _ArvGcVariableNodeClass {
+	ArvGcPropertyNodeClass parent_class;
+};
+
+GType 		arv_gc_variable_node_get_type 	(void);
+ArvGcNode * 	arv_gc_variable_node_new 	(void);
+const char * 	arv_gc_variable_node_get_name 	(ArvGcVariableNode *variable_node);
+
+G_END_DECLS
+
+#endif
diff --git a/src/arvtypes.h b/src/arvtypes.h
index 68ae2b1..bbd1d97 100644
--- a/src/arvtypes.h
+++ b/src/arvtypes.h
@@ -46,6 +46,7 @@ typedef	struct _ArvGcNode			ArvGcNode;
 typedef struct _ArvGcFeatureNode 		ArvGcFeatureNode;
 typedef struct _ArvGcPropertyNode		ArvGcPropertyNode;
 typedef struct _ArvGcIndexNode			ArvGcIndexNode;
+typedef struct _ArvGcVariableNode		ArvGcVariableNode;
 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]