forked from AravisProject/aravis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharvgcconverter.c
631 lines (508 loc) · 19.9 KB
/
arvgcconverter.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
/* Aravis - Digital camera library
*
* Copyright © 2009-2022 Emmanuel Pacaud
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* Author: Emmanuel Pacaud <[email protected]>
*/
/**
* SECTION: arvgcconverter
* @short_description: Class for Converter and IntConverter nodes
*/
#include <arvgcfeaturenodeprivate.h>
#include <arvgcconverterprivate.h>
#include <arvevaluator.h>
#include <arvgcinteger.h>
#include <arvgcfloat.h>
#include <arvgcdefaultsprivate.h>
#include <arvgc.h>
#include <arvdebugprivate.h>
#include <string.h>
typedef struct {
GSList *variables; /* ArvGcVariableNode list */
GSList *constants; /* ArvGcVariableNode list */
GSList *expressions; /* ArvGcVariableNode list */
ArvGcPropertyNode *value;
ArvGcPropertyNode *formula_to_node;
ArvGcPropertyNode *formula_from_node;
ArvGcPropertyNode *unit;
ArvGcPropertyNode *representation;
ArvGcPropertyNode *display_notation;
ArvGcPropertyNode *display_precision;
ArvGcPropertyNode *is_linear;
ArvGcPropertyNode *slope;
ArvEvaluator *formula_to;
ArvEvaluator *formula_from;
} ArvGcConverterPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ArvGcConverter, arv_gc_converter, ARV_TYPE_GC_FEATURE_NODE,
G_ADD_PRIVATE (ArvGcConverter))
/* ArvDomNode implementation */
static void
arv_gc_converter_post_new_child (ArvDomNode *self, ArvDomNode *child)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (ARV_GC_CONVERTER (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_P_VARIABLE:
priv->variables = g_slist_prepend (priv->variables, property_node);
break;
case ARV_GC_PROPERTY_NODE_TYPE_P_VALUE:
priv->value = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_FORMULA_TO:
priv->formula_to_node = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_FORMULA_FROM:
priv->formula_from_node = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_EXPRESSION:
priv->expressions = g_slist_prepend (priv->expressions, property_node);
break;
case ARV_GC_PROPERTY_NODE_TYPE_CONSTANT:
priv->constants = g_slist_prepend (priv->constants, property_node);
break;
case ARV_GC_PROPERTY_NODE_TYPE_UNIT:
priv->unit = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_REPRESENTATION:
priv->representation = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_NOTATION:
priv->display_notation = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_DISPLAY_PRECISION:
priv->display_precision = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_IS_LINEAR:
priv->is_linear = property_node;
break;
case ARV_GC_PROPERTY_NODE_TYPE_SLOPE:
priv->slope = property_node;
break;
default:
ARV_DOM_NODE_CLASS (arv_gc_converter_parent_class)->post_new_child (self, child);
break;
}
}
}
static void
arv_gc_converter_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
{
g_assert_not_reached ();
}
/* ArvGcConverter implementation */
static void
arv_gc_converter_init (ArvGcConverter *self)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (ARV_GC_CONVERTER (self));
priv->formula_to = arv_evaluator_new (NULL);
priv->formula_from = arv_evaluator_new (NULL);
priv->value = NULL;
}
static ArvGcFeatureNode *
arv_gc_converter_get_linked_feature (ArvGcFeatureNode *gc_feature_node)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (ARV_GC_CONVERTER (gc_feature_node));
ArvGcNode *pvalue_node = NULL;
if (priv->value == NULL)
return NULL;
pvalue_node = arv_gc_property_node_get_linked_node (priv->value);
if (ARV_IS_GC_FEATURE_NODE (pvalue_node))
return ARV_GC_FEATURE_NODE (pvalue_node);
return NULL;
}
static void
arv_gc_converter_finalize (GObject *object)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (ARV_GC_CONVERTER (object));
g_slist_free (priv->variables);
g_slist_free (priv->expressions);
g_slist_free (priv->constants);
g_object_unref (priv->formula_to);
g_object_unref (priv->formula_from);
G_OBJECT_CLASS (arv_gc_converter_parent_class)->finalize (object);
}
static void
arv_gc_converter_class_init (ArvGcConverterClass *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);
object_class->finalize = arv_gc_converter_finalize;
dom_node_class->post_new_child = arv_gc_converter_post_new_child;
dom_node_class->pre_remove_child = arv_gc_converter_pre_remove_child;
gc_feature_node_class->get_linked_feature = arv_gc_converter_get_linked_feature;
}
/* ArvGcInteger interface implementation */
ArvGcIsLinear
arv_gc_converter_get_is_linear (ArvGcConverter *gc_converter, GError **error)
{
GError *local_error = NULL;
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
const char *string;
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), ARV_GC_IS_LINEAR_NO);
if (priv->is_linear == NULL)
return ARV_GC_IS_LINEAR_NO;
string = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (priv->is_linear), &local_error);
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
if (g_strcmp0 ("Yes", string) == 0)
return ARV_GC_IS_LINEAR_YES;
return ARV_GC_IS_LINEAR_NO;
}
static gboolean
arv_gc_converter_update_from_variables (ArvGcConverter *gc_converter, ArvGcConverterNodeType node_type, GError **error)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
ArvGcNode *node = NULL;
GError *local_error = NULL;
GSList *iter;
const char *expression;
if (priv->formula_from_node != NULL)
expression = arv_gc_property_node_get_string (priv->formula_from_node, &local_error);
else
expression = "";
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
arv_evaluator_set_expression (priv->formula_from, expression);
for (iter = priv->expressions; iter != NULL; iter = iter->next) {
const char *expression;
const char *name;
expression = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (iter->data), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
name = arv_gc_property_node_get_name (iter->data);
arv_evaluator_set_sub_expression (priv->formula_from, name, expression);
}
for (iter = priv->constants; iter != NULL; iter = iter->next) {
const char *constant;
const char *name;
constant = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (iter->data), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
name = arv_gc_property_node_get_name (iter->data);
arv_evaluator_set_constant (priv->formula_from, name, constant);
}
for (iter = priv->variables; iter != NULL; iter = iter->next) {
ArvGcPropertyNode *variable_node = iter->data;
node = arv_gc_property_node_get_linked_node (ARV_GC_PROPERTY_NODE (variable_node));
if (ARV_IS_GC_INTEGER (node)) {
gint64 value;
value = arv_gc_integer_get_value (ARV_GC_INTEGER (node), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
arv_evaluator_set_int64_variable (priv->formula_from,
arv_gc_property_node_get_name (variable_node),
value);
} else if (ARV_IS_GC_FLOAT (node)) {
double value;
value = arv_gc_float_get_value (ARV_GC_FLOAT (node), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
arv_evaluator_set_double_variable (priv->formula_from,
arv_gc_property_node_get_name (variable_node),
value);
}
}
if (priv->value != NULL) {
node = arv_gc_property_node_get_linked_node (priv->value);
if (ARV_IS_GC_INTEGER (node)) {
gint64 value;
switch (node_type) {
case ARV_GC_CONVERTER_NODE_TYPE_MIN:
value = arv_gc_integer_get_min (ARV_GC_INTEGER (node), &local_error);
/* Default minimum, don't convert it */
if (value == G_MININT64)
return FALSE;
break;
case ARV_GC_CONVERTER_NODE_TYPE_MAX:
value = arv_gc_integer_get_max (ARV_GC_INTEGER (node), &local_error);
/* Default maximum, don't convert it */
if (value == G_MAXINT64)
return FALSE;
break;
case ARV_GC_CONVERTER_NODE_TYPE_INC:
value = arv_gc_integer_get_inc (ARV_GC_INTEGER (node), &local_error);
break;
default:
value = arv_gc_integer_get_value (ARV_GC_INTEGER (node), &local_error);
break;
}
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
arv_evaluator_set_int64_variable (priv->formula_from, "TO", value);
} else if (ARV_IS_GC_FLOAT (node)) {
double value;
switch (node_type) {
case ARV_GC_CONVERTER_NODE_TYPE_MIN:
value = arv_gc_float_get_min (ARV_GC_FLOAT (node), &local_error);
/* Default minimum, don't convert it */
if (value == -G_MAXDOUBLE)
return FALSE;
break;
case ARV_GC_CONVERTER_NODE_TYPE_MAX:
value = arv_gc_float_get_max (ARV_GC_FLOAT (node), &local_error);
/* Default maximum, don't convert it */
if (value == G_MAXDOUBLE)
return FALSE;
break;
case ARV_GC_CONVERTER_NODE_TYPE_INC:
value = arv_gc_float_get_inc (ARV_GC_FLOAT (node), &local_error);
/* Default increment, don't convert it */
if (value == G_MINDOUBLE)
return FALSE;
break;
default:
value = arv_gc_float_get_value (ARV_GC_FLOAT (node), &local_error);
break;
}
if (local_error != NULL) {
g_propagate_error (error, local_error);
return FALSE;
}
arv_evaluator_set_double_variable (priv->formula_from, "TO", value);
} else {
arv_warning_genicam ("[GcConverter::set_value] Invalid pValue node '%s'",
arv_gc_property_node_get_string (priv->value, NULL));
g_set_error (error, ARV_GC_ERROR, ARV_GC_ERROR_INVALID_PVALUE,
"Invalid pValue node '%s'",
arv_gc_property_node_get_string (priv->value, NULL));
return FALSE;
}
} else {
g_set_error (error, ARV_GC_ERROR, ARV_GC_ERROR_PVALUE_NOT_DEFINED,
"pValue node not defined");
return FALSE;
}
return TRUE;
}
double
arv_gc_converter_convert_to_double (ArvGcConverter *gc_converter, ArvGcConverterNodeType node_type, GError **error)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
GError *local_error = NULL;
double value;
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), 0.0);
if (!arv_gc_converter_update_from_variables (gc_converter, node_type, &local_error)) {
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
switch (node_type) {
case ARV_GC_CONVERTER_NODE_TYPE_MIN:
return -G_MAXDOUBLE;
case ARV_GC_CONVERTER_NODE_TYPE_MAX:
return G_MAXDOUBLE;
default:
return 0.0;
}
}
value = arv_evaluator_evaluate_as_double (priv->formula_from, &local_error);
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
return value;
}
gint64
arv_gc_converter_convert_to_int64 (ArvGcConverter *gc_converter, ArvGcConverterNodeType node_type, GError **error)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
GError *local_error = NULL;
gint64 value;
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), 0);
if (!arv_gc_converter_update_from_variables (gc_converter, node_type, &local_error)) {
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
switch (node_type) {
case ARV_GC_CONVERTER_NODE_TYPE_MIN:
return G_MININT64;
case ARV_GC_CONVERTER_NODE_TYPE_MAX:
return G_MAXINT64;
default:
return 0;
}
}
value = arv_evaluator_evaluate_as_double (priv->formula_from, &local_error);
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
return value;
}
static void
arv_gc_converter_update_to_variables (ArvGcConverter *gc_converter, GError **error)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
ArvGcNode *node;
GError *local_error = NULL;
GSList *iter;
const char *expression;
if (priv->formula_to_node != NULL)
expression = arv_gc_property_node_get_string (priv->formula_to_node, &local_error);
else
expression = "";
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
arv_evaluator_set_expression (priv->formula_to, expression);
for (iter = priv->expressions; iter != NULL; iter = iter->next) {
const char *expression;
const char *name;
expression = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (iter->data), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
name = arv_gc_property_node_get_name (iter->data);
arv_evaluator_set_sub_expression (priv->formula_to, name, expression);
}
for (iter = priv->constants; iter != NULL; iter = iter->next) {
const char *constant;
const char *name;
constant = arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (iter->data), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
name = arv_gc_property_node_get_name (iter->data);
arv_evaluator_set_constant (priv->formula_to, name, constant);
}
for (iter = priv->variables; iter != NULL; iter = iter->next) {
ArvGcPropertyNode *variable_node = iter->data;
node = arv_gc_property_node_get_linked_node (ARV_GC_PROPERTY_NODE (variable_node));
if (ARV_IS_GC_INTEGER (node)) {
gint64 value;
value = arv_gc_integer_get_value (ARV_GC_INTEGER (node), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
arv_evaluator_set_int64_variable (priv->formula_to,
arv_gc_property_node_get_name (variable_node),
value);
} else if (ARV_IS_GC_FLOAT (node)) {
double value;
value = arv_gc_float_get_value (ARV_GC_FLOAT (node), &local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
arv_evaluator_set_double_variable (priv->formula_to,
arv_gc_property_node_get_name (variable_node),
value);
}
}
if (priv->value != NULL) {
node = arv_gc_property_node_get_linked_node (priv->value);
if (ARV_IS_GC_INTEGER (node)) {
arv_gc_integer_set_value (ARV_GC_INTEGER (node),
arv_evaluator_evaluate_as_double (priv->formula_to, NULL),
&local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
} else if (ARV_IS_GC_FLOAT (node)) {
arv_gc_float_set_value (ARV_GC_FLOAT (node),
arv_evaluator_evaluate_as_double (priv->formula_to, NULL),
&local_error);
if (local_error != NULL) {
g_propagate_error (error, local_error);
return;
}
} else
arv_warning_genicam ("[GcConverter::set_value] Invalid pValue node '%s'",
arv_gc_property_node_get_string (priv->value, NULL));
}
}
void
arv_gc_converter_convert_from_double (ArvGcConverter *gc_converter, double value, GError **error)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
GError *local_error = NULL;
g_return_if_fail (ARV_IS_GC_CONVERTER (gc_converter));
arv_gc_feature_node_increment_change_count (ARV_GC_FEATURE_NODE (gc_converter));
arv_evaluator_set_double_variable (priv->formula_to, "FROM", value);
arv_gc_converter_update_to_variables (gc_converter, &local_error);
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
}
void
arv_gc_converter_convert_from_int64 (ArvGcConverter *gc_converter, gint64 value, GError **error)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
GError *local_error = NULL;
g_return_if_fail (ARV_IS_GC_CONVERTER (gc_converter));
arv_gc_feature_node_increment_change_count (ARV_GC_FEATURE_NODE (gc_converter));
arv_evaluator_set_int64_variable (priv->formula_to, "FROM", value);
arv_gc_converter_update_to_variables (gc_converter, &local_error);
if (local_error != NULL)
g_propagate_prefixed_error (error, local_error, "[%s] ",
arv_gc_feature_node_get_name (ARV_GC_FEATURE_NODE (gc_converter)));
}
ArvGcRepresentation
arv_gc_converter_get_representation (ArvGcConverter *gc_converter)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), ARV_GC_REPRESENTATION_UNDEFINED);
if (priv->representation == NULL)
return ARV_GC_REPRESENTATION_UNDEFINED;
return arv_gc_property_node_get_representation (ARV_GC_PROPERTY_NODE (priv->representation),
ARV_GC_REPRESENTATION_UNDEFINED);
}
const char *
arv_gc_converter_get_unit (ArvGcConverter *gc_converter)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), NULL);
if (priv->unit == NULL)
return NULL;
return arv_gc_property_node_get_string (ARV_GC_PROPERTY_NODE (priv->unit), NULL);
}
ArvGcDisplayNotation
arv_gc_converter_get_display_notation (ArvGcConverter *gc_converter)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), ARV_GC_DISPLAY_NOTATION_DEFAULT);
if (priv->display_notation == NULL)
return ARV_GC_DISPLAY_NOTATION_DEFAULT;
return arv_gc_property_node_get_display_notation (ARV_GC_PROPERTY_NODE (priv->display_notation), ARV_GC_DISPLAY_NOTATION_DEFAULT);
}
gint64
arv_gc_converter_get_display_precision (ArvGcConverter *gc_converter)
{
ArvGcConverterPrivate *priv = arv_gc_converter_get_instance_private (gc_converter);
g_return_val_if_fail (ARV_IS_GC_CONVERTER (gc_converter), ARV_GC_DISPLAY_PRECISION_DEFAULT);
if (priv->display_precision == NULL)
return ARV_GC_DISPLAY_PRECISION_DEFAULT;
return arv_gc_property_node_get_display_precision (ARV_GC_PROPERTY_NODE (priv->display_precision), ARV_GC_DISPLAY_PRECISION_DEFAULT);
}