1get_native_type(3) GETDATA get_native_type(3)
2
3
4
6 get_native_type — returns the native data type of a field in a dirfile
7
9 #include <getdata.h>
10
11 gd_type_t get_native_type(DIRFILE *dirfile, const char *field_code);
12
14 The get_native_type() function queries a dirfile(5) database specified
15 by dirfile and returns the native data type of the field field_code,
16 which may contain a representation suffix.
17
18 The dirfile argument must point to a valid DIRFILE object previously
19 created by a call to dirfile_open(3).
20
21 The native data type of a field of a given entry type is calculated as:
22
23 BIT or INDEX Entry:
24 GD_UINT64;
25
26 CONST Entry:
27 the data type of the constant;
28
29 LINCOM or POLYNOM Entry:
30 if any of the scalar parameters is complex valued, or if the na‐
31 tive data type of any of the input fields is complex valued:
32 GD_COMPLEX128, otherwise: GD_FLOAT64;
33
34 LINTERP Entry:
35 if the look-up table is complex valued: GD_COMPLEX128, other‐
36 wise: GD_FLOAT64;
37
38 MULTIPLY Entry:
39 if either input field is complex valued: GD_COMPLEX128, other‐
40 wise: GD_FLOAT64;
41
42 PHASE Entry:
43 the native data type of the input field;
44
45 RAW Entry:
46 the data type of the raw data on disk;
47
48 SBIT Entry:
49 GD_INT64;
50
51 STRING Entry:
52 GD_NULL.
53
54 Furthermore, if the supplied field_code contains a representation suf‐
55 fix, and the native data type of the field is complex valued, the na‐
56 tive type returned will be the corresponding real valued type.
57
58
60 Upon successful completion, get_native_type() returns the native data
61 type of the field code specified. This will be one of the symbols:
62
63 GD_NULL, GD_UINT8, GD_INT8, GD_UINT16, GD_INT16, GD_UINT32,
64 GD_INT32, GD_FLOAT32, GD_FLOAT64, GD_COMPLEX64, GD_COMPLEX128.
65
66 The meanings of these symbols are explained in the getdata(3) manual
67 page. On error, it returns GD_UNKNOWN and sets the dirfile error to a
68 non-zero error value. Possible error values are:
69
70 GD_E_BAD_CODE
71 The field specified by field_code or one of the fields it uses
72 as input was not found in the database.
73
74 GD_E_BAD_DIRFILE
75 The supplied dirfile was invalid.
76
77 GD_E_BAD_REPR
78 The representation suffix specified in field_code, or in one of
79 its input fields, was not recognised.
80
81 GD_E_BAD_SCALAR
82 A non-literal scalar used in the definition of the field or one
83 of its inputs was not found, or was not a CONST field.
84
85 GD_E_DIMENSION
86 A scalar field was found where a vector field was expected.
87
88 GD_E_OPEN_LINFILE
89 An error occurred while trying to read a LINTERP table from
90 disk.
91
92 GD_E_RECURSE_LEVEL
93 Too many levels of recursion were encountered while trying to
94 resolve field_code. This usually indicates a circular depen‐
95 dency in field specification in the dirfile.
96
97 The dirfile error may be retrieved by calling get_error(3). A descrip‐
98 tive error string for the last error encountered can be obtained from a
99 call to get_error_string(3).
100
102 dirfile(5), dirfile_open(3), getdata(3), get_error(3), get_er‐
103 ror_string(3)
104
105
106
107Version 0.6.1 9 February 2010 get_native_type(3)