[aravis/dom] dom: make genicam integer and boolean tests pass.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis/dom] dom: make genicam integer and boolean tests pass.
- Date: Tue, 28 Feb 2012 22:11:20 +0000 (UTC)
commit f7933604c993e834fe54013761659b469679cc40
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Tue Feb 28 23:10:47 2012 +0100
dom: make genicam integer and boolean tests pass.
src/arvcamera.c | 2 +-
src/arvdevice.c | 20 +-
src/arvdevice.h | 2 +-
src/arvgc.c | 368 +++++++++++++++++++-----------------
src/arvgc.h | 4 +-
src/arvgcboolean.c | 95 ++++++---
src/arvgcboolean.h | 10 +-
src/arvgccategory.c | 12 +-
src/arvgccategory.h | 5 +-
src/arvgccommand.c | 12 +-
src/arvgccommand.h | 2 +-
src/arvgcconverter.c | 36 ++--
src/arvgcconverter.h | 5 +-
src/arvgcenumentry.c | 10 +-
src/arvgcenumentry.h | 5 +-
src/arvgcenumeration.c | 84 +++++----
src/arvgcenumeration.h | 5 +-
src/arvgcfeaturenode.c | 301 +++++++++++++-----------------
src/arvgcfeaturenode.h | 40 ++---
src/arvgcfloatnode.c | 22 ++-
src/arvgcfloatnode.h | 3 +-
src/arvgcintegernode.c | 152 +++++++--------
src/arvgcintegernode.h | 18 +-
src/arvgcnode.c | 16 ++
src/arvgcnode.h | 2 +
src/arvgcport.c | 8 +-
src/arvgcport.h | 10 +-
src/arvgcpropertynode.c | 126 +++++++++++-
src/arvgcpropertynode.h | 44 ++++-
src/arvgcregister.c | 46 +++---
src/arvgcregister.h | 10 +-
src/arvgcregisterdescriptionnode.c | 37 ++++-
src/arvgcregisterdescriptionnode.h | 3 +
src/arvgcswissknife.c | 20 +-
src/arvgcswissknife.h | 5 +-
src/arvtool.c | 17 +-
tests/arvgenicamtest.c | 2 +-
tests/arvheartbeattest.c | 2 +-
tests/arvtest.c | 2 +-
tests/fake.c | 2 +-
tests/genicam.c | 14 +-
41 files changed, 885 insertions(+), 694 deletions(-)
---
diff --git a/src/arvcamera.c b/src/arvcamera.c
index 782e369..aa9c898 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -347,7 +347,7 @@ arv_camera_get_pixel_format (ArvCamera *camera)
gint64 *
arv_camera_get_available_pixel_formats (ArvCamera *camera, guint *n_pixel_formats)
{
- ArvGcFeatureNode *enumeration;
+ ArvGcNode *enumeration;
g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
diff --git a/src/arvdevice.c b/src/arvdevice.c
index 9cd6b9f..e418f9c 100644
--- a/src/arvdevice.c
+++ b/src/arvdevice.c
@@ -150,7 +150,7 @@ void
arv_device_execute_command (ArvDevice *device, const char *feature)
{
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
genicam = arv_device_get_genicam (device);
g_return_if_fail (ARV_IS_GC (genicam));
@@ -168,7 +168,7 @@ arv_device_execute_command (ArvDevice *device, const char *feature)
* Return value: (transfer none): the genicam node corresponding to the feature name, NULL if not found.
*/
-ArvGcFeatureNode *
+ArvGcNode *
arv_device_get_feature (ArvDevice *device, const char *feature)
{
ArvGc *genicam;
@@ -182,7 +182,7 @@ arv_device_get_feature (ArvDevice *device, const char *feature)
void
arv_device_set_string_feature_value (ArvDevice *device, const char *feature, const char *value)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -195,7 +195,7 @@ arv_device_set_string_feature_value (ArvDevice *device, const char *feature, con
const char *
arv_device_get_string_feature_value (ArvDevice *device, const char *feature)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -210,7 +210,7 @@ arv_device_get_string_feature_value (ArvDevice *device, const char *feature)
void
arv_device_set_integer_feature_value (ArvDevice *device, const char *feature, gint64 value)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -225,7 +225,7 @@ arv_device_set_integer_feature_value (ArvDevice *device, const char *feature, gi
gint64
arv_device_get_integer_feature_value (ArvDevice *device, const char *feature)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -242,7 +242,7 @@ arv_device_get_integer_feature_value (ArvDevice *device, const char *feature)
void
arv_device_get_integer_feature_bounds (ArvDevice *device, const char *feature, gint64 *min, gint64 *max)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -258,7 +258,7 @@ arv_device_get_integer_feature_bounds (ArvDevice *device, const char *feature, g
void
arv_device_set_float_feature_value (ArvDevice *device, const char *feature, double value)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -269,7 +269,7 @@ arv_device_set_float_feature_value (ArvDevice *device, const char *feature, doub
double
arv_device_get_float_feature_value (ArvDevice *device, const char *feature)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
@@ -282,7 +282,7 @@ arv_device_get_float_feature_value (ArvDevice *device, const char *feature)
void
arv_device_get_float_feature_bounds (ArvDevice *device, const char *feature, double *min, double *max)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_device_get_feature (device, feature);
diff --git a/src/arvdevice.h b/src/arvdevice.h
index ebb628e..02560eb 100644
--- a/src/arvdevice.h
+++ b/src/arvdevice.h
@@ -73,7 +73,7 @@ ArvGc * arv_device_get_genicam (ArvDevice *device);
void arv_device_execute_command (ArvDevice *device, const char *feature);
-ArvGcFeatureNode * arv_device_get_feature (ArvDevice *device, const char *feature);
+ArvGcNode * arv_device_get_feature (ArvDevice *device, const char *feature);
void arv_device_set_string_feature_value (ArvDevice *device, const char *feature, const char *value);
const char * arv_device_get_string_feature_value (ArvDevice *device, const char *feature);
diff --git a/src/arvgc.c b/src/arvgc.c
index 891db77..79e3978 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -65,7 +65,7 @@ arv_gc_can_append_child (ArvDomNode *self, ArvDomNode *child)
static ArvDomElement *
arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
{
- ArvDomNode *node = NULL;
+ ArvGcNode *node = NULL;
if (strcmp (tag_name, "Category") == 0)
node = arv_gc_category_new ();
@@ -101,6 +101,12 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
node = arv_gc_port_new ();
else if (strcmp (tag_name, "RegisterDescription") == 0)
node = arv_gc_register_description_node_new ();
+ else if (strcmp (tag_name, "pFeature") == 0)
+ node = arv_gc_property_node_new_p_feature ();
+ else if (strcmp (tag_name, "Value") == 0)
+ node = arv_gc_property_node_new_value ();
+ else if (strcmp (tag_name, "pValue") == 0)
+ node = arv_gc_property_node_new_p_value ();
else if (strcmp (tag_name, "Description") == 0)
node = arv_gc_property_node_new_description ();
else if (strcmp (tag_name, "Tooltip") == 0)
@@ -117,6 +123,196 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
return ARV_DOM_ELEMENT (node);
}
+/* ArvGc implementation */
+
+/**
+ * arv_gc_get_node:
+ * @genicam: a #ArvGc object
+ * @name: node name
+ * Return value: (transfer none): a #ArvGcNode, null if not found.
+ *
+ * Retrieves a genicam node by name.
+ */
+
+ArvGcNode *
+arv_gc_get_node (ArvGc *genicam, const char *name)
+{
+ g_return_val_if_fail (ARV_IS_GC (genicam), NULL);
+
+ return g_hash_table_lookup (genicam->nodes, name);
+}
+
+/**
+ * arv_gc_get_device:
+ * @genicam: a #ArvGc object
+ * Return value: (transfer none): a #ArvDevice.
+ *
+ * Retrieves the device handled by this genicam interface. The device is used for register access.
+ */
+
+ArvDevice *
+arv_gc_get_device (ArvGc *genicam)
+{
+ g_return_val_if_fail (ARV_IS_GC (genicam), NULL);
+
+ return genicam->device;
+}
+
+gint64
+arv_gc_get_int64_from_value (ArvGc *genicam, GValue *value)
+{
+ g_return_val_if_fail (ARV_IS_GC (genicam), 0);
+ g_return_val_if_fail (G_IS_VALUE (value), 0);
+
+ if (G_VALUE_HOLDS_INT64 (value))
+ return g_value_get_int64 (value);
+ else if (G_VALUE_HOLDS_STRING (value)) {
+ ArvGcNode *node;
+
+ node = arv_gc_get_node (genicam, g_value_get_string (value));
+ if (ARV_IS_GC_INTEGER (node))
+ return arv_gc_integer_get_value (ARV_GC_INTEGER (node));
+ else
+ arv_warning_genicam ("[Gc::set_int64_to_value] Invalid node '%s'",
+ arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (node)));
+ }
+
+ return 0;
+}
+
+void
+arv_gc_set_int64_to_value (ArvGc *genicam, GValue *value, gint64 v_int64)
+{
+ g_return_if_fail (ARV_IS_GC (genicam));
+ g_return_if_fail (G_IS_VALUE (value));
+
+ if (G_VALUE_HOLDS_INT64 (value))
+ return g_value_set_int64 (value, v_int64);
+ else if (G_VALUE_HOLDS_STRING (value)) {
+ ArvGcNode *node;
+
+ node = arv_gc_get_node (genicam, g_value_get_string (value));
+ if (ARV_IS_GC_INTEGER (node))
+ arv_gc_integer_set_value (ARV_GC_INTEGER (node), v_int64);
+ else
+ arv_warning_genicam ("[Gc::set_int64_to_value] Invalid node '%s'",
+ arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (node)));
+ }
+}
+
+double
+arv_gc_get_double_from_value (ArvGc *genicam, GValue *value)
+{
+ g_return_val_if_fail (ARV_IS_GC (genicam), 0);
+ g_return_val_if_fail (G_IS_VALUE (value), 0);
+
+ if (G_VALUE_HOLDS_DOUBLE (value))
+ return g_value_get_double (value);
+ else if (G_VALUE_HOLDS_STRING (value)) {
+ ArvGcNode *node;
+
+ node = arv_gc_get_node (genicam, g_value_get_string (value));
+ if (ARV_IS_GC_FLOAT (node))
+ return arv_gc_float_get_value (ARV_GC_FLOAT (node));
+ else
+ arv_warning_genicam ("[Gc::set_double_to_value] Invalid node '%s'",
+ arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (node)));
+ }
+
+ return 0.0;
+}
+
+void
+arv_gc_set_double_to_value (ArvGc *genicam, GValue *value, double v_double)
+{
+ g_return_if_fail (ARV_IS_GC (genicam));
+ g_return_if_fail (G_IS_VALUE (value));
+
+ if (G_VALUE_HOLDS_DOUBLE (value))
+ return g_value_set_double (value, v_double);
+ else if (G_VALUE_HOLDS_STRING (value)) {
+ ArvGcNode *node;
+
+ node = arv_gc_get_node (genicam, g_value_get_string (value));
+ if (ARV_IS_GC_FLOAT (node))
+ arv_gc_float_set_value (ARV_GC_FLOAT (node), v_double);
+ else
+ arv_warning_genicam ("[Gc::set_double_to_value] Invalid node '%s'",
+ arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (node)));
+ }
+}
+
+void
+arv_gc_register_feature_node (ArvGc *genicam, ArvGcFeatureNode *node)
+{
+ const char *name;
+
+ g_return_if_fail (ARV_IS_GC (genicam));
+ g_return_if_fail (ARV_IS_GC_FEATURE_NODE (node));
+
+
+ name = arv_gc_feature_node_get_name (node);
+ if (name == NULL)
+ return;
+
+ g_object_ref (node);
+
+ g_hash_table_remove (genicam->nodes, (char *) name);
+ g_hash_table_insert (genicam->nodes, (char *) name, node);
+
+ arv_log_genicam ("[Gc::register_feature_node] Register node '%s'", name);
+}
+
+ArvGc *
+arv_gc_new (ArvDevice *device, const void *xml, size_t size)
+{
+ ArvDomDocument *document;
+ ArvGc *genicam;
+
+ document = arv_dom_document_new_from_memory (xml, size, NULL);
+ if (!ARV_IS_GC (document)) {
+ if (document != NULL)
+ g_object_unref (document);
+ return NULL;
+ }
+
+ genicam = ARV_GC (document);
+ genicam->device = device;
+
+ return genicam;
+}
+
+static void
+arv_gc_init (ArvGc *genicam)
+{
+ genicam->nodes = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
+}
+
+static void
+arv_gc_finalize (GObject *object)
+{
+ ArvGc *genicam = ARV_GC (object);
+
+ g_hash_table_unref (genicam->nodes);
+
+ parent_class->finalize (object);
+}
+
+static void
+arv_gc_class_init (ArvGcClass *node_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (node_class);
+ ArvDomNodeClass *d_node_class = ARV_DOM_NODE_CLASS (node_class);
+ ArvDomDocumentClass *d_document_class = ARV_DOM_DOCUMENT_CLASS (node_class);
+
+ parent_class = g_type_class_peek_parent (node_class);
+
+ object_class->finalize = arv_gc_finalize;
+ d_node_class->can_append_child = arv_gc_can_append_child;
+ d_document_class->create_element = arv_gc_create_element;
+}
+
+G_DEFINE_TYPE (ArvGc, arv_gc, ARV_TYPE_DOM_DOCUMENT)
#if 0
static ArvGcFeatureNode *
arv_gc_create_node (ArvGc *genicam, const char *type)
@@ -363,173 +559,3 @@ arv_gc_parse_xml (ArvGc *genicam, const char *xml, size_t size)
xmlSAXUserParseMemory (&sax_handler, &state, xml, size);
}
#endif
-
-/* ArvGc implementation */
-
-/**
- * arv_gc_get_node:
- * @genicam: a #ArvGc object
- * @name: node name
- * Return value: (transfer none): a #ArvGcFeatureNode, null if not found.
- *
- * Retrieves a genicam node by name.
- */
-
-ArvGcFeatureNode *
-arv_gc_get_node (ArvGc *genicam, const char *name)
-{
- g_return_val_if_fail (ARV_IS_GC (genicam), NULL);
-
- return g_hash_table_lookup (genicam->nodes, name);
-}
-
-/**
- * arv_gc_get_device:
- * @genicam: a #ArvGc object
- * Return value: (transfer none): a #ArvDevice.
- *
- * Retrieves the device handled by this genicam interface. The device is used for register access.
- */
-
-ArvDevice *
-arv_gc_get_device (ArvGc *genicam)
-{
- g_return_val_if_fail (ARV_IS_GC (genicam), NULL);
-
- return genicam->device;
-}
-
-gint64
-arv_gc_get_int64_from_value (ArvGc *genicam, GValue *value)
-{
- g_return_val_if_fail (ARV_IS_GC (genicam), 0);
- g_return_val_if_fail (G_IS_VALUE (value), 0);
-
- if (G_VALUE_HOLDS_INT64 (value))
- return g_value_get_int64 (value);
- else if (G_VALUE_HOLDS_STRING (value)) {
- ArvGcFeatureNode *node;
-
- node = arv_gc_get_node (genicam, g_value_get_string (value));
- if (ARV_IS_GC_INTEGER (node))
- return arv_gc_integer_get_value (ARV_GC_INTEGER (node));
- else
- arv_warning_genicam ("[Gc::set_int64_to_value] Invalid node '%s'",
- arv_gc_feature_node_get_name (node));
- }
-
- return 0;
-}
-
-void
-arv_gc_set_int64_to_value (ArvGc *genicam, GValue *value, gint64 v_int64)
-{
- g_return_if_fail (ARV_IS_GC (genicam));
- g_return_if_fail (G_IS_VALUE (value));
-
- if (G_VALUE_HOLDS_INT64 (value))
- return g_value_set_int64 (value, v_int64);
- else if (G_VALUE_HOLDS_STRING (value)) {
- ArvGcFeatureNode *node;
-
- node = arv_gc_get_node (genicam, g_value_get_string (value));
- if (ARV_IS_GC_INTEGER (node))
- arv_gc_integer_set_value (ARV_GC_INTEGER (node), v_int64);
- else
- arv_warning_genicam ("[Gc::set_int64_to_value] Invalid node '%s'",
- arv_gc_feature_node_get_name (node));
- }
-}
-
-double
-arv_gc_get_double_from_value (ArvGc *genicam, GValue *value)
-{
- g_return_val_if_fail (ARV_IS_GC (genicam), 0);
- g_return_val_if_fail (G_IS_VALUE (value), 0);
-
- if (G_VALUE_HOLDS_DOUBLE (value))
- return g_value_get_double (value);
- else if (G_VALUE_HOLDS_STRING (value)) {
- ArvGcFeatureNode *node;
-
- node = arv_gc_get_node (genicam, g_value_get_string (value));
- if (ARV_IS_GC_FLOAT (node))
- return arv_gc_float_get_value (ARV_GC_FLOAT (node));
- else
- arv_warning_genicam ("[Gc::set_double_to_value] Invalid node '%s'",
- arv_gc_feature_node_get_name (node));
- }
-
- return 0.0;
-}
-
-void
-arv_gc_set_double_to_value (ArvGc *genicam, GValue *value, double v_double)
-{
- g_return_if_fail (ARV_IS_GC (genicam));
- g_return_if_fail (G_IS_VALUE (value));
-
- if (G_VALUE_HOLDS_DOUBLE (value))
- return g_value_set_double (value, v_double);
- else if (G_VALUE_HOLDS_STRING (value)) {
- ArvGcFeatureNode *node;
-
- node = arv_gc_get_node (genicam, g_value_get_string (value));
- if (ARV_IS_GC_FLOAT (node))
- arv_gc_float_set_value (ARV_GC_FLOAT (node), v_double);
- else
- arv_warning_genicam ("[Gc::set_double_to_value] Invalid node '%s'",
- arv_gc_feature_node_get_name (node));
- }
-}
-
-ArvGc *
-arv_gc_new (ArvDevice *device, const void *xml, size_t size)
-{
- ArvDomDocument *document;
- ArvGc *genicam;
-
- document = arv_dom_document_new_from_memory (xml, size, NULL);
- if (!ARV_IS_GC (document)) {
- if (document != NULL)
- g_object_unref (document);
- return NULL;
- }
-
- genicam = ARV_GC (document);
- genicam->device = device;
-
- return genicam;
-}
-
-static void
-arv_gc_init (ArvGc *genicam)
-{
- genicam->nodes = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
-}
-
-static void
-arv_gc_finalize (GObject *object)
-{
- ArvGc *genicam = ARV_GC (object);
-
- g_hash_table_unref (genicam->nodes);
-
- parent_class->finalize (object);
-}
-
-static void
-arv_gc_class_init (ArvGcClass *node_class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (node_class);
- ArvDomNodeClass *d_node_class = ARV_DOM_NODE_CLASS (node_class);
- ArvDomDocumentClass *d_document_class = ARV_DOM_DOCUMENT_CLASS (node_class);
-
- parent_class = g_type_class_peek_parent (node_class);
-
- object_class->finalize = arv_gc_finalize;
- d_node_class->can_append_child = arv_gc_can_append_child;
- d_document_class->create_element = arv_gc_create_element;
-}
-
-G_DEFINE_TYPE (ArvGc, arv_gc, ARV_TYPE_DOM_DOCUMENT)
diff --git a/src/arvgc.h b/src/arvgc.h
index 0d05950..2b34bb9 100644
--- a/src/arvgc.h
+++ b/src/arvgc.h
@@ -51,12 +51,12 @@ struct _ArvGcClass {
GType arv_gc_get_type (void);
ArvGc * arv_gc_new (ArvDevice *device, const void *xml, size_t size);
-
+void arv_gc_register_feature_node (ArvGc *genicam, ArvGcFeatureNode *node);
gint64 arv_gc_get_int64_from_value (ArvGc *genicam, GValue *value);
void arv_gc_set_int64_to_value (ArvGc *genicam, GValue *value, gint64 v_int64);
double arv_gc_get_double_from_value (ArvGc *genicam, GValue *value);
void arv_gc_set_double_to_value (ArvGc *genicam, GValue *value, double v_double);
-ArvGcFeatureNode * arv_gc_get_node (ArvGc *genicam, const char *name);
+ArvGcNode * arv_gc_get_node (ArvGc *genicam, const char *name);
ArvDevice * arv_gc_get_device (ArvGc *genicam);
G_END_DECLS
diff --git a/src/arvgcboolean.c b/src/arvgcboolean.c
index 0f3c037..2f986c2 100644
--- a/src/arvgcboolean.c
+++ b/src/arvgcboolean.c
@@ -1,6 +1,6 @@
/* Aravis - Digital camera library
*
- * Copyright  2009-2010 Emmanuel Pacaud
+ * 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
@@ -40,27 +40,43 @@ arv_gc_boolean_get_node_name (ArvDomNode *node)
return "Boolean";
}
-/* ArvGcFeatureNode implementation */
+/* ArvDomElement implementation */
static void
-arv_gc_boolean_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
+arv_gc_boolean_post_new_child (ArvDomNode *self, ArvDomNode *child)
{
- ArvGcBoolean *gc_boolean = ARV_GC_BOOLEAN (node);
-
- if (strcmp (name, "Value") == 0) {
- arv_force_g_value_to_int64 (&gc_boolean->value,
- g_ascii_strtoll (content, NULL, 0));
- } else if (strcmp (name, "pValue") == 0) {
- arv_force_g_value_to_string (&gc_boolean->value, content);
- } else if (strcmp (name, "OnValue") == 0) {
- gc_boolean->on_value = g_ascii_strtoll (content, NULL, 0);
- } else if (strcmp (name, "OffValue") == 0) {
- gc_boolean->off_value = g_ascii_strtoll (content, NULL, 0);
- } else
- ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
+ ArvGcBoolean *node = ARV_GC_BOOLEAN (self);
+
+ if (ARV_IS_GC_PROPERTY_NODE (child)) {
+ ArvGcPropertyNode *property_node = ARV_GC_PROPERTY_NODE (child);
+
+ switch (arv_gc_property_node_get_node_type (property_node)) {
+ case ARV_GC_PROPERTY_NODE_TYPE_VALUE:
+ case ARV_GC_PROPERTY_NODE_TYPE_P_VALUE:
+ node->value = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_ON_VALUE:
+ node->on_value = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_OFF_VALUE:
+ node->off_value = property_node;
+ break;
+ default:
+ ARV_DOM_NODE_CLASS (parent_class)->post_new_child (self, child);
+ break;
+ }
+ }
}
static void
+arv_gc_boolean_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
+{
+ g_assert_not_reached ();
+}
+
+/* ArvGcBoolean implementation */
+
+static void
arv_gc_boolean_set_value_from_string (ArvGcFeatureNode *node, const char *string)
{
arv_gc_boolean_set_value (ARV_GC_BOOLEAN (node), g_strcmp0 (string, "true") == 0);
@@ -74,13 +90,33 @@ arv_gc_boolean_get_value_as_string (ArvGcFeatureNode *node)
/* ArvGcBoolean implementation */
+static gint64
+arv_gc_boolean_get_on_value (ArvGcBoolean *gc_boolean)
+{
+ if (gc_boolean->on_value != NULL)
+ return arv_gc_property_node_get_int64 (gc_boolean->on_value);
+
+ return 1;
+}
+
+static gint64
+arv_gc_boolean_get_off_value (ArvGcBoolean *gc_boolean)
+{
+ if (gc_boolean->off_value != NULL)
+ return arv_gc_property_node_get_int64 (gc_boolean->off_value);
+
+ return 0;
+}
+
gboolean
arv_gc_boolean_get_value (ArvGcBoolean *gc_boolean)
{
g_return_val_if_fail (ARV_IS_GC_BOOLEAN (gc_boolean), FALSE);
- return arv_gc_get_int64_from_value (arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_boolean)),
- &gc_boolean->value) == gc_boolean->on_value;
+ if (gc_boolean->value != NULL)
+ return arv_gc_property_node_get_int64 (gc_boolean->value) == arv_gc_boolean_get_on_value (gc_boolean);
+
+ return FALSE;
}
void
@@ -88,15 +124,17 @@ arv_gc_boolean_set_value (ArvGcBoolean *gc_boolean, gboolean v_boolean)
{
g_return_if_fail (ARV_IS_GC_BOOLEAN (gc_boolean));
- arv_gc_set_int64_to_value (arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_boolean)),
- &gc_boolean->value,
- v_boolean ? gc_boolean->on_value : gc_boolean->off_value);
+ if (gc_boolean->value != NULL)
+ arv_gc_property_node_set_int64 (gc_boolean->value,
+ v_boolean ?
+ arv_gc_boolean_get_on_value (gc_boolean) :
+ arv_gc_boolean_get_off_value (gc_boolean));
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_boolean_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_BOOLEAN, NULL);
@@ -106,19 +144,11 @@ arv_gc_boolean_new (void)
static void
arv_gc_boolean_init (ArvGcBoolean *gc_boolean)
{
- g_value_init (&gc_boolean->value, G_TYPE_INT64);
- g_value_set_int64 (&gc_boolean->value, 0);
- gc_boolean->on_value = 1;
- gc_boolean->off_value = 0;
}
static void
arv_gc_boolean_finalize (GObject *object)
{
- ArvGcBoolean *gc_boolean = ARV_GC_BOOLEAN (object);
-
- g_value_unset (&gc_boolean->value);
-
parent_class->finalize (object);
}
@@ -133,7 +163,8 @@ arv_gc_boolean_class_init (ArvGcBooleanClass *this_class)
object_class->finalize = arv_gc_boolean_finalize;
dom_node_class->get_node_name = arv_gc_boolean_get_node_name;
- gc_feature_node_class->add_element = arv_gc_boolean_add_element;
+ dom_node_class->post_new_child = arv_gc_boolean_post_new_child;
+ dom_node_class->pre_remove_child = arv_gc_boolean_pre_remove_child;
gc_feature_node_class->set_value_from_string = arv_gc_boolean_set_value_from_string;
gc_feature_node_class->get_value_as_string = arv_gc_boolean_get_value_as_string;
}
diff --git a/src/arvgcboolean.h b/src/arvgcboolean.h
index 5f3666c..d5f3893 100644
--- a/src/arvgcboolean.h
+++ b/src/arvgcboolean.h
@@ -25,6 +25,7 @@
#include <arvtypes.h>
#include <arvgcfeaturenode.h>
+#include <arvgcpropertynode.h>
G_BEGIN_DECLS
@@ -40,9 +41,9 @@ typedef struct _ArvGcBooleanClass ArvGcBooleanClass;
struct _ArvGcBoolean {
ArvGcFeatureNode node;
- GValue value;
- gint64 on_value;
- gint64 off_value;
+ ArvGcPropertyNode *value;
+ ArvGcPropertyNode *on_value;
+ ArvGcPropertyNode *off_value;
};
struct _ArvGcBooleanClass {
@@ -50,8 +51,7 @@ struct _ArvGcBooleanClass {
};
GType arv_gc_boolean_get_type (void);
-
-ArvGcFeatureNode * arv_gc_boolean_new (void);
+ArvGcNode * arv_gc_boolean_new (void);
gboolean arv_gc_boolean_get_value (ArvGcBoolean *gc_boolean);
void arv_gc_boolean_set_value (ArvGcBoolean *gc_boolean, gboolean v_boolean);
diff --git a/src/arvgccategory.c b/src/arvgccategory.c
index 1431ae4..b539149 100644
--- a/src/arvgccategory.c
+++ b/src/arvgccategory.c
@@ -43,7 +43,8 @@ arv_gc_category_get_node_name (ArvDomNode *node)
static gboolean
arv_gc_category_can_append_child (ArvDomNode *parent, ArvDomNode *child)
{
- return ARV_IS_GC_PROPERTY_NODE (child);
+ return ARV_IS_GC_PROPERTY_NODE (child) &&
+ arv_gc_property_node_get_node_type (ARV_GC_PROPERTY_NODE (child)) == ARV_GC_PROPERTY_NODE_TYPE_P_FEATURE;
}
/* ArvGcCategory implementation */
@@ -80,17 +81,16 @@ arv_gc_category_get_features (ArvGcCategory *category)
for (iter = arv_dom_node_get_first_child (ARV_DOM_NODE (category));
iter != NULL;
iter = arv_dom_node_get_next_sibling (iter))
- if (g_strcmp0 (arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (iter)), "pFeature") == 0)
- category->features = g_slist_append (category->features,
- g_strdup (arv_gc_property_node_get_content (ARV_GC_PROPERTY_NODE (iter))));
+ category->features = g_slist_append (category->features,
+ g_strdup (arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (iter))));
return category->features;
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_category_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_CATEGORY, NULL);
diff --git a/src/arvgccategory.h b/src/arvgccategory.h
index 5017b84..e64ab32 100644
--- a/src/arvgccategory.h
+++ b/src/arvgccategory.h
@@ -38,7 +38,7 @@ G_BEGIN_DECLS
typedef struct _ArvGcCategoryClass ArvGcCategoryClass;
struct _ArvGcCategory {
- ArvGcFeatureNode node;
+ ArvGcFeatureNode base;
GSList *features;
};
@@ -48,8 +48,7 @@ struct _ArvGcCategoryClass {
};
GType arv_gc_category_get_type (void);
-
-ArvGcFeatureNode * arv_gc_category_new (void);
+ArvGcNode * arv_gc_category_new (void);
const GSList * arv_gc_category_get_features (ArvGcCategory *category);
G_END_DECLS
diff --git a/src/arvgccommand.c b/src/arvgccommand.c
index eba47a3..4ea0358 100644
--- a/src/arvgccommand.c
+++ b/src/arvgccommand.c
@@ -46,6 +46,7 @@ arv_gc_command_get_node_name (ArvDomNode *node)
/* ArvGcFeatureNode implementation */
+#if 0
static void
arv_gc_command_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
{
@@ -62,6 +63,7 @@ arv_gc_command_add_element (ArvGcFeatureNode *node, const char *name, const char
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
/* ArvGcCommand implementation */
@@ -72,7 +74,7 @@ arv_gc_command_execute (ArvGcCommand *gc_command)
gint64 command_value;
g_return_if_fail (ARV_IS_GC_COMMAND (gc_command));
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_command));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_command));
g_return_if_fail (ARV_IS_GC (genicam));
command_value = arv_gc_get_int64_from_value (genicam, &gc_command->command_value);
@@ -83,10 +85,10 @@ arv_gc_command_execute (ArvGcCommand *gc_command)
command_value);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_command_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_COMMAND, NULL);
@@ -119,13 +121,13 @@ arv_gc_command_class_init (ArvGcCommandClass *this_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (this_class);
ArvDomNodeClass *dom_node_class = ARV_DOM_NODE_CLASS (this_class);
- ArvGcFeatureNodeClass *gc_feature_node_class = ARV_GC_FEATURE_NODE_CLASS (this_class);
+/* ArvGcFeatureNodeClass *gc_feature_node_class = ARV_GC_FEATURE_NODE_CLASS (this_class);*/
parent_class = g_type_class_peek_parent (this_class);
object_class->finalize = arv_gc_command_finalize;
dom_node_class->get_node_name = arv_gc_command_get_node_name;
- gc_feature_node_class->add_element = arv_gc_command_add_element;
+/* gc_feature_node_class->add_element = arv_gc_command_add_element;*/
}
G_DEFINE_TYPE (ArvGcCommand, arv_gc_command, ARV_TYPE_GC_FEATURE_NODE)
diff --git a/src/arvgccommand.h b/src/arvgccommand.h
index 6b2e729..b84202b 100644
--- a/src/arvgccommand.h
+++ b/src/arvgccommand.h
@@ -49,7 +49,7 @@ struct _ArvGcCommandClass {
};
GType arv_gc_command_get_type (void);
-ArvGcFeatureNode * arv_gc_command_new (void);
+ArvGcNode * arv_gc_command_new (void);
void arv_gc_command_execute (ArvGcCommand *gc_command);
G_END_DECLS
diff --git a/src/arvgcconverter.c b/src/arvgcconverter.c
index 538b4ea..fba4348 100644
--- a/src/arvgcconverter.c
+++ b/src/arvgcconverter.c
@@ -57,6 +57,7 @@ arv_gc_converter_get_node_name (ArvDomNode *node)
/* ArvGcFeatureNode implementation */
+#if 0
static void
arv_gc_converter_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
{
@@ -98,6 +99,7 @@ arv_gc_converter_add_element (ArvGcFeatureNode *node, const char *name, const ch
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
/* ArvGcConverter implementation */
@@ -109,7 +111,7 @@ arv_gc_converter_node_get_value_type (ArvGcFeatureNode *node)
return gc_converter->value_type;
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_converter_new (void)
{
ArvGcConverter *converter;
@@ -117,10 +119,10 @@ arv_gc_converter_new (void)
converter = g_object_new (ARV_TYPE_GC_CONVERTER, NULL);
converter->value_type = G_TYPE_DOUBLE;
- return ARV_GC_FEATURE_NODE (converter);
+ return ARV_GC_NODE (converter);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_converter_new_integer (void)
{
ArvGcConverter *converter;
@@ -128,7 +130,7 @@ arv_gc_converter_new_integer (void)
converter = g_object_new (ARV_TYPE_GC_CONVERTER, NULL);
converter->value_type = G_TYPE_INT64;
- return ARV_GC_FEATURE_NODE (converter);
+ return ARV_GC_NODE (converter);
}
static void
@@ -173,7 +175,7 @@ arv_gc_converter_class_init (ArvGcConverterClass *this_class)
object_class->finalize = arv_gc_converter_finalize;
dom_node_class->get_node_name = arv_gc_converter_get_node_name;
- gc_feature_node_class->add_element = arv_gc_converter_add_element;
+/* gc_feature_node_class->add_element = arv_gc_converter_add_element;*/
gc_feature_node_class->get_value_type = arv_gc_converter_node_get_value_type;
}
@@ -183,31 +185,31 @@ static void
_update_from_variables (ArvGcConverter *gc_converter)
{
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
GSList *iter;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_converter));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_converter));
for (iter = gc_converter->variables; iter != NULL; iter = iter->next) {
ArvGcConverterVariableInfos *variable_infos = iter->data;
node = arv_gc_get_node (genicam, variable_infos->node_name);
- if (arv_gc_feature_node_get_value_type (node) == G_TYPE_INT64)
+ if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_INT64)
arv_evaluator_set_int64_variable (gc_converter->formula_from,
variable_infos->name,
arv_gc_integer_get_value (ARV_GC_INTEGER (node)));
- else if (arv_gc_feature_node_get_value_type (node) == G_TYPE_DOUBLE)
+ else if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_DOUBLE)
arv_evaluator_set_double_variable (gc_converter->formula_from,
variable_infos->name,
arv_gc_float_get_value (ARV_GC_FLOAT (node)));
}
node = arv_gc_get_node (genicam, gc_converter->value);
- if (arv_gc_feature_node_get_value_type (node) == G_TYPE_INT64)
+ if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_INT64)
arv_evaluator_set_int64_variable (gc_converter->formula_from,
"TO",
arv_gc_integer_get_value (ARV_GC_INTEGER (node)));
- else if (arv_gc_feature_node_get_value_type (node) == G_TYPE_DOUBLE)
+ else if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_DOUBLE)
arv_evaluator_set_double_variable (gc_converter->formula_from,
"TO",
arv_gc_float_get_value (ARV_GC_FLOAT (node)));
@@ -217,30 +219,30 @@ static void
_update_to_variables (ArvGcConverter *gc_converter)
{
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
GSList *iter;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_converter));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_converter));
for (iter = gc_converter->variables; iter != NULL; iter = iter->next) {
ArvGcConverterVariableInfos *variable_infos = iter->data;
node = arv_gc_get_node (genicam, variable_infos->node_name);
- if (arv_gc_feature_node_get_value_type (node) == G_TYPE_INT64)
+ if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_INT64)
arv_evaluator_set_int64_variable (gc_converter->formula_to,
variable_infos->name,
arv_gc_integer_get_value (ARV_GC_INTEGER (node)));
- else if (arv_gc_feature_node_get_value_type (node) == G_TYPE_DOUBLE)
+ else if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_DOUBLE)
arv_evaluator_set_double_variable (gc_converter->formula_to,
variable_infos->name,
arv_gc_float_get_value (ARV_GC_FLOAT (node)));
}
node = arv_gc_get_node (genicam, gc_converter->value);
- if (arv_gc_feature_node_get_value_type (node) == G_TYPE_INT64)
+ if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_INT64)
arv_gc_integer_set_value (ARV_GC_INTEGER (node),
arv_evaluator_evaluate_as_int64 (gc_converter->formula_to, NULL));
- else if (arv_gc_feature_node_get_value_type (node) == G_TYPE_DOUBLE)
+ else if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_DOUBLE)
arv_gc_float_set_value (ARV_GC_FLOAT (node),
arv_evaluator_evaluate_as_double (gc_converter->formula_to, NULL));
else
diff --git a/src/arvgcconverter.h b/src/arvgcconverter.h
index 951ee0d..e52a183 100644
--- a/src/arvgcconverter.h
+++ b/src/arvgcconverter.h
@@ -52,9 +52,8 @@ struct _ArvGcConverterClass {
};
GType arv_gc_converter_get_type (void);
-
-ArvGcFeatureNode * arv_gc_converter_new (void);
-ArvGcFeatureNode * arv_gc_converter_new_integer (void);
+ArvGcNode * arv_gc_converter_new (void);
+ArvGcNode * arv_gc_converter_new_integer (void);
G_END_DECLS
diff --git a/src/arvgcenumentry.c b/src/arvgcenumentry.c
index 1908c8a..9dee4c4 100644
--- a/src/arvgcenumentry.c
+++ b/src/arvgcenumentry.c
@@ -41,6 +41,7 @@ arv_gc_enum_entry_get_node_name (ArvDomNode *node)
/* ArvGcFeatureNode implementation */
+#if 0
static void
arv_gc_enum_entry_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
{
@@ -51,6 +52,7 @@ arv_gc_enum_entry_add_element (ArvGcFeatureNode *node, const char *name, const c
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
/* ArvGcEnumEntry implementation */
@@ -62,10 +64,10 @@ arv_gc_enum_entry_get_value (ArvGcEnumEntry *entry)
return entry->value;
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_enum_entry_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_ENUM_ENTRY, NULL);
@@ -91,13 +93,13 @@ arv_gc_enum_entry_class_init (ArvGcEnumEntryClass *this_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (this_class);
ArvDomNodeClass *dom_node_class = ARV_DOM_NODE_CLASS (this_class);
- ArvGcFeatureNodeClass *gc_feature_node_class = ARV_GC_FEATURE_NODE_CLASS (this_class);
+/* ArvGcFeatureNodeClass *gc_feature_node_class = ARV_GC_FEATURE_NODE_CLASS (this_class);*/
parent_class = g_type_class_peek_parent (this_class);
object_class->finalize = arv_gc_enum_entry_finalize;
dom_node_class->get_node_name = arv_gc_enum_entry_get_node_name;
- gc_feature_node_class->add_element = arv_gc_enum_entry_add_element;
+/* gc_feature_node_class->add_element = arv_gc_enum_entry_add_element;*/
}
G_DEFINE_TYPE (ArvGcEnumEntry, arv_gc_enum_entry, ARV_TYPE_GC_FEATURE_NODE)
diff --git a/src/arvgcenumentry.h b/src/arvgcenumentry.h
index 215f92b..9c9d288 100644
--- a/src/arvgcenumentry.h
+++ b/src/arvgcenumentry.h
@@ -48,9 +48,8 @@ struct _ArvGcEnumEntryClass {
};
GType arv_gc_enum_entry_get_type (void);
-
-ArvGcFeatureNode * arv_gc_enum_entry_new (void);
-gint64 arv_gc_enum_entry_get_value (ArvGcEnumEntry *entry);
+ArvGcNode * arv_gc_enum_entry_new (void);
+gint64 arv_gc_enum_entry_get_value (ArvGcEnumEntry *entry);
G_END_DECLS
diff --git a/src/arvgcenumeration.c b/src/arvgcenumeration.c
index e2a7ddd..9730cbd 100644
--- a/src/arvgcenumeration.c
+++ b/src/arvgcenumeration.c
@@ -42,8 +42,9 @@ arv_gc_enumeration_get_node_name (ArvDomNode *node)
return "Enumeration";
}
+#if 0
static gboolean
-arv_gc_enumeration_can_add_child (ArvGcFeatureNode *node, ArvGcFeatureNode *child)
+arv_gc_enumeration_can_append_child (ArvGcFeatureNode *node, ArvGcFeatureNode *child)
{
if (ARV_IS_GC_ENUM_ENTRY (child))
return TRUE;
@@ -64,6 +65,7 @@ arv_gc_enumeration_add_element (ArvGcFeatureNode *node, const char *name, const
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
static void
arv_gc_enumeration_set_value_from_string (ArvGcFeatureNode *node, const char *string)
@@ -83,27 +85,29 @@ arv_gc_enumeration_get_value_as_string (ArvGcFeatureNode *node)
const char *
arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration)
{
- const GSList *iter;
- gint64 value;
+ g_assert_not_reached ();
- g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL);
+/* const GSList *iter;*/
+/* gint64 value;*/
- value = arv_gc_get_int64_from_value (arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (enumeration)),
- &enumeration->value);
+/* g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL);*/
- for (iter = arv_gc_feature_node_get_childs (ARV_GC_FEATURE_NODE (enumeration)); iter != NULL; iter = iter->next) {
- if (arv_gc_enum_entry_get_value (iter->data) == value) {
- const char *string;
+/* value = arv_gc_get_int64_from_value (arv_gc_node_get_genicam (ARV_GC_NODE (enumeration)),*/
+/* &enumeration->value);*/
- string = arv_gc_feature_node_get_name (iter->data);
- arv_log_genicam ("[GcEnumeration::get_string_value] value = %Ld - string = %s",
- value, string);
- return string;
- }
- }
+/* for (iter = arv_gc_feature_node_get_childs (ARV_GC_FEATURE_NODE (enumeration)); iter != NULL; iter = iter->next) {*/
+/* if (arv_gc_enum_entry_get_value (iter->data) == value) {*/
+/* const char *string;*/
+
+/* string = arv_gc_feature_node_get_name (iter->data);*/
+/* arv_log_genicam ("[GcEnumeration::get_string_value] value = %Ld - string = %s",*/
+/* value, string);*/
+/* return string;*/
+/* }*/
+/* }*/
- arv_warning_genicam ("[GcEnumeration::get_string_value] value = %Ld not found for node %s",
- value, arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (enumeration)));
+/* arv_warning_genicam ("[GcEnumeration::get_string_value] value = %Ld not found for node %s",*/
+/* value, arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (enumeration)));*/
return NULL;
}
@@ -111,21 +115,23 @@ arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration)
void
arv_gc_enumeration_set_string_value (ArvGcEnumeration *enumeration, const char *value)
{
- const GSList *iter;
+ g_assert_not_reached ();
- g_return_if_fail (ARV_IS_GC_ENUMERATION (enumeration));
+/* const GSList *iter;*/
- for (iter = arv_gc_feature_node_get_childs (ARV_GC_FEATURE_NODE (enumeration)); iter != NULL; iter = iter->next)
- if (g_strcmp0 (arv_gc_feature_node_get_name (iter->data), value) == 0) {
- arv_log_genicam ("[GcEnumeration::set_string_value] value = %d - string = %s",
- &enumeration->value, value);
- arv_gc_set_int64_to_value (arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (enumeration)),
- &enumeration->value,
- arv_gc_enum_entry_get_value (iter->data));
- return;
- }
+/* g_return_if_fail (ARV_IS_GC_ENUMERATION (enumeration));*/
- arv_warning_genicam ("[GcEnumeration::set_string_value] entry %s not found", value);
+/* for (iter = arv_gc_feature_node_get_childs (ARV_GC_FEATURE_NODE (enumeration)); iter != NULL; iter = iter->next)*/
+/* if (g_strcmp0 (arv_gc_feature_node_get_name (iter->data), value) == 0) {*/
+/* arv_log_genicam ("[GcEnumeration::set_string_value] value = %d - string = %s",*/
+/* &enumeration->value, value);*/
+/* arv_gc_set_int64_to_value (arv_gc_node_get_genicam (ARV_GC_NODE (enumeration)),*/
+/* &enumeration->value,*/
+/* arv_gc_enum_entry_get_value (iter->data));*/
+/* return;*/
+/* }*/
+
+/* arv_warning_genicam ("[GcEnumeration::set_string_value] entry %s not found", value);*/
}
gint64
@@ -133,7 +139,7 @@ arv_gc_enumeration_get_int_value (ArvGcEnumeration *enumeration)
{
g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), 0);
- return arv_gc_get_int64_from_value (arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (enumeration)),
+ return arv_gc_get_int64_from_value (arv_gc_node_get_genicam (ARV_GC_NODE (enumeration)),
&enumeration->value);
}
@@ -175,7 +181,7 @@ arv_gc_enumeration_set_int_value (ArvGcEnumeration *enumeration, gint64 value)
{
g_return_if_fail (ARV_IS_GC_ENUMERATION (enumeration));
- arv_gc_set_int64_to_value (arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (enumeration)),
+ arv_gc_set_int64_to_value (arv_gc_node_get_genicam (ARV_GC_NODE (enumeration)),
&enumeration->value, value);
}
@@ -189,15 +195,19 @@ arv_gc_enumeration_set_int_value (ArvGcEnumeration *enumeration, gint64 value)
const GSList *
arv_gc_enumeration_get_entries (ArvGcEnumeration *enumeration)
{
- g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL);
+ g_assert_not_reached ();
+
+ return NULL;
+
+/* g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL);*/
- return arv_gc_feature_node_get_childs (ARV_GC_FEATURE_NODE (enumeration));
+/* return arv_gc_feature_node_get_childs (ARV_GC_FEATURE_NODE (enumeration));*/
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_enumeration_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_ENUMERATION, NULL);
@@ -233,8 +243,8 @@ arv_gc_enumeration_class_init (ArvGcEnumerationClass *this_class)
object_class->finalize = arv_gc_enumeration_finalize;
dom_node_class->get_node_name = arv_gc_enumeration_get_node_name;
- gc_feature_node_class->add_element = arv_gc_enumeration_add_element;
- gc_feature_node_class->can_add_child = arv_gc_enumeration_can_add_child;
+/* gc_feature_node_class->add_element = arv_gc_enumeration_add_element;*/
+/* gc_feature_node_class->can_add_child = arv_gc_enumeration_can_add_child;*/
gc_feature_node_class->set_value_from_string = arv_gc_enumeration_set_value_from_string;
gc_feature_node_class->get_value_as_string = arv_gc_enumeration_get_value_as_string;
}
diff --git a/src/arvgcenumeration.h b/src/arvgcenumeration.h
index 29329db..7e351c5 100644
--- a/src/arvgcenumeration.h
+++ b/src/arvgcenumeration.h
@@ -48,15 +48,12 @@ struct _ArvGcEnumerationClass {
};
GType arv_gc_enumeration_get_type (void);
-
-ArvGcFeatureNode * arv_gc_enumeration_new (void);
-
+ArvGcNode * arv_gc_enumeration_new (void);
const char * arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration);
void arv_gc_enumeration_set_string_value (ArvGcEnumeration *enumeration, const char *value);
gint64 arv_gc_enumeration_get_int_value (ArvGcEnumeration *enumeration);
void arv_gc_enumeration_set_int_value (ArvGcEnumeration *enumeration, gint64 value);
const GSList * arv_gc_enumeration_get_entries (ArvGcEnumeration *enumeration);
-
gint64 * arv_gc_enumeration_get_available_int_values (ArvGcEnumeration *enumeration, guint *n_values);
G_END_DECLS
diff --git a/src/arvgcfeaturenode.c b/src/arvgcfeaturenode.c
index eeb19dd..c063e55 100644
--- a/src/arvgcfeaturenode.c
+++ b/src/arvgcfeaturenode.c
@@ -29,6 +29,7 @@
*/
#include <arvgcfeaturenode.h>
+#include <arvgcpropertynode.h>
#include <arvgc.h>
#include <arvmisc.h>
#include <arvdebug.h>
@@ -37,165 +38,174 @@
static GObjectClass *parent_class = NULL;
struct _ArvGcFeatureNodePrivate {
- ArvGc *genicam;
+
char *name;
ArvGcNameSpace name_space;
- char *tooltip;
- char *description;
- char *display_name;
-
- GValue is_implemented;
- GValue is_available;
- unsigned int n_childs;
- GSList *childs;
+ ArvGcPropertyNode *tooltip;
+ ArvGcPropertyNode *description;
+ ArvGcPropertyNode *display_name;
+ ArvGcPropertyNode *is_implemented;
+ ArvGcPropertyNode *is_available;
gint modification_count;
};
-const char *
-arv_gc_feature_node_get_name (ArvGcFeatureNode *node)
-{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
-
- return node->priv->name;
-}
+/* ArvDomNode implementation */
-const char *
-arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *node)
+static gboolean
+arv_gc_feature_node_can_append_child (ArvDomNode *self, ArvDomNode *child)
{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
-
- return node->priv->tooltip;
+ return ARV_IS_GC_NODE (child);
}
-const char *
-arv_gc_feature_node_get_description (ArvGcFeatureNode *node)
+static void
+arv_gc_feature_node_post_new_child (ArvDomNode *self, ArvDomNode *child)
{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
-
- return node->priv->description;
+ ArvGcFeatureNode *node = ARV_GC_FEATURE_NODE (self);
+
+ if (ARV_IS_GC_PROPERTY_NODE (child)) {
+ ArvGcPropertyNode *property_node = ARV_GC_PROPERTY_NODE (child);
+
+ switch (arv_gc_property_node_get_node_type (property_node)) {
+ case ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP:
+ node->priv->tooltip = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION:
+ node->priv->description = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME:
+ node->priv->display_name = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE:
+ node->priv->is_available = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED:
+ node->priv->is_implemented = property_node;
+ break;
+ default:
+ break;
+ }
+ }
}
-const char *
-arv_gc_feature_node_get_display_name (ArvGcFeatureNode *node)
+static void
+arv_gc_feature_node_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
-
- return node->priv->display_name;
+ ArvGcFeatureNode *node = ARV_GC_FEATURE_NODE (self);
+
+ if (ARV_IS_GC_PROPERTY_NODE (child)) {
+ ArvGcPropertyNode *property_node = ARV_GC_PROPERTY_NODE (child);
+
+ switch (arv_gc_property_node_get_node_type (property_node)) {
+ case ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP:
+ node->priv->tooltip = NULL;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION:
+ node->priv->description = NULL;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME:
+ node->priv->description = NULL;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE:
+ node->priv->is_available = NULL;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED:
+ node->priv->is_implemented = NULL;
+ break;
+ default:
+ break;
+ }
+ }
}
-gboolean
-arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node)
-{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
-
- return arv_gc_get_int64_from_value (gc_feature_node->priv->genicam, &gc_feature_node->priv->is_implemented) != 0 &&
- arv_gc_get_int64_from_value (gc_feature_node->priv->genicam, &gc_feature_node->priv->is_available) != 0;
-}
+/* ArvDomNode implementation */
static void
-_set_attribute (ArvGcFeatureNode *node, const char *name, const char *value)
+arv_gc_feature_node_set_attribute (ArvDomElement *self, const char *name, const char *value)
{
+ ArvGcFeatureNode *node = ARV_GC_FEATURE_NODE (self);
+
if (strcmp (name, "Name") == 0) {
+ ArvGc *genicam;
+
g_free (node->priv->name);
node->priv->name = g_strdup (value);
- } if (strcmp (name, "NameSpace") == 0) {
+
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (self));
+ arv_gc_register_feature_node (genicam, node);
+ } else if (strcmp (name, "NameSpace") == 0) {
if (g_strcmp0 (value, "Standard") == 0)
node->priv->name_space = ARV_GC_NAME_SPACE_STANDARD;
else
node->priv->name_space = ARV_GC_NAME_SPACE_CUSTOM;
- }
+ } else
+ arv_debug_dom ("[GcFeature::set_attribute] Unknown attribute '%s'", name);
}
-void
-arv_gc_feature_node_set_attribute (ArvGcFeatureNode *node, const char *name, const char *value)
+static const char *
+arv_gc_feature_node_get_attribute (ArvDomElement *self, const char *name)
{
- g_return_if_fail (ARV_IS_GC_FEATURE_NODE (node));
- g_return_if_fail (name != NULL);
+ ArvGcFeatureNode *node = ARV_GC_FEATURE_NODE (self);
- ARV_GC_FEATURE_NODE_GET_CLASS (node)->set_attribute (node, name, value);
-}
+ if (strcmp (name, "Name") == 0)
+ return node->priv->name;
+ else if (strcmp (name, "NameSpace") == 0)
+ switch (node->priv->name_space) {
+ case ARV_GC_NAME_SPACE_STANDARD:
+ return "Standard";
+ default:
+ return "Custom";
+ }
-static void
-_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
-{
- if (strcmp (name, "ToolTip") == 0) {
- g_free (node->priv->tooltip);
- node->priv->tooltip = g_strdup (content);
- } else if (strcmp (name, "Description") == 0) {
- g_free (node->priv->description);
- node->priv->description = g_strdup (content);
- } else if (strcmp (name, "DisplayName") == 0) {
- g_free (node->priv->display_name);
- node->priv->display_name = g_strdup (content);
- } else if (strcmp (name, "pIsImplemented") == 0) {
- arv_force_g_value_to_string (&node->priv->is_implemented, content);
- } else if (strcmp (name, "pIsAvailable") == 0) {
- arv_force_g_value_to_string (&node->priv->is_available, content);
- }
+ arv_debug_dom ("[GcFeature::set_attribute] Unknown attribute '%s'", name);
+
+ return NULL;
}
-void
-arv_gc_feature_node_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
-{
- g_return_if_fail (ARV_IS_GC_FEATURE_NODE (node));
- g_return_if_fail (name != NULL);
+/* ArvGcFeatureNode implementation */
- arv_log_genicam ("[GcNode::add_element] Add %s [%s]",
- name, content);
+const char *
+arv_gc_feature_node_get_name (ArvGcFeatureNode *node)
+{
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
- ARV_GC_FEATURE_NODE_GET_CLASS (node)->add_element (node, name, content, attributes);
+ return node->priv->name;
}
-gboolean
-arv_gc_feature_node_can_add_child (ArvGcFeatureNode *node, ArvGcFeatureNode *child)
+const char *
+arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *node)
{
- ArvGcFeatureNodeClass *node_class;
-
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), FALSE);
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (child), FALSE);
-
- node_class = ARV_GC_FEATURE_NODE_GET_CLASS (node);
- if (node_class->can_add_child == NULL)
- return FALSE;
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
- return node_class->can_add_child (node, child);
+ return node->priv->tooltip != NULL ? arv_gc_property_node_get_string (node->priv->tooltip) : NULL;
}
-void
-arv_gc_feature_node_add_child (ArvGcFeatureNode *node, ArvGcFeatureNode *child)
+const char *
+arv_gc_feature_node_get_description (ArvGcFeatureNode *node)
{
- g_return_if_fail (ARV_IS_GC_FEATURE_NODE (node));
- g_return_if_fail (ARV_IS_GC_FEATURE_NODE (child));
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
- node->priv->childs = g_slist_append (node->priv->childs, child);
- node->priv->n_childs++;
+ return node->priv->description != NULL ? arv_gc_property_node_get_string (node->priv->description) : NULL;
}
-/**
- * arv_gc_feature_node_get_childs:
- * @gc_feature_node: a #ArvGcFeatureNode
- *
- * Get the list of node childs.
- *
- * Returns: (element-type ArvGcFeatureNode) (transfer none): a list of #ArvGcFeatureNode.
- */
-
-const GSList *
-arv_gc_feature_node_get_childs (ArvGcFeatureNode *gc_feature_node)
+const char *
+arv_gc_feature_node_get_display_name (ArvGcFeatureNode *node)
{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), NULL);
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
- return gc_feature_node->priv->childs;
+ return node->priv->display_name != NULL ? arv_gc_property_node_get_string (node->priv->display_name) : NULL;
}
-unsigned int
-arv_gc_feature_node_get_n_childs (ArvGcFeatureNode *node)
+gboolean
+arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node)
{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), 0);
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
- return node->priv->n_childs;
+ return ((gc_feature_node->priv->is_implemented == NULL ||
+ arv_gc_property_node_get_int64 (gc_feature_node->priv->is_implemented) != 0) &&
+ (gc_feature_node->priv->is_available == NULL ||
+ arv_gc_property_node_get_int64 (gc_feature_node->priv->is_available) != 0));
}
ArvGcFeatureNode *
@@ -208,31 +218,6 @@ arv_gc_feature_node_new (void)
return node;
}
-void
-arv_gc_feature_node_set_genicam (ArvGcFeatureNode *node, ArvGc *genicam)
-{
- g_return_if_fail (ARV_IS_GC_FEATURE_NODE (node));
- g_return_if_fail (genicam == NULL || ARV_IS_GC (genicam));
-
- node->priv->genicam = genicam;
-}
-
-/**
- * arv_gc_feature_node_get_genicam:
- * @gc_feature_node: a #ArvGcFeatureNode
- * Return value: (transfer none): the parent #ArvGc
- *
- * Retrieves the parent genicam document of @node.
- */
-
-ArvGc *
-arv_gc_feature_node_get_genicam (ArvGcFeatureNode *node)
-{
- g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
-
- return node->priv->genicam;
-}
-
GType
arv_gc_feature_node_get_value_type (ArvGcFeatureNode *node)
{
@@ -274,7 +259,7 @@ arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, co
*
* Retrieve the node value a string.
*
- * <warning><para>Please not the string content is still owned by the @node object, which means the returned pointer may not be still valid after a new call to this function.</para></warning>
+ * <warning><para>Please note the string content is still owned by the @node object, which means the returned pointer may not be still valid after a new call to this function.</para></warning>
*
* Returns: (transfer none): a string representation of the node value, %NULL if not applicable.
*/
@@ -314,57 +299,33 @@ arv_gc_feature_node_init (ArvGcFeatureNode *gc_feature_node)
{
gc_feature_node->priv = G_TYPE_INSTANCE_GET_PRIVATE (gc_feature_node, ARV_TYPE_GC_FEATURE_NODE, ArvGcFeatureNodePrivate);
- gc_feature_node->priv->name = NULL;
- gc_feature_node->priv->tooltip = NULL;
- gc_feature_node->priv->description = NULL;
- gc_feature_node->priv->display_name = NULL;
- gc_feature_node->priv->childs = NULL;
- gc_feature_node->priv->n_childs = 0;
-
- g_value_init (&gc_feature_node->priv->is_implemented, G_TYPE_INT64);
- g_value_set_int64 (&gc_feature_node->priv->is_implemented, 1);
- g_value_init (&gc_feature_node->priv->is_available, G_TYPE_INT64);
- g_value_set_int64 (&gc_feature_node->priv->is_available, 1);
-
gc_feature_node->priv->modification_count = 0;
}
static void
arv_gc_feature_node_finalize (GObject *object)
{
- ArvGcFeatureNode *node = ARV_GC_FEATURE_NODE (object);
- GSList *iter;
-
- for (iter = node->priv->childs; iter != NULL; iter = iter->next)
- g_object_unref (iter->data);
- g_slist_free (node->priv->childs);
- node->priv->n_childs = 0;
-
- g_free (node->priv->name);
- g_free (node->priv->tooltip);
- g_free (node->priv->description);
- g_free (node->priv->display_name);
-
- g_value_unset (&node->priv->is_implemented);
- g_value_unset (&node->priv->is_available);
-
parent_class->finalize (object);
}
static void
-arv_gc_feature_node_class_init (ArvGcFeatureNodeClass *node_class)
+arv_gc_feature_node_class_init (ArvGcFeatureNodeClass *this_class)
{
- GObjectClass *object_class = G_OBJECT_CLASS (node_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);
- g_type_class_add_private (node_class, sizeof (ArvGcFeatureNodePrivate));
+ g_type_class_add_private (this_class, sizeof (ArvGcFeatureNodePrivate));
- parent_class = g_type_class_peek_parent (node_class);
+ parent_class = g_type_class_peek_parent (this_class);
object_class->finalize = arv_gc_feature_node_finalize;
-
- node_class->set_attribute = _set_attribute;
- node_class->add_element = _add_element;
- node_class->get_value_type = NULL;
+ dom_node_class->can_append_child = arv_gc_feature_node_can_append_child;
+ dom_node_class->post_new_child = arv_gc_feature_node_post_new_child;
+ dom_node_class->pre_remove_child = arv_gc_feature_node_pre_remove_child;
+ dom_element_class->set_attribute = arv_gc_feature_node_set_attribute;
+ dom_element_class->get_attribute = arv_gc_feature_node_get_attribute;
+ this_class->get_value_type = NULL;
}
-G_DEFINE_TYPE (ArvGcFeatureNode, arv_gc_feature_node, ARV_TYPE_DOM_ELEMENT)
+G_DEFINE_TYPE (ArvGcFeatureNode, arv_gc_feature_node, ARV_TYPE_GC_NODE)
diff --git a/src/arvgcfeaturenode.h b/src/arvgcfeaturenode.h
index 33c4009..6a13200 100644
--- a/src/arvgcfeaturenode.h
+++ b/src/arvgcfeaturenode.h
@@ -24,7 +24,7 @@
#define ARV_GC_FEATURE_NODE_H
#include <arvtypes.h>
-#include <arvdomelement.h>
+#include <arvgcnode.h>
G_BEGIN_DECLS
@@ -39,45 +39,31 @@ typedef struct _ArvGcFeatureNodePrivate ArvGcFeatureNodePrivate;
typedef struct _ArvGcFeatureNodeClass ArvGcFeatureNodeClass;
struct _ArvGcFeatureNode {
- ArvDomElement base;
+ ArvGcNode base;
ArvGcFeatureNodePrivate *priv;
};
struct _ArvGcFeatureNodeClass {
- ArvDomElementClass parent_class;
+ ArvGcNodeClass parent_class;
- void (*set_attribute) (ArvGcFeatureNode *gc_feature_node, const char *name, const char *value);
- void (*add_element) (ArvGcFeatureNode *gc_feature_node, const char *name, const char *content,
- const char **attributes);
GType (*get_value_type) (ArvGcFeatureNode *gc_feature_node);
- gboolean (*can_add_child) (ArvGcFeatureNode *gc_feature_node, ArvGcFeatureNode *child);
-
void (*set_value_from_string) (ArvGcFeatureNode *gc_feature_node, const char *string);
const char * (*get_value_as_string) (ArvGcFeatureNode *gc_feature_node);
};
-GType arv_gc_feature_node_get_type (void);
+GType arv_gc_feature_node_get_type (void);
ArvGcFeatureNode * arv_gc_feature_node_new (void);
-GType arv_gc_feature_node_get_value_type (ArvGcFeatureNode *gc_feature_node);
-void arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, const char *string);
-const char * arv_gc_feature_node_get_value_as_string (ArvGcFeatureNode *gc_feature_node);
-void arv_gc_feature_node_set_genicam (ArvGcFeatureNode *gc_feature_node, ArvGc *genicam);
-ArvGc * arv_gc_feature_node_get_genicam (ArvGcFeatureNode *gc_feature_node);
-const char * arv_gc_feature_node_get_name (ArvGcFeatureNode *gc_feature_node);
-const char * arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *gc_feature_node);
-const char * arv_gc_feature_node_get_description (ArvGcFeatureNode *gc_feature_node);
-gboolean arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node);
-void arv_gc_feature_node_set_attribute (ArvGcFeatureNode *gc_feature_node, const char *name, const char *value);
-void arv_gc_feature_node_add_element (ArvGcFeatureNode *gc_feature_node, const char *name, const char *content,
- const char **attributes);
-gboolean arv_gc_feature_node_can_add_child (ArvGcFeatureNode *gc_feature_node, ArvGcFeatureNode *child);
-void arv_gc_feature_node_add_child (ArvGcFeatureNode *gc_feature_node, ArvGcFeatureNode *child);
-const GSList * arv_gc_feature_node_get_childs (ArvGcFeatureNode *gc_feature_node);
-unsigned int arv_gc_feature_node_get_n_childs (ArvGcFeatureNode *gc_feature_node);
-void arv_gc_feature_node_inc_modification_count (ArvGcFeatureNode *gc_feature_node);
-gint arv_gc_feature_node_get_modification_count (ArvGcFeatureNode *gc_feature_node);
+const char * arv_gc_feature_node_get_name (ArvGcFeatureNode *gc_feature_node);
+const char * arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *gc_feature_node);
+const char * arv_gc_feature_node_get_description (ArvGcFeatureNode *gc_feature_node);
+gboolean arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node);
+GType arv_gc_feature_node_get_value_type (ArvGcFeatureNode *gc_feature_node);
+void arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, const char *string);
+const char * arv_gc_feature_node_get_value_as_string (ArvGcFeatureNode *gc_feature_node);
+void arv_gc_feature_node_inc_modification_count (ArvGcFeatureNode *gc_feature_node);
+gint arv_gc_feature_node_get_modification_count (ArvGcFeatureNode *gc_feature_node);
G_END_DECLS
diff --git a/src/arvgcfloatnode.c b/src/arvgcfloatnode.c
index 1f949e0..8c44b27 100644
--- a/src/arvgcfloatnode.c
+++ b/src/arvgcfloatnode.c
@@ -44,6 +44,7 @@ arv_gc_float_node_get_node_name (ArvDomNode *node)
/* ArvGcFeatureNode implementation */
+#if 0
static void
arv_gc_float_node_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
{
@@ -77,6 +78,7 @@ arv_gc_float_node_add_element (ArvGcFeatureNode *node, const char *name, const c
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
static GType
arv_gc_float_node_get_value_type (ArvGcFeatureNode *node)
@@ -104,10 +106,10 @@ arv_gc_float_node_get_value_as_string (ArvGcFeatureNode *node)
/* ArvGcFloatNode implementation */
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_float_node_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_FLOAT_NODE, NULL);
@@ -156,7 +158,7 @@ arv_gc_float_node_class_init (ArvGcFloatNodeClass *this_class)
object_class->finalize = arv_gc_float_node_finalize;
dom_node_class->get_node_name = arv_gc_float_node_get_node_name;
- gc_feature_node_class->add_element = arv_gc_float_node_add_element;
+/* gc_feature_node_class->add_element = arv_gc_float_node_add_element;*/
gc_feature_node_class->get_value_type = arv_gc_float_node_get_value_type;
gc_feature_node_class->set_value_from_string = arv_gc_float_node_set_value_from_string;
gc_feature_node_class->get_value_as_string = arv_gc_float_node_get_value_as_string;
@@ -170,7 +172,7 @@ arv_gc_float_node_get_float_value (ArvGcFloat *gc_float)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
return arv_gc_get_double_from_value (genicam, &gc_float_node->value);
}
@@ -180,7 +182,7 @@ arv_gc_float_node_set_float_value (ArvGcFloat *gc_float, double value)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
arv_gc_set_double_to_value (genicam, &gc_float_node->value, value);
}
@@ -190,7 +192,7 @@ arv_gc_float_node_get_min (ArvGcFloat *gc_float)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
return arv_gc_get_double_from_value (genicam, &gc_float_node->minimum);
}
@@ -200,7 +202,7 @@ arv_gc_float_node_get_max (ArvGcFloat *gc_float)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
return arv_gc_get_double_from_value (genicam, &gc_float_node->maximum);
}
@@ -210,7 +212,7 @@ arv_gc_float_node_get_inc (ArvGcFloat *gc_float)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
return arv_gc_get_int64_from_value (genicam, &gc_float_node->increment);
}
@@ -228,7 +230,7 @@ arv_gc_float_node_impose_min (ArvGcFloat *gc_float, double minimum)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
arv_gc_set_double_to_value (genicam, &gc_float_node->minimum, minimum);
}
@@ -238,7 +240,7 @@ arv_gc_float_node_impose_max (ArvGcFloat *gc_float, double maximum)
ArvGcFloatNode *gc_float_node = ARV_GC_FLOAT_NODE (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_float));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_float));
arv_gc_set_double_to_value (genicam, &gc_float_node->minimum, maximum);
}
diff --git a/src/arvgcfloatnode.h b/src/arvgcfloatnode.h
index 2418600..ff8bab1 100644
--- a/src/arvgcfloatnode.h
+++ b/src/arvgcfloatnode.h
@@ -54,8 +54,7 @@ struct _ArvGcFloatNodeClass {
};
GType arv_gc_float_node_get_type (void);
-
-ArvGcFeatureNode * arv_gc_float_node_new (void);
+ArvGcNode * arv_gc_float_node_new (void);
G_END_DECLS
diff --git a/src/arvgcintegernode.c b/src/arvgcintegernode.c
index 4a14f81..647ea34 100644
--- a/src/arvgcintegernode.c
+++ b/src/arvgcintegernode.c
@@ -1,6 +1,6 @@
/* Aravis - Digital camera library
*
- * Copyright  2009-2010 Emmanuel Pacaud
+ * 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
@@ -42,40 +42,51 @@ arv_gc_integer_node_get_node_name (ArvDomNode *node)
return "Integer";
}
-/* ArvGcFeatureNode implementation */
+/* ArvDomElement implementation */
static void
-arv_gc_integer_node_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
+arv_gc_integer_node_post_new_child (ArvDomNode *self, ArvDomNode *child)
+{
+ ArvGcIntegerNode *node = ARV_GC_INTEGER_NODE (self);
+
+ if (ARV_IS_GC_PROPERTY_NODE (child)) {
+ ArvGcPropertyNode *property_node = ARV_GC_PROPERTY_NODE (child);
+
+ switch (arv_gc_property_node_get_node_type (property_node)) {
+ case ARV_GC_PROPERTY_NODE_TYPE_VALUE:
+ case ARV_GC_PROPERTY_NODE_TYPE_P_VALUE:
+ node->value = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_MINIMUM:
+ case ARV_GC_PROPERTY_NODE_TYPE_P_MINIMUM:
+ node->maximum = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_MAXIMUM:
+ case ARV_GC_PROPERTY_NODE_TYPE_P_MAXIMUM:
+ node->minimum = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_INCREMENT:
+ case ARV_GC_PROPERTY_NODE_TYPE_P_INCREMENT:
+ node->increment = property_node;
+ break;
+ case ARV_GC_PROPERTY_NODE_TYPE_UNIT:
+ node->unit = property_node;
+ break;
+ default:
+ ARV_DOM_NODE_CLASS (parent_class)->post_new_child (self, child);
+ break;
+ }
+ }
+}
+
+static void
+arv_gc_integer_node_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
{
- ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (node);
-
- if (strcmp (name, "Value") == 0) {
- arv_force_g_value_to_int64 (&gc_integer_node->value,
- g_ascii_strtoll (content, NULL, 0));
- } else if (strcmp (name, "Min") == 0) {
- arv_force_g_value_to_int64 (&gc_integer_node->minimum,
- g_ascii_strtoll (content, NULL, 0));
- } else if (strcmp (name, "Max") == 0) {
- arv_force_g_value_to_int64 (&gc_integer_node->maximum,
- g_ascii_strtoll (content, NULL, 0));
- } else if (strcmp (name, "Inc") == 0) {
- arv_force_g_value_to_int64 (&gc_integer_node->increment,
- g_ascii_strtoll (content, NULL, 0));
- } else if (strcmp (name, "pValue") == 0) {
- arv_force_g_value_to_string (&gc_integer_node->value, content);
- } else if (strcmp (name, "pMin") == 0) {
- arv_force_g_value_to_string (&gc_integer_node->minimum, content);
- } else if (strcmp (name, "pMax") == 0) {
- arv_force_g_value_to_string (&gc_integer_node->maximum, content);
- } else if (strcmp (name, "pInc") == 0) {
- arv_force_g_value_to_string (&gc_integer_node->increment, content);
- } else if (strcmp (name, "Unit") == 0) {
- g_free (gc_integer_node->unit);
- gc_integer_node->unit = g_strdup (content);
- } else
- ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
+ g_assert_not_reached ();
}
+/* ArvGcIntegerNode implementation */
+
static GType
arv_gc_integer_node_get_value_type (ArvGcFeatureNode *node)
{
@@ -93,18 +104,18 @@ arv_gc_integer_node_get_value_as_string (ArvGcFeatureNode *node)
{
ArvGcIntegerNode *integer_node = ARV_GC_INTEGER_NODE (node);
- g_snprintf (integer_node->v_string, G_ASCII_DTOSTR_BUF_SIZE,
- "%" G_GINT64_FORMAT, arv_gc_integer_get_value (ARV_GC_INTEGER (node)));
+ if (integer_node->value != NULL)
+ return arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (integer_node->value));
- return integer_node->v_string;
+ return NULL;
}
/* ArvGcIntegerNode implementation */
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_integer_node_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_INTEGER_NODE, NULL);
@@ -114,31 +125,11 @@ arv_gc_integer_node_new (void)
static void
arv_gc_integer_node_init (ArvGcIntegerNode *gc_integer_node)
{
- g_value_init (&gc_integer_node->value, G_TYPE_INT64);
- g_value_init (&gc_integer_node->minimum, G_TYPE_INT64);
- g_value_init (&gc_integer_node->maximum, G_TYPE_INT64);
- g_value_init (&gc_integer_node->increment, G_TYPE_INT64);
-
- g_value_set_int64 (&gc_integer_node->value, 0);
- g_value_set_int64 (&gc_integer_node->minimum, G_MININT64);
- g_value_set_int64 (&gc_integer_node->maximum, G_MAXINT64);
- g_value_set_int64 (&gc_integer_node->increment, 1);
-
- gc_integer_node->unit = NULL;
}
static void
arv_gc_integer_node_finalize (GObject *object)
{
- ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (object);
-
- g_free (gc_integer_node->unit);
-
- g_value_unset (&gc_integer_node->value);
- g_value_unset (&gc_integer_node->minimum);
- g_value_unset (&gc_integer_node->maximum);
- g_value_unset (&gc_integer_node->increment);
-
parent_class->finalize (object);
}
@@ -153,7 +144,8 @@ arv_gc_integer_node_class_init (ArvGcIntegerNodeClass *this_class)
object_class->finalize = arv_gc_integer_node_finalize;
dom_node_class->get_node_name = arv_gc_integer_node_get_node_name;
- gc_feature_node_class->add_element = arv_gc_integer_node_add_element;
+ dom_node_class->post_new_child = arv_gc_integer_node_post_new_child;
+ dom_node_class->pre_remove_child = arv_gc_integer_node_pre_remove_child;
gc_feature_node_class->get_value_type = arv_gc_integer_node_get_value_type;
gc_feature_node_class->set_value_from_string = arv_gc_integer_node_set_value_from_string;
gc_feature_node_class->get_value_as_string = arv_gc_integer_node_get_value_as_string;
@@ -165,50 +157,53 @@ static gint64
arv_gc_integer_node_get_integer_value (ArvGcInteger *gc_integer)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- return arv_gc_get_int64_from_value (genicam, &gc_integer_node->value);
+ if (gc_integer_node->value != NULL)
+ return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->value));
+
+ return 0;
}
static void
arv_gc_integer_node_set_integer_value (ArvGcInteger *gc_integer, gint64 value)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- arv_gc_set_int64_to_value (genicam, &gc_integer_node->value, value);
+ if (gc_integer_node->value != NULL)
+ arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->value), value);
}
static gint64
arv_gc_integer_node_get_min (ArvGcInteger *gc_integer)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- return arv_gc_get_int64_from_value (genicam, &gc_integer_node->minimum);
+ if (gc_integer_node->minimum != NULL)
+ return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->minimum));
+
+ return G_MININT64;
}
static gint64
arv_gc_integer_node_get_max (ArvGcInteger *gc_integer)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- return arv_gc_get_int64_from_value (genicam, &gc_integer_node->maximum);
+ if (gc_integer_node->maximum != NULL)
+ return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->maximum));
+
+ return G_MAXINT64;
}
static gint64
arv_gc_integer_node_get_inc (ArvGcInteger *gc_integer)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- return arv_gc_get_int64_from_value (genicam, &gc_integer_node->increment);
+ if (gc_integer_node->increment != NULL)
+ return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->increment));
+
+ return 1;
}
static const char *
@@ -216,27 +211,28 @@ arv_gc_integer_node_get_unit (ArvGcInteger *gc_integer)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- return gc_integer_node->unit;
+ if (gc_integer_node->unit != NULL)
+ return arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (gc_integer_node->unit));
+
+ return NULL;
}
static void
arv_gc_integer_node_impose_min (ArvGcInteger *gc_integer, gint64 minimum)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- arv_gc_set_int64_to_value (genicam, &gc_integer_node->minimum, minimum);
+ if (gc_integer_node->minimum != NULL)
+ arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->minimum), minimum);
}
static void
arv_gc_integer_node_impose_max (ArvGcInteger *gc_integer, gint64 maximum)
{
ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
- ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_integer));
- arv_gc_set_int64_to_value (genicam, &gc_integer_node->minimum, maximum);
+ if (gc_integer_node->maximum != NULL)
+ arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->maximum), maximum);
}
static void
diff --git a/src/arvgcintegernode.h b/src/arvgcintegernode.h
index ee332ce..b782319 100644
--- a/src/arvgcintegernode.h
+++ b/src/arvgcintegernode.h
@@ -1,6 +1,6 @@
/* Aravis - Digital camera library
*
- * Copyright  2009-2010 Emmanuel Pacaud
+ * 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
@@ -25,6 +25,7 @@
#include <arvtypes.h>
#include <arvgcfeaturenode.h>
+#include <arvgcpropertynode.h>
G_BEGIN_DECLS
@@ -40,13 +41,11 @@ typedef struct _ArvGcIntegerNodeClass ArvGcIntegerNodeClass;
struct _ArvGcIntegerNode {
ArvGcFeatureNode node;
- GValue value;
- GValue minimum;
- GValue maximum;
- GValue increment;
- char *unit;
-
- char v_string[G_ASCII_DTOSTR_BUF_SIZE];
+ ArvGcPropertyNode *value;
+ ArvGcPropertyNode *minimum;
+ ArvGcPropertyNode *maximum;
+ ArvGcPropertyNode *increment;
+ ArvGcPropertyNode *unit;
};
struct _ArvGcIntegerNodeClass {
@@ -54,8 +53,7 @@ struct _ArvGcIntegerNodeClass {
};
GType arv_gc_integer_node_get_type (void);
-
-ArvGcFeatureNode * arv_gc_integer_node_new (void);
+ArvGcNode * arv_gc_integer_node_new (void);
G_END_DECLS
diff --git a/src/arvgcnode.c b/src/arvgcnode.c
index 86ebfd3..f94f455 100644
--- a/src/arvgcnode.c
+++ b/src/arvgcnode.c
@@ -38,8 +38,24 @@ static GObjectClass *parent_class = NULL;
/* ArvDomNode implementation */
+/* ArvDomElement implementation */
+
/* ArvGcNode implementation */
+/**
+ * arv_gc_node_get_genicam:
+ * @gc_node: a #ArvGcNode
+ * Return value: (transfer none): the parent #ArvGc
+ *
+ * Retrieves the parent genicam document of @gc_node.
+ */
+
+ArvGc *
+arv_gc_node_get_genicam (ArvGcNode *gc_node)
+{
+ return ARV_GC (arv_dom_node_get_owner_document (ARV_DOM_NODE (gc_node)));
+}
+
static void
arv_gc_node_init (ArvGcNode *gc_node)
{
diff --git a/src/arvgcnode.h b/src/arvgcnode.h
index 934347d..37b46b2 100644
--- a/src/arvgcnode.h
+++ b/src/arvgcnode.h
@@ -48,6 +48,8 @@ struct _ArvGcNodeClass {
GType arv_gc_node_get_type (void);
+ArvGc * arv_gc_node_get_genicam (ArvGcNode *gc_node);
+
G_END_DECLS
#endif
diff --git a/src/arvgcport.c b/src/arvgcport.c
index ad7b05c..cbddaf0 100644
--- a/src/arvgcport.c
+++ b/src/arvgcport.c
@@ -49,7 +49,7 @@ arv_gc_port_read (ArvGcPort *port, void *buffer, guint64 address, guint64 length
g_return_if_fail (ARV_IS_GC_PORT (port));
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (port));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (port));
device = arv_gc_get_device (genicam);
arv_device_read_memory (device, address, length, buffer);
@@ -63,16 +63,16 @@ arv_gc_port_write (ArvGcPort *port, void *buffer, guint64 address, guint64 lengt
g_return_if_fail (ARV_IS_GC_PORT (port));
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (port));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (port));
device = arv_gc_get_device (genicam);
arv_device_write_memory (device, address, length, buffer);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_port_new (void)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = g_object_new (ARV_TYPE_GC_PORT, NULL);
diff --git a/src/arvgcport.h b/src/arvgcport.h
index 0f98ea6..80f74e4 100644
--- a/src/arvgcport.h
+++ b/src/arvgcport.h
@@ -45,12 +45,10 @@ struct _ArvGcPortClass {
ArvGcFeatureNodeClass parent_class;
};
-GType arv_gc_port_get_type (void);
-
-ArvGcFeatureNode * arv_gc_port_new (void);
-
-void arv_gc_port_read (ArvGcPort *port, void *buffer, guint64 address, guint64 length);
-void arv_gc_port_write (ArvGcPort *port, void *buffer, guint64 address, guint64 length);
+GType arv_gc_port_get_type (void);
+ArvGcNode * arv_gc_port_new (void);
+void arv_gc_port_read (ArvGcPort *port, void *buffer, guint64 address, guint64 length);
+void arv_gc_port_write (ArvGcPort *port, void *buffer, guint64 address, guint64 length);
G_END_DECLS
diff --git a/src/arvgcpropertynode.c b/src/arvgcpropertynode.c
index d9d165b..65a290c 100644
--- a/src/arvgcpropertynode.c
+++ b/src/arvgcpropertynode.c
@@ -30,6 +30,7 @@
#include <arvgcpropertynode.h>
#include <arvgc.h>
+#include <arvdomtext.h>
#include <arvmisc.h>
#include <arvdebug.h>
#include <string.h>
@@ -44,31 +45,117 @@ 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_VALUE:
+ return "Value";
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_MINIMUM:
+ return "Min";
+ case ARV_GC_PROPERTY_NODE_TYPE_MAXIMUM:
+ return "Max";
+ case ARV_GC_PROPERTY_NODE_TYPE_INCREMENT:
+ return "Inc";
+ case ARV_GC_PROPERTY_NODE_TYPE_ON_VALUE:
+ return "OnValue";
+ case ARV_GC_PROPERTY_NODE_TYPE_OFF_VALUE:
+ return "OffValue";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_FEATURE:
+ return "pFeature";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_VALUE:
+ return "pValue";
case ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED:
return "pIsImplemented";
case ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE:
return "pIsAvailable";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_MINIMUM:
+ return "pMin";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_MAXIMUM:
+ return "pMax";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_INCREMENT:
+ return "pInc";
default:
return "Unknown";
}
}
+/* ArvDomElement implementation */
+
+static gboolean
+arv_gc_property_node_can_append_child (ArvDomNode *self, ArvDomNode *child)
+{
+ return ARV_IS_DOM_TEXT (child);
+}
+
/* ArvGcPropertyNode implementation */
const char *
-arv_gc_property_node_get_content (ArvGcPropertyNode *node)
+arv_gc_property_node_get_string (ArvGcPropertyNode *node)
{
- g_assert_not_reached ();
+ ArvDomNode *child;
+
+ g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), NULL);
+
+ child = arv_dom_node_get_first_child (ARV_DOM_NODE (node));
+ if (child != NULL)
+ return arv_dom_character_data_get_data (ARV_DOM_CHARACTER_DATA (child));
+
return NULL;
}
+
+void
+arv_gc_property_node_set_string (ArvGcPropertyNode *node, const char *string)
+{
+ ArvDomNode *child;
+
+ g_return_if_fail (ARV_IS_GC_PROPERTY_NODE (node));
+
+ child = arv_dom_node_get_first_child (ARV_DOM_NODE (node));
+ if (child != NULL)
+ arv_dom_character_data_set_data (ARV_DOM_CHARACTER_DATA (child), string);
+}
+
+gint64
+arv_gc_property_node_get_int64 (ArvGcPropertyNode *node)
+{
+ const char *string;
+
+ string = arv_gc_property_node_get_string (node);
+
+ if (string != NULL)
+ return g_ascii_strtoll (string, NULL, 0);
+
+ return 0;
+}
+
+void
+arv_gc_property_node_set_int64 (ArvGcPropertyNode *node, gint64 v_int64)
+{
+ ArvDomNode *child;
-static ArvGcPropertyNode *
+ g_return_if_fail (ARV_IS_GC_PROPERTY_NODE (node));
+
+ child = arv_dom_node_get_first_child (ARV_DOM_NODE (node));
+ if (child != NULL) {
+ char *string = g_strdup_printf ("%" G_GINT64_FORMAT, v_int64);
+
+ arv_dom_character_data_set_data (ARV_DOM_CHARACTER_DATA (child), string);
+ g_free (string);
+ }
+}
+
+ArvGcPropertyNodeType
+arv_gc_property_node_get_node_type (ArvGcPropertyNode *node)
+{
+ g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), ARV_GC_PROPERTY_NODE_TYPE_UNKNOWN);
+
+ return node->type;
+}
+
+static ArvGcNode *
arv_gc_property_node_new (ArvGcPropertyNodeType type)
{
ArvGcPropertyNode *node;
@@ -76,34 +163,52 @@ arv_gc_property_node_new (ArvGcPropertyNodeType type)
node = g_object_new (ARV_TYPE_GC_PROPERTY_NODE, NULL);
node->type = type;
- return node;
+ return ARV_GC_NODE (node);
+}
+
+ArvGcNode *
+arv_gc_property_node_new_p_feature (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_FEATURE);
+}
+
+ArvGcNode *
+arv_gc_property_node_new_value (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_VALUE);
+}
+
+ArvGcNode *
+arv_gc_property_node_new_p_value (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_VALUE);
}
-ArvGcPropertyNode *
+ArvGcNode *
arv_gc_property_node_new_description (void)
{
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION);
}
-ArvGcPropertyNode *
+ArvGcNode *
arv_gc_property_node_new_tooltip (void)
{
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP);
}
-ArvGcPropertyNode *
+ArvGcNode *
arv_gc_property_node_new_display_name (void)
{
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME);
}
-ArvGcPropertyNode *
+ArvGcNode *
arv_gc_property_node_new_p_is_implemented (void)
{
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED);
}
-ArvGcPropertyNode *
+ArvGcNode *
arv_gc_property_node_new_p_is_available (void)
{
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE);
@@ -131,6 +236,7 @@ arv_gc_property_node_class_init (ArvGcPropertyNodeClass *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;
}
-G_DEFINE_TYPE (ArvGcPropertyNode, arv_gc_property_node, ARV_TYPE_DOM_ELEMENT)
+G_DEFINE_TYPE (ArvGcPropertyNode, arv_gc_property_node, ARV_TYPE_GC_NODE)
diff --git a/src/arvgcpropertynode.h b/src/arvgcpropertynode.h
index 927392b..b6ce4f0 100644
--- a/src/arvgcpropertynode.h
+++ b/src/arvgcpropertynode.h
@@ -24,17 +24,31 @@
#define ARV_GC_PROPERTY_NODE_H
#include <arvtypes.h>
-#include <arvdomelement.h>
+#include <arvgcnode.h>
G_BEGIN_DECLS
typedef enum {
- ARV_GC_PROPERTY_NODE_TYPE_UNKNOWN,
+ ARV_GC_PROPERTY_NODE_TYPE_UNKNOWN = 0,
+ ARV_GC_PROPERTY_NODE_TYPE_VALUE,
ARV_GC_PROPERTY_NODE_TYPE_DESCRIPTION,
ARV_GC_PROPERTY_NODE_TYPE_TOOLTIP,
ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NAME,
+ ARV_GC_PROPERTY_NODE_TYPE_MINIMUM,
+ ARV_GC_PROPERTY_NODE_TYPE_MAXIMUM,
+ ARV_GC_PROPERTY_NODE_TYPE_INCREMENT,
+ ARV_GC_PROPERTY_NODE_TYPE_UNIT,
+ ARV_GC_PROPERTY_NODE_TYPE_ON_VALUE,
+ ARV_GC_PROPERTY_NODE_TYPE_OFF_VALUE,
+
+ ARV_GC_PROPERTY_NODE_TYPE_P_UNKNONW = 1000,
+ ARV_GC_PROPERTY_NODE_TYPE_P_FEATURE,
+ ARV_GC_PROPERTY_NODE_TYPE_P_VALUE,
ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED,
- ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE
+ ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE,
+ ARV_GC_PROPERTY_NODE_TYPE_P_MINIMUM,
+ ARV_GC_PROPERTY_NODE_TYPE_P_MAXIMUM,
+ ARV_GC_PROPERTY_NODE_TYPE_P_INCREMENT,
} ArvGcPropertyNodeType;
#define ARV_TYPE_GC_PROPERTY_NODE (arv_gc_property_node_get_type ())
@@ -48,23 +62,31 @@ typedef struct _ArvGcPropertyNodePrivate ArvGcPropertyNodePrivate;
typedef struct _ArvGcPropertyNodeClass ArvGcPropertyNodeClass;
struct _ArvGcPropertyNode {
- ArvDomElement base;
+ ArvGcNode base;
ArvGcPropertyNodeType type;
};
struct _ArvGcPropertyNodeClass {
- ArvDomElementClass parent_class;
+ ArvGcNodeClass 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);
+ArvGcNode * arv_gc_property_node_new_p_feature (void);
+ArvGcNode * arv_gc_property_node_new_value (void);
+ArvGcNode * arv_gc_property_node_new_p_value (void);
+ArvGcNode * arv_gc_property_node_new_description (void);
+ArvGcNode * arv_gc_property_node_new_tooltip (void);
+ArvGcNode * arv_gc_property_node_new_display_name (void);
+ArvGcNode * arv_gc_property_node_new_p_is_implemented (void);
+ArvGcNode * arv_gc_property_node_new_p_is_available (void);
+
+const char * arv_gc_property_node_get_string (ArvGcPropertyNode *node);
+void arv_gc_property_node_set_string (ArvGcPropertyNode *node, const char *string);
+gint64 arv_gc_property_node_get_int64 (ArvGcPropertyNode *node);
+void arv_gc_property_node_set_int64 (ArvGcPropertyNode *node, gint64 v_int64);
+ArvGcPropertyNodeType arv_gc_property_node_get_node_type (ArvGcPropertyNode *node);
G_END_DECLS
diff --git a/src/arvgcregister.c b/src/arvgcregister.c
index 76dc294..5770202 100644
--- a/src/arvgcregister.c
+++ b/src/arvgcregister.c
@@ -68,6 +68,7 @@ arv_gc_register_get_node_name (ArvDomNode *node)
/* ArvGcFeatureNode implementation */
+#if 0
static void
arv_gc_register_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
{
@@ -145,6 +146,7 @@ arv_gc_register_add_element (ArvGcFeatureNode *node, const char *name, const cha
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
static GType
arv_gc_register_get_value_type (ArvGcFeatureNode *node)
@@ -207,14 +209,14 @@ _get_cache_validity (ArvGcRegister *gc_register)
gint modification_count;
gboolean is_cache_valid = gc_register->is_cache_valid;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
for (iter = gc_register->invalidators; iter != NULL; iter = iter->next) {
ArvGcInvalidator *invalidator = iter->data;
modification_count = invalidator->modification_count;
invalidator->modification_count = arv_gc_feature_node_get_modification_count
- (arv_gc_get_node (genicam, invalidator->node));
+ (ARV_GC_FEATURE_NODE (arv_gc_get_node (genicam, invalidator->node)));
if (modification_count != invalidator->modification_count)
is_cache_valid = FALSE;
}
@@ -240,14 +242,14 @@ static void
_read_cache (ArvGcRegister *gc_register)
{
ArvGc *genicam;
- ArvGcFeatureNode *port;
+ ArvGcNode *port;
if (gc_register->is_cache_valid == TRUE) {
arv_log_genicam ("[GcRegister::read_cache] Cache is valid");
return;
}
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
g_return_if_fail (ARV_IS_GC (genicam));
port = arv_gc_get_node (genicam, gc_register->port_name);
@@ -271,9 +273,9 @@ static void
_write_cache (ArvGcRegister *gc_register)
{
ArvGc *genicam;
- ArvGcFeatureNode *port;
+ ArvGcNode *port;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
g_return_if_fail (ARV_IS_GC (genicam));
arv_gc_feature_node_inc_modification_count (ARV_GC_FEATURE_NODE (gc_register));
@@ -336,14 +338,14 @@ arv_gc_register_get_address (ArvGcRegister *gc_register)
guint64 value = 0;
g_return_val_if_fail (ARV_IS_GC_REGISTER (gc_register), 0);
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
g_return_val_if_fail (ARV_IS_GC (genicam), 0);
for (iter = gc_register->addresses; iter != NULL; iter = iter->next)
value += arv_gc_get_int64_from_value (genicam, iter->data);
if (gc_register->index != NULL) {
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_gc_get_node (genicam, gc_register->index);
if (ARV_IS_GC_INTEGER (node)) {
@@ -372,13 +374,13 @@ arv_gc_register_get_length (ArvGcRegister *gc_register)
ArvGc *genicam;
g_return_val_if_fail (ARV_IS_GC_REGISTER (gc_register), 0);
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
g_return_val_if_fail (ARV_IS_GC (genicam), 0);
return arv_gc_get_int64_from_value (genicam, &gc_register->length);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_register_new (void)
{
ArvGcRegister *gc_register;
@@ -387,10 +389,10 @@ arv_gc_register_new (void)
gc_register->type = ARV_GC_REGISTER_TYPE_REGISTER;
gc_register->value_type = G_TYPE_BYTE_ARRAY;
- return ARV_GC_FEATURE_NODE (gc_register);
+ return ARV_GC_NODE (gc_register);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_register_new_integer (void)
{
ArvGcRegister *gc_register;
@@ -399,10 +401,10 @@ arv_gc_register_new_integer (void)
gc_register->type = ARV_GC_REGISTER_TYPE_INTEGER;
gc_register->value_type = G_TYPE_INT64;
- return ARV_GC_FEATURE_NODE (gc_register);
+ return ARV_GC_NODE (gc_register);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_register_new_masked_integer (void)
{
ArvGcRegister *gc_register;
@@ -411,10 +413,10 @@ arv_gc_register_new_masked_integer (void)
gc_register->type = ARV_GC_REGISTER_TYPE_MASKED_INTEGER;
gc_register->value_type = G_TYPE_INT64;
- return ARV_GC_FEATURE_NODE (gc_register);
+ return ARV_GC_NODE (gc_register);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_register_new_float (void)
{
ArvGcRegister *gc_register;
@@ -423,10 +425,10 @@ arv_gc_register_new_float (void)
gc_register->type = ARV_GC_REGISTER_TYPE_FLOAT;
gc_register->value_type = G_TYPE_DOUBLE;
- return ARV_GC_FEATURE_NODE (gc_register);
+ return ARV_GC_NODE (gc_register);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_register_new_string (void)
{
ArvGcRegister *gc_register;
@@ -435,7 +437,7 @@ arv_gc_register_new_string (void)
gc_register->type = ARV_GC_REGISTER_TYPE_STRING;
gc_register->value_type = G_TYPE_STRING;
- return ARV_GC_FEATURE_NODE (gc_register);
+ return ARV_GC_NODE (gc_register);
}
static void
@@ -493,7 +495,7 @@ arv_gc_register_class_init (ArvGcRegisterClass *this_class)
object_class->finalize = arv_gc_register_finalize;
dom_node_class->get_node_name = arv_gc_register_get_node_name;
- gc_feature_node_class->add_element = arv_gc_register_add_element;
+/* gc_feature_node_class->add_element = arv_gc_register_add_element;*/
gc_feature_node_class->get_value_type = arv_gc_register_get_value_type;
gc_feature_node_class->set_value_from_string = arv_gc_register_set_value_from_string;
gc_feature_node_class->get_value_as_string = arv_gc_register_get_value_as_string;
@@ -628,7 +630,7 @@ arv_gc_register_set_float_value (ArvGcFloat *gc_float, double v_double)
ArvGcRegister *gc_register = ARV_GC_REGISTER (gc_float);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
g_return_if_fail (ARV_IS_GC (genicam));
_update_cache_size (gc_register, genicam);
@@ -674,7 +676,7 @@ arv_gc_register_set_string_value (ArvGcString *gc_string, const char *value)
ArvGcRegister *gc_register = ARV_GC_REGISTER (gc_string);
ArvGc *genicam;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_register));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_register));
g_return_if_fail (ARV_IS_GC (genicam));
_update_cache_size (gc_register, genicam);
diff --git a/src/arvgcregister.h b/src/arvgcregister.h
index 0e11aed..dd40a29 100644
--- a/src/arvgcregister.h
+++ b/src/arvgcregister.h
@@ -98,11 +98,11 @@ struct _ArvGcRegisterClass {
};
GType arv_gc_register_get_type (void);
-ArvGcFeatureNode * arv_gc_register_new (void);
-ArvGcFeatureNode * arv_gc_register_new_integer (void);
-ArvGcFeatureNode * arv_gc_register_new_masked_integer (void);
-ArvGcFeatureNode * arv_gc_register_new_float (void);
-ArvGcFeatureNode * arv_gc_register_new_string (void);
+ArvGcNode * arv_gc_register_new (void);
+ArvGcNode * arv_gc_register_new_integer (void);
+ArvGcNode * arv_gc_register_new_masked_integer (void);
+ArvGcNode * arv_gc_register_new_float (void);
+ArvGcNode * arv_gc_register_new_string (void);
void arv_gc_register_get (ArvGcRegister *gc_register, void *buffer, guint64 Length);
void arv_gc_register_set (ArvGcRegister *gc_register, void *buffer, guint64 Length);
guint64 arv_gc_register_get_address (ArvGcRegister *gc_register);
diff --git a/src/arvgcregisterdescriptionnode.c b/src/arvgcregisterdescriptionnode.c
index a445e65..d83e316 100644
--- a/src/arvgcregisterdescriptionnode.c
+++ b/src/arvgcregisterdescriptionnode.c
@@ -37,16 +37,38 @@ arv_gc_register_description_node_get_node_name (ArvDomNode *node)
return "RegisterDescription";
}
+static void
+arv_gc_register_description_node_set_attribute (ArvDomElement *self, const char* name, const char *value)
+{
+ ArvGcRegisterDescriptionNode *node = ARV_GC_REGISTER_DESCRIPTION_NODE (self);
+
+ if (g_strcmp0 (name, "ModelName") == 0) {
+ g_free (node->model_name);
+ node->model_name = g_strdup (value);
+ }
+}
+
+static const char *
+arv_gc_register_description_node_get_attribute (ArvDomElement *self, const char *name)
+{
+ ArvGcRegisterDescriptionNode *node = ARV_GC_REGISTER_DESCRIPTION_NODE (self);
+
+ if (g_strcmp0 (name, "ModelName") == 0)
+ return node->model_name;
+
+ return NULL;
+}
+
/* ArvGcRegisterDescriptionNode implementation */
-ArvDomElement *
+ArvGcNode *
arv_gc_register_description_node_new (void)
{
- ArvDomElement *element;
+ ArvGcNode *node;
- element = g_object_new (ARV_TYPE_GC_REGISTER_DESCRIPTION_NODE, NULL);
+ node = g_object_new (ARV_TYPE_GC_REGISTER_DESCRIPTION_NODE, NULL);
- return element;
+ return node;
}
static void
@@ -57,6 +79,10 @@ arv_gc_register_description_node_init (ArvGcRegisterDescriptionNode *gc_register
static void
arv_gc_register_description_node_finalize (GObject *object)
{
+ ArvGcRegisterDescriptionNode *node = ARV_GC_REGISTER_DESCRIPTION_NODE (object);
+
+ g_free (node->model_name);
+
parent_class->finalize (object);
}
@@ -65,11 +91,14 @@ arv_gc_register_description_node_class_init (ArvGcRegisterDescriptionNodeClass *
{
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_register_description_node_finalize;
dom_node_class->get_node_name = arv_gc_register_description_node_get_node_name;
+ dom_element_class->set_attribute = arv_gc_register_description_node_set_attribute;
+ dom_element_class->get_attribute = arv_gc_register_description_node_get_attribute;
}
/* ArvGcInteger interface implementation */
diff --git a/src/arvgcregisterdescriptionnode.h b/src/arvgcregisterdescriptionnode.h
index a1e3821..d1757d0 100644
--- a/src/arvgcregisterdescriptionnode.h
+++ b/src/arvgcregisterdescriptionnode.h
@@ -39,6 +39,8 @@ typedef struct _ArvGcRegisterDescriptionNodeClass ArvGcRegisterDescriptionNodeCl
struct _ArvGcRegisterDescriptionNode {
ArvGcFeatureNode node;
+
+ char *model_name;
};
struct _ArvGcRegisterDescriptionNodeClass {
@@ -46,6 +48,7 @@ struct _ArvGcRegisterDescriptionNodeClass {
};
GType arv_gc_register_description_node_get_type (void);
+ArvGcNode * arv_gc_register_description_node_new (void);
G_END_DECLS
diff --git a/src/arvgcswissknife.c b/src/arvgcswissknife.c
index 3e504a4..1fa3e5f 100644
--- a/src/arvgcswissknife.c
+++ b/src/arvgcswissknife.c
@@ -56,6 +56,7 @@ arv_gc_swiss_knife_get_node_name (ArvDomNode *node)
/* ArvGcFeatureNode implementation */
+#if 0
static void
arv_gc_swiss_knife_add_element (ArvGcFeatureNode *node, const char *name, const char *content, const char **attributes)
{
@@ -92,6 +93,7 @@ arv_gc_swiss_knife_add_element (ArvGcFeatureNode *node, const char *name, const
} else
ARV_GC_FEATURE_NODE_CLASS (parent_class)->add_element (node, name, content, attributes);
}
+#endif
/* ArvGcSwissKnife implementation */
@@ -103,7 +105,7 @@ arv_gc_swiss_knife_node_get_value_type (ArvGcFeatureNode *node)
return gc_swiss_knife->value_type;
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_swiss_knife_new (void)
{
ArvGcSwissKnife *swiss_knife;
@@ -111,10 +113,10 @@ arv_gc_swiss_knife_new (void)
swiss_knife = g_object_new (ARV_TYPE_GC_SWISS_KNIFE, NULL);
swiss_knife->value_type = G_TYPE_DOUBLE;
- return ARV_GC_FEATURE_NODE (swiss_knife);
+ return ARV_GC_NODE (swiss_knife);
}
-ArvGcFeatureNode *
+ArvGcNode *
arv_gc_swiss_knife_new_integer (void)
{
ArvGcSwissKnife *swiss_knife;
@@ -122,7 +124,7 @@ arv_gc_swiss_knife_new_integer (void)
swiss_knife = g_object_new (ARV_TYPE_GC_SWISS_KNIFE, NULL);
swiss_knife->value_type = G_TYPE_INT64;
- return ARV_GC_FEATURE_NODE (swiss_knife);
+ return ARV_GC_NODE (swiss_knife);
}
static void
@@ -162,7 +164,7 @@ arv_gc_swiss_knife_class_init (ArvGcSwissKnifeClass *this_class)
object_class->finalize = arv_gc_swiss_knife_finalize;
dom_node_class->get_node_name = arv_gc_swiss_knife_get_node_name;
- gc_feature_node_class->add_element = arv_gc_swiss_knife_add_element;
+/* gc_feature_node_class->add_element = arv_gc_swiss_knife_add_element;*/
gc_feature_node_class->get_value_type = arv_gc_swiss_knife_node_get_value_type;
}
@@ -172,20 +174,20 @@ static void
_update_variables (ArvGcSwissKnife *gc_swiss_knife)
{
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
GSList *iter;
- genicam = arv_gc_feature_node_get_genicam (ARV_GC_FEATURE_NODE (gc_swiss_knife));
+ genicam = arv_gc_node_get_genicam (ARV_GC_NODE (gc_swiss_knife));
for (iter = gc_swiss_knife->variables; iter != NULL; iter = iter->next) {
ArvGcSwissKnifeVariableInfos *variable_infos = iter->data;
node = arv_gc_get_node (genicam, variable_infos->node_name);
- if (arv_gc_feature_node_get_value_type (node) == G_TYPE_INT64)
+ if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_INT64)
arv_evaluator_set_int64_variable (gc_swiss_knife->formula,
variable_infos->name,
arv_gc_integer_get_value (ARV_GC_INTEGER (node)));
- else if (arv_gc_feature_node_get_value_type (node) == G_TYPE_DOUBLE)
+ else if (arv_gc_feature_node_get_value_type (ARV_GC_FEATURE_NODE (node)) == G_TYPE_DOUBLE)
arv_evaluator_set_double_variable (gc_swiss_knife->formula,
variable_infos->name,
arv_gc_float_get_value (ARV_GC_FLOAT (node)));
diff --git a/src/arvgcswissknife.h b/src/arvgcswissknife.h
index 6fa69da..ae2080f 100644
--- a/src/arvgcswissknife.h
+++ b/src/arvgcswissknife.h
@@ -50,9 +50,8 @@ struct _ArvGcSwissKnifeClass {
};
GType arv_gc_swiss_knife_get_type (void);
-
-ArvGcFeatureNode * arv_gc_swiss_knife_new (void);
-ArvGcFeatureNode * arv_gc_swiss_knife_new_integer (void);
+ArvGcNode * arv_gc_swiss_knife_new (void);
+ArvGcNode * arv_gc_swiss_knife_new_integer (void);
G_END_DECLS
diff --git a/src/arvtool.c b/src/arvtool.c
index 1a3baba..e9d5961 100644
--- a/src/arvtool.c
+++ b/src/arvtool.c
@@ -6,7 +6,7 @@
static void
arv_tool_list_features (ArvGc *genicam, const char *feature, gboolean show_description, int level)
{
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_gc_get_node (genicam, feature);
if (ARV_IS_GC_NODE (node)) {
@@ -20,7 +20,7 @@ arv_tool_list_features (ArvGc *genicam, const char *feature, gboolean show_descr
if (show_description) {
const char *description;
- description = arv_gc_feature_node_get_description (node);
+ description = arv_gc_feature_node_get_description (ARV_GC_FEATURE_NODE (node));
if (description)
printf ("%s\n", description);
}
@@ -34,6 +34,7 @@ arv_tool_list_features (ArvGc *genicam, const char *feature, gboolean show_descr
for (iter = features; iter != NULL; iter = iter->next)
arv_tool_list_features (genicam, iter->data, show_description, level + 1);
} else if (ARV_IS_GC_ENUMERATION (node)) {
+#if 0
const GSList *childs;
const GSList *iter;
@@ -46,6 +47,7 @@ arv_tool_list_features (ArvGc *genicam, const char *feature, gboolean show_descr
arv_dom_node_get_node_name (iter->data),
arv_gc_feature_node_get_name (iter->data));
}
+#endif
}
}
}
@@ -84,7 +86,7 @@ arv_tool_execute_command (int argc, char **argv, const char *device_name)
int i;
for (i = 2; i < argc; i++) {
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
node = arv_gc_get_node (genicam, argv[i]);
if (ARV_IS_GC_NODE (node)) {
@@ -92,7 +94,7 @@ arv_tool_execute_command (int argc, char **argv, const char *device_name)
printf ("%s: '%s'\n", arv_dom_node_get_node_name (ARV_DOM_NODE (node)), argv[i]);
- description = arv_gc_feature_node_get_description (node);
+ description = arv_gc_feature_node_get_description (ARV_GC_FEATURE_NODE (node));
if (description)
printf ("%s\n", description);
}
@@ -102,7 +104,7 @@ arv_tool_execute_command (int argc, char **argv, const char *device_name)
int i;
for (i = 2; i < argc; i++) {
- ArvGcFeatureNode *feature;
+ ArvGcNode *feature;
char **tokens;
tokens = g_strsplit (argv[i], "=", 2);
@@ -133,10 +135,11 @@ arv_tool_execute_command (int argc, char **argv, const char *device_name)
printf ("%s executed\n", tokens[0]);
} else {
if (tokens[1] != NULL)
- arv_gc_feature_node_set_value_from_string (feature, tokens[1]);
+ arv_gc_feature_node_set_value_from_string (ARV_GC_FEATURE_NODE (feature),
+ tokens[1]);
printf ("%s = %s\n", tokens[0],
- arv_gc_feature_node_get_value_as_string (feature));
+ arv_gc_feature_node_get_value_as_string (ARV_GC_FEATURE_NODE (feature)));
}
}
g_strfreev (tokens);
diff --git a/tests/arvgenicamtest.c b/tests/arvgenicamtest.c
index cc4823f..c6d3895 100644
--- a/tests/arvgenicamtest.c
+++ b/tests/arvgenicamtest.c
@@ -48,7 +48,7 @@ main (int argc, char **argv)
g_file_get_contents (arv_option_filenames[i], &xml, &size, NULL);
if (xml != NULL) {
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
g_print ("Loading '%s'.\n", arv_option_filenames[i]);
diff --git a/tests/arvheartbeattest.c b/tests/arvheartbeattest.c
index 56e9e3b..3241502 100644
--- a/tests/arvheartbeattest.c
+++ b/tests/arvheartbeattest.c
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
arv_camera_set_acquisition_mode(camera, ARV_ACQUISITION_MODE_CONTINUOUS);
- feature = arv_device_get_feature (device, arv_option_feature_name);
+ feature = ARV_GC_FEATURE_NODE (arv_device_get_feature (device, arv_option_feature_name));
arv_camera_start_acquisition (camera);
diff --git a/tests/arvtest.c b/tests/arvtest.c
index 987621a..7d22bde 100644
--- a/tests/arvtest.c
+++ b/tests/arvtest.c
@@ -77,7 +77,7 @@ main (int argc, char **argv)
device = arv_open_device (arv_option_camera_name);
if (device != NULL) {
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
guint32 value;
guint32 maximum;
guint32 minimum;
diff --git a/tests/fake.c b/tests/fake.c
index 51db9be..e4dc94f 100644
--- a/tests/fake.c
+++ b/tests/fake.c
@@ -20,7 +20,7 @@ trigger_registers_test (void)
{
ArvDevice *device;
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
gint64 address;
device = arv_fake_device_new ("TEST0");
diff --git a/tests/genicam.c b/tests/genicam.c
index f39e289..06e311a 100644
--- a/tests/genicam.c
+++ b/tests/genicam.c
@@ -6,7 +6,7 @@ integer_test (void)
{
ArvDevice *device;
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
gint64 v_int64;
const char *v_string;
@@ -22,7 +22,7 @@ integer_test (void)
v_int64 = arv_gc_integer_get_value (ARV_GC_INTEGER (node));
g_assert_cmpint (v_int64, ==, 1);
- v_string = arv_gc_feature_node_get_value_as_string (node);
+ v_string = arv_gc_feature_node_get_value_as_string (ARV_GC_FEATURE_NODE (node));
g_assert_cmpstr (v_string, ==, "1");
g_object_unref (device);
@@ -33,7 +33,7 @@ boolean_test (void)
{
ArvDevice *device;
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
gboolean v_boolean;
const char *v_string;
@@ -49,7 +49,7 @@ boolean_test (void)
v_boolean = arv_gc_boolean_get_value (ARV_GC_BOOLEAN (node));
g_assert_cmpint (v_boolean, ==, TRUE);
- v_string = arv_gc_feature_node_get_value_as_string (node);
+ v_string = arv_gc_feature_node_get_value_as_string (ARV_GC_FEATURE_NODE (node));
g_assert_cmpstr (v_string, ==, "true");
g_object_unref (device);
@@ -60,7 +60,7 @@ float_test (void)
{
ArvDevice *device;
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
double v_double;
const char *v_string;
@@ -76,7 +76,7 @@ float_test (void)
v_double = arv_gc_float_get_value (ARV_GC_FLOAT (node));
g_assert_cmpfloat (v_double, ==, 0.1);
- v_string = arv_gc_feature_node_get_value_as_string (node);
+ v_string = arv_gc_feature_node_get_value_as_string (ARV_GC_FEATURE_NODE (node));
g_assert_cmpstr (v_string, ==, "0.1");
g_object_unref (device);
@@ -87,7 +87,7 @@ enumeration_test (void)
{
ArvDevice *device;
ArvGc *genicam;
- ArvGcFeatureNode *node;
+ ArvGcNode *node;
gint64 v_int64;
gint64 *values;
guint n_values;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]