forked from AravisProject/aravis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharvenums.c
96 lines (82 loc) · 2.36 KB
/
arvenums.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
/* Aravis - Digital camera library
*
* Copyright © 2009-2019 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]>
*/
#include <arvenums.h>
static unsigned int
_from_string (const char *string, const char **strings, unsigned int n_strings)
{
unsigned int i;
if (string == NULL)
return 0;
for (i = 0; i < n_strings; i++)
if (g_strcmp0 (string, strings[i]) == 0)
return i;
return 0;
}
static const char *arv_auto_strings[] = {
"Off",
"Once",
"Continuous"
};
const char *
arv_auto_to_string (ArvAuto value)
{
return arv_auto_strings[CLAMP (value, 0, ARV_AUTO_CONTINUOUS)];
}
ArvAuto
arv_auto_from_string (const char *string)
{
return _from_string (string, arv_auto_strings,
G_N_ELEMENTS (arv_auto_strings));
}
static const char *arv_acquisition_mode_strings[] = {
"Continuous",
"SingleFrame",
"MultiFrame"
};
const char *
arv_acquisition_mode_to_string (ArvAcquisitionMode value)
{
return arv_acquisition_mode_strings[CLAMP (value, 0, ARV_ACQUISITION_MODE_MULTI_FRAME)];
}
ArvAcquisitionMode
arv_acquisition_mode_from_string (const char *string)
{
return _from_string (string, arv_acquisition_mode_strings,
G_N_ELEMENTS (arv_acquisition_mode_strings));
}
static const char *arv_exposure_mode_strings[] = {
"Off",
"Timed",
"TriggerWidth",
"TriggerControlled"
};
const char *
arv_exposure_mode_to_string (ArvExposureMode value)
{
return arv_exposure_mode_strings[CLAMP (value, 0, ARV_EXPOSURE_MODE_TRIGGER_CONTROLLED)];
}
ArvExposureMode
arv_exposure_mode_from_string (const char *string)
{
return _from_string (string, arv_exposure_mode_strings,
G_N_ELEMENTS (arv_exposure_mode_strings));
}