[aravis/dom] gc_invalidator_node: new.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis/dom] gc_invalidator_node: new.
- Date: Thu, 1 Mar 2012 16:29:19 +0000 (UTC)
commit 14009d68ccb505bdaeb6eaa3d99f4e3df22c0c0a
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Thu Mar 1 17:28:55 2012 +0100
gc_invalidator_node: new.
src/Makefile.am | 2 +
src/arvgc.c | 3 +-
src/arvgcinvalidatornode.c | 90 ++++++++++++++++++++++++++++++++++++++++++++
src/arvgcinvalidatornode.h | 57 ++++++++++++++++++++++++++++
src/arvgcpropertynode.c | 24 ++++++++----
src/arvgcpropertynode.h | 1 -
src/arvtypes.h | 1 +
7 files changed, 168 insertions(+), 10 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index a4c1d30..7cfc24f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -49,6 +49,7 @@ ARAVIS_SRCS = \
arvgcpropertynode.c \
arvgcindexnode.c \
arvgcvariablenode.c \
+ arvgcinvalidatornode.c \
arvgcfeaturenode.c \
arvgcregisterdescriptionnode.c \
arvgcgroupnode.c \
@@ -108,6 +109,7 @@ ARAVIS_HDRS = \
arvgcpropertynode.h \
arvgcindexnode.h \
arvgcvariablenode.h \
+ arvgcinvalidatornode.h \
arvgcfeaturenode.h \
arvgcregisterdescriptionnode.h \
arvgcgroupnode.h \
diff --git a/src/arvgc.c b/src/arvgc.c
index 4234460..7ec6fdc 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -34,6 +34,7 @@
#include <arvgcpropertynode.h>
#include <arvgcindexnode.h>
#include <arvgcvariablenode.h>
+#include <arvgcinvalidatornode.h>
#include <arvgcregisterdescriptionnode.h>
#include <arvgcgroupnode.h>
#include <arvgccategory.h>
@@ -180,7 +181,7 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
else if (strcmp (tag_name, "Bit") == 0)
node = arv_gc_property_node_new_bit ();
else if (strcmp (tag_name, "pInvalidator") == 0)
- node = arv_gc_property_node_new_p_invalidator ();
+ node = arv_gc_invalidator_node_new ();
else if (strcmp (tag_name, "Group") == 0)
node = arv_gc_group_node_new ();
diff --git a/src/arvgcinvalidatornode.c b/src/arvgcinvalidatornode.c
new file mode 100644
index 0000000..b0cefd1
--- /dev/null
+++ b/src/arvgcinvalidatornode.c
@@ -0,0 +1,90 @@
+/* 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: arvgcinvalidator_node
+ * @short_description: Class for InvalidatorNode elements
+ */
+
+#include <arvgcinvalidatornode.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_invalidator_node_get_node_name (ArvDomNode *node)
+{
+ return "pInvalidator";
+}
+
+/* ArvGcInvalidatorNode implementation */
+
+gint
+arv_gc_invalidator_node_get_modification_count (ArvGcInvalidatorNode *invalidator_node)
+{
+ g_return_val_if_fail (ARV_IS_GC_INVALIDATOR_NODE (invalidator_node), 0);
+
+ return invalidator_node->modification_count;
+}
+
+void
+arv_gc_invalidator_node_set_modification_count (ArvGcInvalidatorNode *invalidator_node, gint modification_count)
+{
+ g_return_if_fail (ARV_IS_GC_INVALIDATOR_NODE (invalidator_node));
+
+ invalidator_node->modification_count = modification_count;
+}
+
+ArvGcNode *
+arv_gc_invalidator_node_new (void)
+{
+ ArvGcPropertyNode *node;
+
+ node = g_object_new (ARV_TYPE_GC_INVALIDATOR_NODE, NULL);
+ node->type = ARV_GC_PROPERTY_NODE_TYPE_P_INVALIDATOR;
+
+ return ARV_GC_NODE (node);
+}
+
+static void
+arv_gc_invalidator_node_init (ArvGcInvalidatorNode *invalidator_node)
+{
+ invalidator_node->modification_count = 0;
+}
+
+static void
+arv_gc_invalidator_node_class_init (ArvGcInvalidatorNodeClass *this_class)
+{
+ ArvDomNodeClass *dom_node_class = ARV_DOM_NODE_CLASS (this_class);
+
+ parent_class = g_type_class_peek_parent (this_class);
+
+ dom_node_class->get_node_name = arv_gc_invalidator_node_get_node_name;
+}
+
+G_DEFINE_TYPE (ArvGcInvalidatorNode, arv_gc_invalidator_node, ARV_TYPE_GC_PROPERTY_NODE)
diff --git a/src/arvgcinvalidatornode.h b/src/arvgcinvalidatornode.h
new file mode 100644
index 0000000..1733a5f
--- /dev/null
+++ b/src/arvgcinvalidatornode.h
@@ -0,0 +1,57 @@
+/* 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_INVALIDATOR_NODE_H
+#define ARV_GC_INVALIDATOR_NODE_H
+
+#include <arvtypes.h>
+#include <arvgcpropertynode.h>
+
+G_BEGIN_DECLS
+
+#define ARV_TYPE_GC_INVALIDATOR_NODE (arv_gc_invalidator_node_get_type ())
+#define ARV_GC_INVALIDATOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_GC_INVALIDATOR_NODE, ArvGcInvalidatorNode))
+#define ARV_GC_INVALIDATOR_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_GC_INVALIDATOR_NODE, ArvGcInvalidatorNodeClass))
+#define ARV_IS_GC_INVALIDATOR_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ARV_TYPE_GC_INVALIDATOR_NODE))
+#define ARV_IS_GC_INVALIDATOR_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ARV_TYPE_GC_INVALIDATOR_NODE))
+#define ARV_GC_INVALIDATOR_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), ARV_TYPE_GC_INVALIDATOR_NODE, ArvGcInvalidatorNodeClass))
+
+typedef struct _ArvGcInvalidatorNodeClass ArvGcInvalidatorNodeClass;
+
+struct _ArvGcInvalidatorNode {
+ ArvGcPropertyNode base;
+
+ gint modification_count;
+};
+
+struct _ArvGcInvalidatorNodeClass {
+ ArvGcPropertyNodeClass parent_class;
+};
+
+GType arv_gc_invalidator_node_get_type (void);
+ArvGcNode * arv_gc_invalidator_node_new (void);
+gint arv_gc_invalidator_node_get_modification_count (ArvGcInvalidatorNode *invalidator_node);
+void arv_gc_invalidator_node_set_modification_count (ArvGcInvalidatorNode *invalidator_node, gint modification_count);
+
+G_END_DECLS
+
+#endif
diff --git a/src/arvgcpropertynode.c b/src/arvgcpropertynode.c
index 1e640b8..68c26f8 100644
--- a/src/arvgcpropertynode.c
+++ b/src/arvgcpropertynode.c
@@ -119,8 +119,6 @@ arv_gc_property_node_get_node_name (ArvDomNode *node)
return "pPort";
case ARV_GC_PROPERTY_NODE_TYPE_P_VARIABLE:
return "pVariable";
- case ARV_GC_PROPERTY_NODE_TYPE_P_INVALIDATOR:
- return "pInvalidator";
default:
return "Unknown";
}
@@ -134,6 +132,19 @@ arv_gc_property_node_can_append_child (ArvDomNode *self, ArvDomNode *child)
return ARV_IS_DOM_TEXT (child);
}
+/* ArvDomElement implementation */
+
+static void
+arv_gc_property_node_set_attribute (ArvDomElement *self, const char *name, const char *value)
+{
+}
+
+static const char *
+arv_gc_property_node_get_attribute (ArvDomElement *self, const char *name)
+{
+ return NULL;
+}
+
/* ArvGcPropertyNode implementation */
static ArvDomNode *
@@ -486,12 +497,6 @@ arv_gc_property_node_new_bit (void)
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_BIT);
}
-ArvGcNode *
-arv_gc_property_node_new_p_invalidator (void)
-{
- return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_INVALIDATOR);
-}
-
static void
arv_gc_property_node_init (ArvGcPropertyNode *gc_property_node)
{
@@ -509,12 +514,15 @@ 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);
+ ArvDomElementClass *dom_element_class = ARV_DOM_ELEMENT_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;
dom_node_class->can_append_child = arv_gc_property_node_can_append_child;
+ dom_element_class->set_attribute = arv_gc_property_node_set_attribute;
+ dom_element_class->get_attribute = arv_gc_property_node_get_attribute;
}
G_DEFINE_TYPE (ArvGcPropertyNode, arv_gc_property_node, ARV_TYPE_GC_NODE)
diff --git a/src/arvgcpropertynode.h b/src/arvgcpropertynode.h
index afff2b7..c87b43e 100644
--- a/src/arvgcpropertynode.h
+++ b/src/arvgcpropertynode.h
@@ -129,7 +129,6 @@ ArvGcNode * arv_gc_property_node_new_sign (void);
ArvGcNode * arv_gc_property_node_new_lsb (void);
ArvGcNode * arv_gc_property_node_new_msb (void);
ArvGcNode * arv_gc_property_node_new_bit (void);
-ArvGcNode * arv_gc_property_node_new_p_invalidator (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/arvtypes.h b/src/arvtypes.h
index defa45d..f7d8293 100644
--- a/src/arvtypes.h
+++ b/src/arvtypes.h
@@ -46,6 +46,7 @@ typedef struct _ArvGcNode ArvGcNode;
typedef struct _ArvGcPropertyNode ArvGcPropertyNode;
typedef struct _ArvGcIndexNode ArvGcIndexNode;
typedef struct _ArvGcVariableNode ArvGcVariableNode;
+typedef struct _ArvGcInvalidatorNode ArvGcInvalidatorNode;
typedef struct _ArvGcFeatureNode ArvGcFeatureNode;
typedef struct _ArvGcRegisterDescriptionNode ArvGcRegisterDescriptionNode;
typedef struct _ArvGcGroupNode ArvGcGroupNode;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]