[aravis/error] genicam: WIP for error handling.



commit 60743b16318278ea015b3ae252f0baa5c0ada505
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Fri May 4 22:37:43 2012 +0200

    genicam: WIP for error handling.

 src/arvcamera.c         |    6 +--
 src/arvdevice.h         |   15 +++++
 src/arvgcboolean.c      |  111 ++++++++++++++++++++++++++-------
 src/arvgcboolean.h      |    5 +-
 src/arvgcenumentry.c    |   19 +++++-
 src/arvgcenumentry.h    |    3 +-
 src/arvgcenumeration.c  |  162 +++++++++++++++++++++++++++++++++++++++--------
 src/arvgcenumeration.h  |   12 ++--
 src/arvgcfeaturenode.c  |  123 ++++++++++++++++++++++++++++++------
 src/arvgcfeaturenode.h  |   25 +++++---
 src/arvgcfloat.h        |   32 +++++-----
 src/arvgcindexnode.c    |   22 ++++++-
 src/arvgcindexnode.h    |    2 +-
 src/arvgcinteger.h      |   32 +++++-----
 src/arvgcintegernode.c  |  147 ++++++++++++++++++++++++++++++++----------
 src/arvgcpropertynode.c |   85 ++++++++++++++++++++-----
 src/arvgcpropertynode.h |   13 ++--
 src/arvgcstring.h       |   12 ++--
 18 files changed, 632 insertions(+), 194 deletions(-)
---
diff --git a/src/arvcamera.c b/src/arvcamera.c
index c450036..4b5672e 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -362,13 +362,9 @@ arv_camera_get_pixel_format_as_string (ArvCamera *camera)
 gint64 *
 arv_camera_get_available_pixel_formats (ArvCamera *camera, guint *n_pixel_formats)
 {
-	ArvGcNode *enumeration;
-
 	g_return_val_if_fail (ARV_IS_CAMERA (camera), NULL);
 
-	enumeration = arv_gc_get_node (camera->priv->genicam, "PixelFormat");
-
-	return arv_gc_enumeration_get_available_int_values (ARV_GC_ENUMERATION (enumeration), n_pixel_formats);
+	return arv_device_get_enumeration_feature_available_values (camera->priv->device, "PixelFormat", n_pixel_formats);
 }
 
 /* Acquisition control */
diff --git a/src/arvdevice.h b/src/arvdevice.h
index 02560eb..8cf9492 100644
--- a/src/arvdevice.h
+++ b/src/arvdevice.h
@@ -28,6 +28,19 @@
 
 G_BEGIN_DECLS
 
+/**
+ * ArvDeviceStatus:
+ * @ARV_DEVICE_STATUS_SUCCESS: no error has occured
+ * @ARV_DEVICE_STATUS_TIMEOUT: action failed on a timeout
+ * @ARV_DEVICE_STATUS_WRITE_ERROR: write on a read only node
+ */
+
+typedef enum {
+	ARV_DEVICE_STATUS_SUCCESS,
+	ARV_DEVICE_STATUS_TIMEOUT,
+	ARV_DEVICE_STATUS_WRITE_ERROR
+} ArvDeviceStatus;
+
 #define ARV_TYPE_DEVICE             (arv_device_get_type ())
 #define ARV_DEVICE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_DEVICE, ArvDevice))
 #define ARV_DEVICE_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_DEVICE, ArvDeviceClass))
@@ -88,6 +101,8 @@ double		arv_device_get_float_feature_value	(ArvDevice *device, const char *featu
 void 		arv_device_get_float_feature_bounds 	(ArvDevice *device, const char *feature,
 							 double *min, double *max);
 
+gint64 *	arv_device_get_enumeration_feature_available_values	(ArvDevice *device, const char *feature, guint *n_values);
+
 void 		arv_device_emit_control_lost_signal 	(ArvDevice *device);
 
 G_END_DECLS
diff --git a/src/arvgcboolean.c b/src/arvgcboolean.c
index d9cfdc1..14582cf 100644
--- a/src/arvgcboolean.c
+++ b/src/arvgcboolean.c
@@ -75,58 +75,125 @@ arv_gc_boolean_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
 /* ArvGcFeatureNode implementation */
 
 static void
-arv_gc_boolean_set_value_from_string (ArvGcFeatureNode *node, const char *string)
+arv_gc_boolean_set_value_from_string (ArvGcFeatureNode *node, const char *string, GError **error)
 {
-	arv_gc_boolean_set_value (ARV_GC_BOOLEAN (node), g_strcmp0 (string, "true") == 0);
+	GError *local_error = NULL;
+
+	arv_gc_boolean_set_value (ARV_GC_BOOLEAN (node), g_strcmp0 (string, "true") == 0, &local_error);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 static const char *
-arv_gc_boolean_get_value_as_string (ArvGcFeatureNode *node)
+arv_gc_boolean_get_value_as_string (ArvGcFeatureNode *node, GError **error)
 {
-	return arv_gc_boolean_get_value (ARV_GC_BOOLEAN (node)) ? "true" : "false";
+	const char *string;
+	GError *local_error = NULL;
+
+	string = arv_gc_boolean_get_value (ARV_GC_BOOLEAN (node), &local_error) ? "true" : "false";
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
+
+	return string;
 }
 
 /* ArvGcBoolean implementation */
 
 static gint64
-arv_gc_boolean_get_on_value (ArvGcBoolean *gc_boolean)
+arv_gc_boolean_get_on_value (ArvGcBoolean *gc_boolean, GError **error)
 {
-	if (gc_boolean->on_value != NULL)
-		return arv_gc_property_node_get_int64 (gc_boolean->on_value);
+	gint64 on_value;
+	GError *local_error = NULL;
+
+	if (gc_boolean->on_value == NULL)
+		return 1;
 
-	return 1;
+	on_value = arv_gc_property_node_get_int64 (gc_boolean->on_value, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 1;
+	}
+
+	return on_value;
 }
 
 static gint64
-arv_gc_boolean_get_off_value (ArvGcBoolean *gc_boolean)
+arv_gc_boolean_get_off_value (ArvGcBoolean *gc_boolean, GError **error)
 {
-	if (gc_boolean->off_value != NULL)
-		return arv_gc_property_node_get_int64 (gc_boolean->off_value);
+	gint64 off_value;
+	GError *local_error = NULL;
+
+	if (gc_boolean->off_value == NULL)
+		return 0;
+
+	off_value = arv_gc_property_node_get_int64 (gc_boolean->off_value, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 0;
+	}
 
-	return 0;
+	return off_value;
 }
 
 gboolean
-arv_gc_boolean_get_value (ArvGcBoolean *gc_boolean)
+arv_gc_boolean_get_value (ArvGcBoolean *gc_boolean, GError **error)
 {
+	gboolean value;
+	gint64 on_value;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_BOOLEAN (gc_boolean), FALSE);
+	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-	if (gc_boolean->value != NULL)
-		return arv_gc_property_node_get_int64 (gc_boolean->value) == arv_gc_boolean_get_on_value (gc_boolean);
+	if (gc_boolean->value == NULL)
+		return FALSE;
 
-	return FALSE;
+	value = arv_gc_property_node_get_int64 (gc_boolean->value, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+       	on_value = arv_gc_boolean_get_on_value (gc_boolean, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+	return value == on_value;
 }
 
 void
-arv_gc_boolean_set_value (ArvGcBoolean *gc_boolean, gboolean v_boolean)
+arv_gc_boolean_set_value (ArvGcBoolean *gc_boolean, gboolean v_boolean, GError **error)
 {
+	gboolean value;
+	GError *local_error = NULL;
+
 	g_return_if_fail (ARV_IS_GC_BOOLEAN (gc_boolean));
+	g_return_if_fail (error == NULL || *error == NULL);
+
+	if (v_boolean)
+		value = arv_gc_boolean_get_on_value (gc_boolean, &local_error);
+	else
+		value = arv_gc_boolean_get_off_value (gc_boolean, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return;
+	}
+
+	arv_gc_property_node_set_int64 (gc_boolean->value, value, &local_error);
 
-	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));
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 ArvGcNode *
diff --git a/src/arvgcboolean.h b/src/arvgcboolean.h
index d5f3893..4e657e3 100644
--- a/src/arvgcboolean.h
+++ b/src/arvgcboolean.h
@@ -52,8 +52,9 @@ struct _ArvGcBooleanClass {
 
 GType 		arv_gc_boolean_get_type 	(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);
+
+gboolean 	arv_gc_boolean_get_value 	(ArvGcBoolean *gc_boolean, GError **error);
+void 		arv_gc_boolean_set_value 	(ArvGcBoolean *gc_boolean, gboolean v_boolean, GError **error);
 
 G_END_DECLS
 
diff --git a/src/arvgcenumentry.c b/src/arvgcenumentry.c
index 8ee3fcf..b75a834 100644
--- a/src/arvgcenumentry.c
+++ b/src/arvgcenumentry.c
@@ -70,14 +70,25 @@ arv_gc_integer_node_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
 /* ArvGcEnumEntry implementation */
 
 gint64
-arv_gc_enum_entry_get_value (ArvGcEnumEntry *entry)
+arv_gc_enum_entry_get_value (ArvGcEnumEntry *entry, GError **error)
 {
+	gint64 value;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_ENUM_ENTRY (entry), 0);
+	g_return_val_if_fail (error == NULL || *error == NULL, 0);
+
+	if (entry->value == NULL)
+		return 0;
 
-	if (entry->value != NULL)
-		return arv_gc_property_node_get_int64 (entry->value);
+	value = arv_gc_property_node_get_int64 (entry->value, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 0;
+	}
 
-	return 0;
+	return value;
 }
 
 ArvGcNode *
diff --git a/src/arvgcenumentry.h b/src/arvgcenumentry.h
index fd4ac30..25529ac 100644
--- a/src/arvgcenumentry.h
+++ b/src/arvgcenumentry.h
@@ -50,7 +50,8 @@ struct _ArvGcEnumEntryClass {
 
 GType 		arv_gc_enum_entry_get_type 	(void);
 ArvGcNode * 	arv_gc_enum_entry_new 		(void);
-gint64		arv_gc_enum_entry_get_value	(ArvGcEnumEntry *entry);
+
+gint64		arv_gc_enum_entry_get_value	(ArvGcEnumEntry *entry, GError **error);
 
 G_END_DECLS
 
diff --git a/src/arvgcenumeration.c b/src/arvgcenumeration.c
index 9187039..113d882 100644
--- a/src/arvgcenumeration.c
+++ b/src/arvgcenumeration.c
@@ -78,32 +78,63 @@ arv_gc_enumeration_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
 /* ArvGcFeatureNode implementation */
 
 static void
-arv_gc_enumeration_set_value_from_string (ArvGcFeatureNode *node, const char *string)
+arv_gc_enumeration_set_value_from_string (ArvGcFeatureNode *node, const char *string, GError **error)
 {
-	arv_gc_enumeration_set_string_value (ARV_GC_ENUMERATION (node), string);
+	GError *local_error = NULL;
+
+	arv_gc_enumeration_set_string_value (ARV_GC_ENUMERATION (node), string, &local_error);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 static const char *
-arv_gc_enumeration_get_value_as_string (ArvGcFeatureNode *node)
+arv_gc_enumeration_get_value_as_string (ArvGcFeatureNode *node, GError **error)
 {
-	return arv_gc_enumeration_get_string_value (ARV_GC_ENUMERATION (node));
+	const char *string;
+	GError *local_error = NULL;
+
+	string = arv_gc_enumeration_get_string_value (ARV_GC_ENUMERATION (node), &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
+
+	return string;
 }
 
 
 /* ArvGcEnumeration implementation */
 
 const char *
-arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration)
+arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration, GError **error)
 {
 	const GSList *iter;
+	GError *local_error = NULL;
 	gint64 value;
 
 	g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL);
+	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+	value = arv_gc_enumeration_get_int_value (enumeration, &local_error);
 
-	value = arv_gc_enumeration_get_int_value (enumeration);
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
 
 	for (iter = enumeration->entries; iter != NULL; iter = iter->next) {
-		if (arv_gc_enum_entry_get_value (iter->data) == value) {
+		gint64 enum_value;
+
+		enum_value = arv_gc_enum_entry_get_value (iter->data, &local_error);
+
+		if (local_error != NULL) {
+			g_propagate_error (error, local_error);
+			return NULL;
+		}
+
+		if (enum_value == value) {
 			const char *string;
 
 			string = arv_gc_feature_node_get_name (iter->data);
@@ -120,17 +151,33 @@ arv_gc_enumeration_get_string_value (ArvGcEnumeration *enumeration)
 }
 
 void
-arv_gc_enumeration_set_string_value (ArvGcEnumeration *enumeration, const char *value)
+arv_gc_enumeration_set_string_value (ArvGcEnumeration *enumeration, const char *value, GError **error)
 {
 	const GSList *iter;
 
 	g_return_if_fail (ARV_IS_GC_ENUMERATION (enumeration));
+	g_return_if_fail (error == NULL || *error == NULL);
 
 	for (iter = enumeration->entries; iter != NULL; iter = iter->next)
 		if (g_strcmp0 (arv_gc_feature_node_get_name (iter->data), value) == 0) {
+			GError *local_error = NULL;
+			gint64 enum_value;
+
 			arv_log_genicam ("[GcEnumeration::set_string_value] value = %d - string = %s",
 					 &enumeration->value, value);
-			arv_gc_enumeration_set_int_value (enumeration, arv_gc_enum_entry_get_value (iter->data));
+
+			enum_value = arv_gc_enum_entry_get_value (iter->data, &local_error);
+
+			if (local_error != NULL) {
+				g_propagate_error (error, local_error);
+				return;
+			}
+
+			arv_gc_enumeration_set_int_value (enumeration, enum_value, &local_error);
+
+			if (local_error != NULL)
+				g_propagate_error (error, local_error);
+
 			return;
 		}
 
@@ -138,58 +185,119 @@ arv_gc_enumeration_set_string_value (ArvGcEnumeration *enumeration, const char *
 }
 
 gint64
-arv_gc_enumeration_get_int_value (ArvGcEnumeration *enumeration)
+arv_gc_enumeration_get_int_value (ArvGcEnumeration *enumeration, GError **error)
 {
+	GError *local_error = NULL;
+	gint64 value;
+
 	g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), 0);
+	g_return_val_if_fail (error == NULL || *error == NULL, 0);
+
+	if (enumeration->value == NULL) 
+		return 0;
 
-	if (enumeration->value != NULL)
-		return arv_gc_property_node_get_int64 (enumeration->value);
+	value = arv_gc_property_node_get_int64 (enumeration->value, &local_error);
 
-	return 0;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 0;
+	}
+
+	return value;
 }
 
 gint64 *
-arv_gc_enumeration_get_available_int_values (ArvGcEnumeration *enumeration, guint *n_values)
+arv_gc_enumeration_get_available_int_values (ArvGcEnumeration *enumeration, guint *n_values, GError **error)
 {
 	gint64 *values;
 	const GSList *entries, *iter;
+	GSList *available_entries = NULL;
 	unsigned int i;
+	GError *local_error = NULL;
 
 	g_return_val_if_fail (n_values != NULL, NULL);
 
 	*n_values = 0;
 
 	g_return_val_if_fail (ARV_IS_GC_ENUMERATION (enumeration), NULL);
+	g_return_val_if_fail (error == NULL || *error != NULL, NULL);
 
 	entries = arv_gc_enumeration_get_entries (enumeration);
 
 	*n_values = 0;
-	for (iter = entries; iter != NULL; iter = iter->next)
-		if (arv_gc_feature_node_is_available (iter->data) &&
-		    arv_gc_feature_node_is_implemented (iter->data))
-		    (*n_values)++;
+	for (iter = entries; iter != NULL; iter = iter->next) {
+		gboolean is_available;
+
+		is_available = arv_gc_feature_node_is_available (iter->data, &local_error);
+
+		if (local_error != NULL) {
+			g_propagate_error (error, local_error);
+			*n_values = 0;
+			g_slist_free (available_entries);
+
+			return NULL;
+		}
+
+		if (is_available) {
+			gboolean is_implemented;
+
+			is_implemented = arv_gc_feature_node_is_implemented (iter->data, &local_error);
+
+			if (local_error != NULL) {
+				g_propagate_error (error, local_error);
+				*n_values = 0;
+				g_slist_free (available_entries);
+
+				return NULL;
+			}
+
+			if (is_implemented) {
+				(*n_values)++;
+				available_entries = g_slist_prepend (available_entries, iter->data);
+			}
+		}
+	}
 
-	if (*n_values == 0)
+	if (*n_values == 0) {
+		g_slist_free (available_entries);
 		return NULL;
+	}
 
 	values = g_new (gint64, *n_values);
-	for (iter = entries, i = 0; iter != NULL; iter = iter->next)
-		if (arv_gc_feature_node_is_available (iter->data) &&
-		    arv_gc_feature_node_is_implemented (iter->data)) {
-			values[i] = arv_gc_enum_entry_get_value (iter->data);
-			i++;
+	for (iter = available_entries, i = 0; iter != NULL; iter = iter->next) {
+
+		values[i] = arv_gc_enum_entry_get_value (iter->data, &local_error);
+
+		if (local_error != NULL) {
+			g_propagate_error (error, local_error);
+			*n_values = 0;
+			g_slist_free (available_entries);
+			g_free (values);
+
+			return NULL;
 		}
+		i++;
+	}
+
+	g_slist_free (available_entries);
 
 	return values;
 }
 
 void
-arv_gc_enumeration_set_int_value (ArvGcEnumeration *enumeration, gint64 value)
+arv_gc_enumeration_set_int_value (ArvGcEnumeration *enumeration, gint64 value, GError **error)
 {
 	g_return_if_fail (ARV_IS_GC_ENUMERATION (enumeration));
+	g_return_if_fail (error == NULL || *error == NULL);
+
+	if (enumeration->value) {
+		GError *local_error = NULL;
 
-	if (enumeration->value)
-		arv_gc_property_node_set_int64 (enumeration->value, value);
+		arv_gc_property_node_set_int64 (enumeration->value, value, &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+	}
 }
 
 /**
diff --git a/src/arvgcenumeration.h b/src/arvgcenumeration.h
index 1993622..aa0c093 100644
--- a/src/arvgcenumeration.h
+++ b/src/arvgcenumeration.h
@@ -51,12 +51,14 @@ struct _ArvGcEnumerationClass {
 
 GType 		arv_gc_enumeration_get_type 	(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);
+
+const char *	arv_gc_enumeration_get_string_value		(ArvGcEnumeration *enumeration, GError **error);
+void		arv_gc_enumeration_set_string_value		(ArvGcEnumeration *enumeration, const char *value, GError **error);
+gint64 		arv_gc_enumeration_get_int_value		(ArvGcEnumeration *enumeration, GError **error);
+void		arv_gc_enumeration_set_int_value		(ArvGcEnumeration *enumeration, gint64 value, GError **error);
+gint64 *	arv_gc_enumeration_get_available_int_values	(ArvGcEnumeration *enumeration,	guint *n_values, GError **error);
 
 G_END_DECLS
 
diff --git a/src/arvgcfeaturenode.c b/src/arvgcfeaturenode.c
index 3d1b1db..9417d73 100644
--- a/src/arvgcfeaturenode.c
+++ b/src/arvgcfeaturenode.c
@@ -183,54 +183,135 @@ arv_gc_feature_node_get_name (ArvGcFeatureNode *node)
 }
 
 const char *
-arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *node)
+arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *node, GError **error)
 {
+	const char *tooltip;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
+	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+	if (node->priv->tooltip == NULL)
+		return NULL;
+
+	tooltip = arv_gc_property_node_get_string (node->priv->tooltip, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
 
-	return node->priv->tooltip != NULL ? arv_gc_property_node_get_string (node->priv->tooltip) : NULL;
+	return tooltip;
 }
 
 const char *
-arv_gc_feature_node_get_description (ArvGcFeatureNode *node)
+arv_gc_feature_node_get_description (ArvGcFeatureNode *node, GError **error)
 {
+	const char *description;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
+	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+	if (node->priv->description == NULL)
+	       return NULL;
+
+	description = arv_gc_property_node_get_string (node->priv->description, &local_error);
 
-	return node->priv->description != NULL ? arv_gc_property_node_get_string (node->priv->description) : NULL;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
+
+	return description;
 }
 
 const char *
-arv_gc_feature_node_get_display_name (ArvGcFeatureNode *node)
+arv_gc_feature_node_get_display_name (ArvGcFeatureNode *node, GError **error)
 {
+	const char *display_name;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (node), NULL);
+	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+	if (node->priv->display_name == NULL)
+	       return NULL;
 
-	return node->priv->display_name != NULL ? arv_gc_property_node_get_string (node->priv->display_name) : NULL;
+	display_name = arv_gc_property_node_get_string (node->priv->display_name, &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
+
+	return display_name;
 }
 
 gboolean
-arv_gc_feature_node_is_implemented (ArvGcFeatureNode *gc_feature_node)
+arv_gc_feature_node_is_implemented (ArvGcFeatureNode *gc_feature_node, GError **error)
 {
+	gboolean value;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
+	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-	return (gc_feature_node->priv->is_implemented == NULL || 
-		 arv_gc_property_node_get_int64 (gc_feature_node->priv->is_implemented) != 0);
+	if (gc_feature_node->priv->is_implemented == NULL)
+		return TRUE;
+
+
+	value = arv_gc_property_node_get_int64 (gc_feature_node->priv->is_implemented, &local_error) != 0;
+
+	if (local_error == NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+	return value;
 }
 
 gboolean
-arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node)
+arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node, GError **error)
 {
+	gboolean value;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
+	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+	if (gc_feature_node->priv->is_available == NULL)
+		return TRUE;
+
+	value = arv_gc_property_node_get_int64 (gc_feature_node->priv->is_available, &local_error) != 0;
 
-	return (gc_feature_node->priv->is_available == NULL || 
-		 arv_gc_property_node_get_int64 (gc_feature_node->priv->is_available) != 0);
+	if (local_error == NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+	return value;
 }
 
 gboolean
-arv_gc_feature_node_is_locked (ArvGcFeatureNode *gc_feature_node)
+arv_gc_feature_node_is_locked (ArvGcFeatureNode *gc_feature_node, GError **error)
 {
+	gboolean value;
+	GError *local_error = NULL;
+
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
 
-	return (gc_feature_node->priv->is_locked != NULL && 
-		 arv_gc_property_node_get_int64 (gc_feature_node->priv->is_locked) != 0);
+	if (gc_feature_node->priv->is_locked == NULL)
+		return FALSE;
+
+	value = arv_gc_property_node_get_int64 (gc_feature_node->priv->is_locked, &local_error) != 0;
+
+	if (local_error == NULL) {
+		g_propagate_error (error, local_error);
+		return FALSE;
+	}
+
+	return value;
 }
 
 ArvGcFeatureNode *
@@ -261,26 +342,29 @@ arv_gc_feature_node_get_value_type (ArvGcFeatureNode *node)
  * arv_gc_feature_node_set_value_from_string:
  * @gc_feature_node: a #ArvGcFeatureNode
  * @string: new node value, as string
+ * @error: return location for a GError, or NULL
  *
  * Set the node value using a string representation of the value. May not be applicable to every node type, but safe.
  */
 
 void
-arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, const char *string)
+arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, const char *string, GError **error)
 {
 	ArvGcFeatureNodeClass *node_class;
 
 	g_return_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node));
+	g_return_if_fail (error == NULL || *error == NULL);
 	g_return_if_fail (string != NULL);
 
 	node_class = ARV_GC_FEATURE_NODE_GET_CLASS (gc_feature_node);
 	if (node_class->set_value_from_string != NULL)
-		node_class->set_value_from_string (gc_feature_node, string);
+		node_class->set_value_from_string (gc_feature_node, string, error);
 }
 
 /**
  * arv_gc_feature_node_get_value_as_string:
  * @gc_feature_node: a #ArvGcFeatureNode
+ * @error: return location for a GError, or NULL
  *
  * Retrieve the node value a string.
  *
@@ -290,15 +374,16 @@ arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, co
  */
 
 const char *
-arv_gc_feature_node_get_value_as_string (ArvGcFeatureNode *gc_feature_node)
+arv_gc_feature_node_get_value_as_string (ArvGcFeatureNode *gc_feature_node, GError **error)
 {
 	ArvGcFeatureNodeClass *node_class;
 
 	g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), NULL);
+	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
 	node_class = ARV_GC_FEATURE_NODE_GET_CLASS (gc_feature_node);
 	if (node_class->get_value_as_string != NULL)
-		return node_class->get_value_as_string (gc_feature_node);
+		return node_class->get_value_as_string (gc_feature_node, error);
 
 	return NULL;
 }
diff --git a/src/arvgcfeaturenode.h b/src/arvgcfeaturenode.h
index ad23e2c..395d5c7 100644
--- a/src/arvgcfeaturenode.h
+++ b/src/arvgcfeaturenode.h
@@ -48,22 +48,29 @@ struct _ArvGcFeatureNodeClass {
 	ArvGcNodeClass parent_class;
 
 	GType		(*get_value_type)		(ArvGcFeatureNode *gc_feature_node);
-	void		(*set_value_from_string)	(ArvGcFeatureNode *gc_feature_node, const char *string);
-	const char *	(*get_value_as_string)		(ArvGcFeatureNode *gc_feature_node);
+
+	void		(*set_value_from_string)	(ArvGcFeatureNode *gc_feature_node, const char *string, GError **error);
+	const char *	(*get_value_as_string)		(ArvGcFeatureNode *gc_feature_node, GError **error);
 };
 
 GType 			arv_gc_feature_node_get_type 			(void);
 
 ArvGcFeatureNode * 	arv_gc_feature_node_new 			(void);
+
 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);
-gboolean		arv_gc_feature_node_is_implemented		(ArvGcFeatureNode *gc_feature_node);
-gboolean		arv_gc_feature_node_is_locked			(ArvGcFeatureNode *gc_feature_node);
+
+const char *		arv_gc_feature_node_get_tooltip			(ArvGcFeatureNode *gc_feature_node, GError **error);
+const char *		arv_gc_feature_node_get_description		(ArvGcFeatureNode *gc_feature_node, GError **error);
+
+gboolean		arv_gc_feature_node_is_available		(ArvGcFeatureNode *gc_feature_node, GError **error);
+gboolean		arv_gc_feature_node_is_implemented		(ArvGcFeatureNode *gc_feature_node, GError **error);
+gboolean		arv_gc_feature_node_is_locked			(ArvGcFeatureNode *gc_feature_node, GError **error);
+void			arv_gc_feature_node_set_value_from_string	(ArvGcFeatureNode *gc_feature_node, const char *string,
+									 GError **error);
+const char *		arv_gc_feature_node_get_value_as_string		(ArvGcFeatureNode *gc_feature_node, GError **error);
+
 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);
 
diff --git a/src/arvgcfloat.h b/src/arvgcfloat.h
index d9556f1..4e40e8e 100644
--- a/src/arvgcfloat.h
+++ b/src/arvgcfloat.h
@@ -37,26 +37,26 @@ typedef struct _ArvGcFloatInterface ArvGcFloatInterface;
 struct _ArvGcFloatInterface {
 	GTypeInterface parent;
 
-	double		(*get_value)		(ArvGcFloat *gc_float);
-	void		(*set_value)		(ArvGcFloat *gc_float, double value);
-	double		(*get_min)		(ArvGcFloat *gc_float);
-	double		(*get_max)		(ArvGcFloat *gc_float);
-	double		(*get_inc)		(ArvGcFloat *gc_float);
-	const char *	(*get_unit)		(ArvGcFloat *gc_float);
-	void		(*impose_min)		(ArvGcFloat *gc_float, double minimum);
-	void		(*impose_max)		(ArvGcFloat *gc_float, double maximum);
+	double		(*get_value)		(ArvGcFloat *gc_float, GError **error);
+	void		(*set_value)		(ArvGcFloat *gc_float, double value, GError **error);
+	double		(*get_min)		(ArvGcFloat *gc_float, GError **error);
+	double		(*get_max)		(ArvGcFloat *gc_float, GError **error);
+	double		(*get_inc)		(ArvGcFloat *gc_float, GError **error);
+	const char *	(*get_unit)		(ArvGcFloat *gc_float, GError **error);
+	void		(*impose_min)		(ArvGcFloat *gc_float, double minimum, GError **error);
+	void		(*impose_max)		(ArvGcFloat *gc_float, double maximum, GError **error);
 };
 
 GType arv_gc_float_get_type (void);
 
-double		arv_gc_float_get_value		(ArvGcFloat *gc_float);
-void		arv_gc_float_set_value		(ArvGcFloat *gc_float, double value);
-double		arv_gc_float_get_min		(ArvGcFloat *gc_float);
-double		arv_gc_float_get_max		(ArvGcFloat *gc_float);
-double		arv_gc_float_get_inc		(ArvGcFloat *gc_float);
-const char *	arv_gc_float_get_unit		(ArvGcFloat *gc_float);
-void		arv_gc_float_impose_min		(ArvGcFloat *gc_float, double minimum);
-void		arv_gc_float_impose_max		(ArvGcFloat *gc_float, double maximum);
+double		arv_gc_float_get_value		(ArvGcFloat *gc_float, GError **error);
+void		arv_gc_float_set_value		(ArvGcFloat *gc_float, double value, GError **error);
+double		arv_gc_float_get_min		(ArvGcFloat *gc_float, GError *error);
+double		arv_gc_float_get_max		(ArvGcFloat *gc_float, GError *error);
+double		arv_gc_float_get_inc		(ArvGcFloat *gc_float, GError *error);
+const char *	arv_gc_float_get_unit		(ArvGcFloat *gc_float, GError *error);
+void		arv_gc_float_impose_min		(ArvGcFloat *gc_float, double minimum, GError **error);
+void		arv_gc_float_impose_max		(ArvGcFloat *gc_float, double maximum, GError **error);
 
 /* FIXME get_representation, has_inc and get_inc are missing */
 
diff --git a/src/arvgcindexnode.c b/src/arvgcindexnode.c
index 4c983d2..134c38a 100644
--- a/src/arvgcindexnode.c
+++ b/src/arvgcindexnode.c
@@ -78,11 +78,14 @@ arv_gc_index_node_get_attribute (ArvDomElement *self, const char *name)
 /* ArvGcIndexNode implementation */
 
 gint64
-arv_gc_index_node_get_index (ArvGcIndexNode *index_node, gint64 default_offset)
+arv_gc_index_node_get_index (ArvGcIndexNode *index_node, gint64 default_offset, GError **error)
 {
 	gint64 offset;
+	gint64 node_value;
+	GError *local_error = NULL;
 
 	g_return_val_if_fail (ARV_IS_GC_INDEX_NODE (index_node), 0);
+	g_return_val_if_fail (error == NULL || *error == NULL, 0);
 
 	if (index_node->offset == NULL)
 		offset = default_offset;
@@ -93,12 +96,25 @@ arv_gc_index_node_get_index (ArvGcIndexNode *index_node, gint64 default_offset)
 
 			genicam = arv_gc_node_get_genicam (ARV_GC_NODE (index_node));
 			node = arv_gc_get_node (genicam, index_node->offset);
-			offset = arv_gc_integer_get_value (ARV_GC_INTEGER (node));
+			offset = arv_gc_integer_get_value (ARV_GC_INTEGER (node), &local_error);
+
+			if (local_error != NULL) {
+				g_propagate_error (error, local_error);
+
+				return 0;
+			}
 		} else
 			offset = g_ascii_strtoll (index_node->offset, NULL, 0);
 	}
 
-	return offset * arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (index_node));
+	node_value = arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (index_node), &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 0;
+	}
+
+	return offset * node_value;
 }
 
 ArvGcNode *
diff --git a/src/arvgcindexnode.h b/src/arvgcindexnode.h
index b29abee..ceca1bd 100644
--- a/src/arvgcindexnode.h
+++ b/src/arvgcindexnode.h
@@ -50,7 +50,7 @@ struct _ArvGcIndexNodeClass {
 
 GType 		arv_gc_index_node_get_type 	(void);
 ArvGcNode * 	arv_gc_index_node_new 		(void);
-gint64		arv_gc_index_node_get_index	(ArvGcIndexNode *index_node, gint64 default_offset);
+gint64		arv_gc_index_node_get_index	(ArvGcIndexNode *index_node, gint64 default_offset, GError **error);
 
 G_END_DECLS
 
diff --git a/src/arvgcinteger.h b/src/arvgcinteger.h
index dca0525..eb7123d 100644
--- a/src/arvgcinteger.h
+++ b/src/arvgcinteger.h
@@ -37,26 +37,26 @@ typedef struct _ArvGcIntegerInterface ArvGcIntegerInterface;
 struct _ArvGcIntegerInterface {
 	GTypeInterface parent;
 
-	gint64		(*get_value)		(ArvGcInteger *gc_integer);
-	void		(*set_value)		(ArvGcInteger *gc_integer, gint64 value);
-	gint64		(*get_min)		(ArvGcInteger *gc_integer);
-	gint64		(*get_max)		(ArvGcInteger *gc_integer);
-	gint64		(*get_inc)		(ArvGcInteger *gc_integer);
-	const char *	(*get_unit)		(ArvGcInteger *gc_integer);
-	void		(*impose_min)		(ArvGcInteger *gc_integer, gint64 minimum);
-	void		(*impose_max)		(ArvGcInteger *gc_integer, gint64 maximum);
+	gint64		(*get_value)		(ArvGcInteger *gc_integer, GError **error);
+	void		(*set_value)		(ArvGcInteger *gc_integer, gint64 value, GError **error);
+	gint64		(*get_min)		(ArvGcInteger *gc_integer, GError **error);
+	gint64		(*get_max)		(ArvGcInteger *gc_integer, GError **error);
+	gint64		(*get_inc)		(ArvGcInteger *gc_integer, GError **error);
+	const char *	(*get_unit)		(ArvGcInteger *gc_integer, GError **error);
+	void		(*impose_min)		(ArvGcInteger *gc_integer, gint64 minimum, GError **error);
+	void		(*impose_max)		(ArvGcInteger *gc_integer, gint64 maximum, GError **error);
 };
 
 GType arv_gc_integer_get_type (void);
 
-gint64		arv_gc_integer_get_value	(ArvGcInteger *gc_integer);
-void		arv_gc_integer_set_value	(ArvGcInteger *gc_integer, gint64 value);
-gint64		arv_gc_integer_get_min		(ArvGcInteger *gc_integer);
-gint64		arv_gc_integer_get_max		(ArvGcInteger *gc_integer);
-gint64		arv_gc_integer_get_inc		(ArvGcInteger *gc_integer);
-const char *	arv_gc_integer_get_unit		(ArvGcInteger *gc_integer);
-void		arv_gc_integer_impose_min	(ArvGcInteger *gc_integer, gint64 minimum);
-void		arv_gc_integer_impose_max	(ArvGcInteger *gc_integer, gint64 maximum);
+gint64		arv_gc_integer_get_value	(ArvGcInteger *gc_integer, GError **error);
+void		arv_gc_integer_set_value	(ArvGcInteger *gc_integer, gint64 value, GError **error);
+gint64		arv_gc_integer_get_min		(ArvGcInteger *gc_integer, GError **error);
+gint64		arv_gc_integer_get_max		(ArvGcInteger *gc_integer, GError **error);
+gint64		arv_gc_integer_get_inc		(ArvGcInteger *gc_integer, GError **error);
+const char *	arv_gc_integer_get_unit		(ArvGcInteger *gc_integer, GError **error);
+void		arv_gc_integer_impose_min	(ArvGcInteger *gc_integer, gint64 minimum, GError *error);
+void		arv_gc_integer_impose_max	(ArvGcInteger *gc_integer, gint64 maximum, GError *error);
 
 /* FIXME get_representation is missing */
 
diff --git a/src/arvgcintegernode.c b/src/arvgcintegernode.c
index 00b7697..cf47d94 100644
--- a/src/arvgcintegernode.c
+++ b/src/arvgcintegernode.c
@@ -92,20 +92,34 @@ arv_gc_integer_node_get_value_type (ArvGcFeatureNode *node)
 }
 
 static void
-arv_gc_integer_node_set_value_from_string (ArvGcFeatureNode *node, const char *string)
+arv_gc_integer_node_set_value_from_string (ArvGcFeatureNode *node, const char *string, GError **error)
 {
-	arv_gc_integer_set_value (ARV_GC_INTEGER (node), g_ascii_strtoll (string, NULL, 0));
+	GError *local_error = NULL;
+
+	arv_gc_integer_set_value (ARV_GC_INTEGER (node), g_ascii_strtoll (string, NULL, 0), &local_error);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 static const char *
-arv_gc_integer_node_get_value_as_string (ArvGcFeatureNode *node)
+arv_gc_integer_node_get_value_as_string (ArvGcFeatureNode *node, GError **error)
 {
 	ArvGcIntegerNode *integer_node = ARV_GC_INTEGER_NODE (node);
+	GError *local_error = NULL;
+	const char *string;
 
-	if (integer_node->value != NULL)
-		return arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (integer_node->value));
+	if (integer_node->value == NULL)
+		return NULL;
 
-	return NULL;
+	string = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (integer_node->value), &local_error);
+
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
+
+	return string;
 }
 
 /* ArvGcIntegerNode implementation */
@@ -152,85 +166,148 @@ arv_gc_integer_node_class_init (ArvGcIntegerNodeClass *this_class)
 /* ArvGcInteger interface implementation */
 
 static gint64
-arv_gc_integer_node_get_integer_value (ArvGcInteger *gc_integer)
+arv_gc_integer_node_get_integer_value (ArvGcInteger *gc_integer, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+	gint64 value;
+
+	if (gc_integer_node->value == NULL)
+		return 0;
 
-	if (gc_integer_node->value != NULL)
-		return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->value));
+	value = arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->value), &local_error);
 
-	return 0;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 0;
+	}
+
+	return value;
 }
 
 static void
-arv_gc_integer_node_set_integer_value (ArvGcInteger *gc_integer, gint64 value)
+arv_gc_integer_node_set_integer_value (ArvGcInteger *gc_integer, gint64 value, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+
+	if (gc_integer_node->value == NULL)
+		return
+	
+	arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->value), value, &local_error);
 
-	if (gc_integer_node->value != NULL)
-		arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->value), value);
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 static gint64
-arv_gc_integer_node_get_min (ArvGcInteger *gc_integer)
+arv_gc_integer_node_get_min (ArvGcInteger *gc_integer, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+	gint64 value;
+
+	if (gc_integer_node->minimum == NULL)
+		return G_MININT64;
 
-	if (gc_integer_node->minimum != NULL)
-		return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->minimum));
+	value = arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->minimum), &local_error);
 
-	return G_MININT64;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return G_MININT64;
+	}
+
+	return value;
 }
 
 static gint64
-arv_gc_integer_node_get_max (ArvGcInteger *gc_integer)
+arv_gc_integer_node_get_max (ArvGcInteger *gc_integer, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+	gint64 value;
+
+	if (gc_integer_node->maximum == NULL)
+		return G_MAXINT64;
 
-	if (gc_integer_node->maximum != NULL)
-		return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->maximum));
+	value = arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->maximum), &local_error);
 
-	return G_MAXINT64;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return G_MAXINT64;
+	}
+
+	return value;
 }
 
 static gint64
-arv_gc_integer_node_get_inc (ArvGcInteger *gc_integer)
+arv_gc_integer_node_get_inc (ArvGcInteger *gc_integer, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+	gint64 value;
+
+	if (gc_integer_node->increment == NULL)
+		return 1;
 
-	if (gc_integer_node->increment != NULL)
-		return arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->increment));
+	value = arv_gc_property_node_get_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->increment), &local_error);
 
-	return 1;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return 1;
+	}
+
+	return value;
 }
 
 static const char *
-arv_gc_integer_node_get_unit (ArvGcInteger *gc_integer)
+arv_gc_integer_node_get_unit (ArvGcInteger *gc_integer, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+	const char *string;
+
+	if (gc_integer_node->unit == NULL)
+		return NULL;
 
-	if (gc_integer_node->unit != NULL)
-		return arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (gc_integer_node->unit));
+	string = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (gc_integer_node->unit), &local_error);
 
-	return NULL;
+	if (local_error != NULL) {
+		g_propagate_error (error, local_error);
+		return NULL;
+	}
+
+	return string;
 }
 
 static void
-arv_gc_integer_node_impose_min (ArvGcInteger *gc_integer, gint64 minimum)
+arv_gc_integer_node_impose_min (ArvGcInteger *gc_integer, gint64 minimum, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+
+	if (gc_integer_node->minimum == NULL)
+		return;
 
-	if (gc_integer_node->minimum != NULL)
-		arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->minimum), minimum);
+	arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->minimum), minimum, &local_error);
+
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 static void
-arv_gc_integer_node_impose_max (ArvGcInteger *gc_integer, gint64 maximum)
+arv_gc_integer_node_impose_max (ArvGcInteger *gc_integer, gint64 maximum, GError **error)
 {
 	ArvGcIntegerNode *gc_integer_node = ARV_GC_INTEGER_NODE (gc_integer);
+	GError *local_error = NULL;
+
+	if (gc_integer_node->maximum == NULL)
+		return;
+
+	arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->maximum), maximum, &local_error);
 
-	if (gc_integer_node->maximum != NULL)
-		arv_gc_property_node_set_int64 (ARV_GC_PROPERTY_NODE (gc_integer_node->maximum), maximum);
+	if (local_error != NULL)
+		g_propagate_error (error, local_error);
 }
 
 static void
diff --git a/src/arvgcpropertynode.c b/src/arvgcpropertynode.c
index 2610cc0..512d61b 100644
--- a/src/arvgcpropertynode.c
+++ b/src/arvgcpropertynode.c
@@ -180,11 +180,12 @@ arv_gc_property_node_get_value_node (ArvGcPropertyNode *property_node)
 }
 
 const char *
-arv_gc_property_node_get_string (ArvGcPropertyNode *node)
+arv_gc_property_node_get_string (ArvGcPropertyNode *node, GError **error)
 {
 	ArvDomNode *value_node;
 
 	g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), NULL);
+	g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
 	value_node = arv_gc_property_node_get_value_node (node);
 	if (value_node == NULL) {
@@ -196,8 +197,17 @@ arv_gc_property_node_get_string (ArvGcPropertyNode *node)
 	if (ARV_IS_DOM_TEXT (value_node))
 		return arv_dom_character_data_get_data (ARV_DOM_CHARACTER_DATA (value_node));
 
-	if (ARV_IS_GC_STRING (value_node))
-		return arv_gc_string_get_value (ARV_GC_STRING (value_node));
+	if (ARV_IS_GC_STRING (value_node)) {
+		GError *local_error = NULL;
+		const char *value;
+
+		value = arv_gc_string_get_value (ARV_GC_STRING (value_node), &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+
+		return value;
+	}
 
 	arv_warning_genicam ("[GcPropertyNode::get_string] Invalid node '%s'",
 			     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (value_node)));
@@ -206,11 +216,12 @@ arv_gc_property_node_get_string (ArvGcPropertyNode *node)
 }
 	
 void
-arv_gc_property_node_set_string (ArvGcPropertyNode *node, const char *string)
+arv_gc_property_node_set_string (ArvGcPropertyNode *node, const char *string, GError **error)
 {
 	ArvDomNode *value_node;
 
 	g_return_if_fail (ARV_IS_GC_PROPERTY_NODE (node));
+	g_return_if_fail (error == NULL || *error == NULL);
 
 	value_node = arv_gc_property_node_get_value_node (node);
 	if (value_node == NULL) {
@@ -225,7 +236,13 @@ arv_gc_property_node_set_string (ArvGcPropertyNode *node, const char *string)
 	}
 
 	if (ARV_IS_GC_STRING (value_node)) {
-		arv_gc_string_set_value (ARV_GC_STRING (value_node), string);
+		GError *local_error = NULL;
+
+		arv_gc_string_set_value (ARV_GC_STRING (value_node), string, &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+
 		return;
 	}
 
@@ -234,16 +251,17 @@ arv_gc_property_node_set_string (ArvGcPropertyNode *node, const char *string)
 }
 
 gint64
-arv_gc_property_node_get_int64 (ArvGcPropertyNode *node)
+arv_gc_property_node_get_int64 (ArvGcPropertyNode *node, GError **error)
 {
 	ArvDomNode *value_node;
 
 	g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), 0);
+	g_return_val_if_fail (error == NULL || *error == NULL, 0);
 
 	value_node = arv_gc_property_node_get_value_node (node);
 	if (value_node == NULL) {
 		arv_warning_genicam ("[GcPropertyNode::get_int64] Invalid node '%s'",
-				   arv_dom_node_get_node_name (ARV_DOM_NODE (node)));
+				     arv_dom_node_get_node_name (ARV_DOM_NODE (node)));
 		return 0;
 	}
 
@@ -251,8 +269,17 @@ arv_gc_property_node_get_int64 (ArvGcPropertyNode *node)
 		return g_ascii_strtoll (arv_dom_character_data_get_data (ARV_DOM_CHARACTER_DATA (value_node)), NULL, 0);
 
 
-	if (ARV_IS_GC_INTEGER (value_node))
-		return arv_gc_integer_get_value (ARV_GC_INTEGER (value_node));
+	if (ARV_IS_GC_INTEGER (value_node)) {
+		GError *local_error = NULL;
+		gint64 value;
+
+		value = arv_gc_integer_get_value (ARV_GC_INTEGER (value_node), &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+
+		return value;
+	}
 
 	arv_warning_genicam ("[GcPropertyNode::get_int64] Invalid node '%s'",
 			     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (value_node)));
@@ -261,11 +288,12 @@ arv_gc_property_node_get_int64 (ArvGcPropertyNode *node)
 }
 
 void
-arv_gc_property_node_set_int64 (ArvGcPropertyNode *node, gint64 v_int64)
+arv_gc_property_node_set_int64 (ArvGcPropertyNode *node, gint64 v_int64, GError **error)
 {
 	ArvDomNode *value_node;
 
 	g_return_if_fail (ARV_IS_GC_PROPERTY_NODE (node));
+	g_return_if_fail (error == NULL || *error == NULL);
 
 	value_node = arv_gc_property_node_get_value_node (node);
 	if (value_node == NULL) {
@@ -284,7 +312,13 @@ arv_gc_property_node_set_int64 (ArvGcPropertyNode *node, gint64 v_int64)
 	}
 
 	if (ARV_IS_GC_INTEGER (value_node)) {
-		arv_gc_integer_set_value (ARV_GC_INTEGER (value_node), v_int64);
+		GError *local_error = NULL;
+
+		arv_gc_integer_set_value (ARV_GC_INTEGER (value_node), v_int64, &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+
 		return;
 	}
 
@@ -293,11 +327,12 @@ arv_gc_property_node_set_int64 (ArvGcPropertyNode *node, gint64 v_int64)
 }
 
 double
-arv_gc_property_node_get_double (ArvGcPropertyNode *node)
+arv_gc_property_node_get_double (ArvGcPropertyNode *node, GError **error)
 {
 	ArvDomNode *value_node;
 
-	g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), 0);
+	g_return_val_if_fail (ARV_IS_GC_PROPERTY_NODE (node), 0.0);
+	g_return_val_if_fail (error == NULL || *error == NULL, 0.0);
 
 	value_node = arv_gc_property_node_get_value_node (node);
 	if (value_node == NULL) {
@@ -310,8 +345,17 @@ arv_gc_property_node_get_double (ArvGcPropertyNode *node)
 		return g_ascii_strtod (arv_dom_character_data_get_data (ARV_DOM_CHARACTER_DATA (value_node)), NULL);
 
 
-	if (ARV_IS_GC_FLOAT (value_node))
-		return arv_gc_float_get_value (ARV_GC_FLOAT (value_node));
+	if (ARV_IS_GC_FLOAT (value_node)) {
+		GError *local_error = NULL;
+		double value;
+
+		value = arv_gc_float_get_value (ARV_GC_FLOAT (value_node), &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+
+		return value;
+	}
 
 	arv_warning_genicam ("[GcPropertyNode::get_double] Invalid node '%s'",
 			     arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (value_node)));
@@ -320,11 +364,12 @@ arv_gc_property_node_get_double (ArvGcPropertyNode *node)
 }
 
 void
-arv_gc_property_node_set_double (ArvGcPropertyNode *node, double v_double)
+arv_gc_property_node_set_double (ArvGcPropertyNode *node, double v_double, GError **error)
 {
 	ArvDomNode *value_node;
 
 	g_return_if_fail (ARV_IS_GC_PROPERTY_NODE (node));
+	g_return_if_fail (error == NULL || *error == NULL);
 
 	value_node = arv_gc_property_node_get_value_node (node);
 	if (value_node == NULL) {
@@ -342,7 +387,13 @@ arv_gc_property_node_set_double (ArvGcPropertyNode *node, double v_double)
 	}
 
 	if (ARV_IS_GC_FLOAT (value_node)) {
-		arv_gc_float_set_value (ARV_GC_FLOAT (value_node), v_double);
+		GError *local_error = NULL;
+
+		arv_gc_float_set_value (ARV_GC_FLOAT (value_node), v_double, &local_error);
+
+		if (local_error != NULL)
+			g_propagate_error (error, local_error);
+
 		return;
 	}
 
diff --git a/src/arvgcpropertynode.h b/src/arvgcpropertynode.h
index 3f346b1..3c5f47c 100644
--- a/src/arvgcpropertynode.h
+++ b/src/arvgcpropertynode.h
@@ -136,12 +136,13 @@ ArvGcNode * 	arv_gc_property_node_new_bit			(void);
 ArvGcNode * 	arv_gc_property_node_new_command_value		(void);
 ArvGcNode * 	arv_gc_property_node_new_p_command_value	(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);
-double 			arv_gc_property_node_get_double 	(ArvGcPropertyNode *node);
-void 			arv_gc_property_node_set_double 	(ArvGcPropertyNode *node, double v_double);
+const char * 		arv_gc_property_node_get_string 	(ArvGcPropertyNode *node, GError **error);
+void	 		arv_gc_property_node_set_string 	(ArvGcPropertyNode *node, const char *string, GError **error);
+gint64			arv_gc_property_node_get_int64		(ArvGcPropertyNode *node, GError **error);
+void			arv_gc_property_node_set_int64		(ArvGcPropertyNode *node, gint64 v_int64, GError **error);
+double 			arv_gc_property_node_get_double 	(ArvGcPropertyNode *node, GError **error);
+void 			arv_gc_property_node_set_double 	(ArvGcPropertyNode *node, double v_double, GError **error);
+
 ArvGcNode *		arv_gc_property_node_get_linked_node	(ArvGcPropertyNode *node);
 ArvGcPropertyNodeType	arv_gc_property_node_get_node_type	(ArvGcPropertyNode *node);
 
diff --git a/src/arvgcstring.h b/src/arvgcstring.h
index cc00ba5..f21927f 100644
--- a/src/arvgcstring.h
+++ b/src/arvgcstring.h
@@ -37,16 +37,16 @@ typedef struct _ArvGcStringInterface ArvGcStringInterface;
 struct _ArvGcStringInterface {
 	GTypeInterface parent;
 
-	const char *	(*get_value)		(ArvGcString *gc_string);
-	void		(*set_value)		(ArvGcString *gc_string, const char *value);
-	gint64		(*get_max_length)	(ArvGcString *gc_string);
+	const char *	(*get_value)		(ArvGcString *gc_string, GError **error);
+	void		(*set_value)		(ArvGcString *gc_string, const char *value, GError **error);
+	gint64		(*get_max_length)	(ArvGcString *gc_string, GError **error);
 };
 
 GType arv_gc_string_get_type (void);
 
-const char *	arv_gc_string_get_value		(ArvGcString *gc_string);
-void		arv_gc_string_set_value		(ArvGcString *gc_string, const char *value);
-gint64		arv_gc_string_get_max_length	(ArvGcString *gc_string);
+const char *	arv_gc_string_get_value		(ArvGcString *gc_string, GError **error);
+void		arv_gc_string_set_value		(ArvGcString *gc_string, const char *value, GError **error);
+gint64		arv_gc_string_get_max_length	(ArvGcString *gc_string, GError **error);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]