1
2
3
4
5
6
7
8
9gd_nentries(3)                      GETDATA                     gd_nentries(3)
10
11
12

NAME

14       gd_nentries,      gd_nfields,      gd_nfields_by_type      gd_nmfields,
15       gd_nmfields_by_type, gd_nmvectors, gd_nvectors — count field entries in
16       a Dirfile
17
18

SYNOPSIS

20       #include <getdata.h>
21
22       unsigned int gd_nentries(DIRFILE *dirfile, const char *parent, unsigned
23              int type, unsigned int flags);
24
25       unsigned int gd_nfields(DIRFILE *dirfile);
26
27       unsigned int gd_nfields_by_type(DIRFILE *dirfile, gd_entype_t type);
28
29       unsigned int gd_nmfields(DIRFILE *dirfile, const char *parent);
30
31       unsigned int gd_nmfields_by_type(DIRFILE *dirfile, const char *parent,
32              gd_entype_t type);
33
34       unsigned int gd_nmvectors(DIRFILE *dirfile, const char *parent);
35
36       unsigned int gd_nvectors(DIRFILE *dirfile);
37
38

DESCRIPTION

40       The  gd_nentries()  function queries a dirfile(5) database specified by
41       dirfile and counts the number of metadata entries satisfying  the  pro‐
42       vided  criteria.   If  parent  is  non-NULL, metafields under the field
43       specified by parent are considered;  otherwise,  top-level  fields  are
44       considered, and metafields ignored.
45
46       The  type argument should be one of the following symbols indicating an
47       explicit entry type to count:
48
49              GD_BIT_ENTRY, GD_CARRAY_ENTRY, GD_CONST_ENTRY, GD_DIVIDE_ENTRY,
50              GD_INDEX_ENTRY, GD_INDIR_ENTRY, GD_LINCOM_ENTRY,
51              GD_LINTERP_ENTRY, GD_MPLEX_ENTRY, GD_MULTIPLY_ENTRY,
52              GD_PHASE_ENTRY, GD_POLYNOM_ENTRY, GD_RAW_ENTRY, GD_RECIP_ENTRY,
53              GD_SARRAY_ENTRY, GD_SBIT_ENTRY, GD_SINDIR_ENTRY,
54              GD_STRING_ENTRY, GD_WINDOW_ENTRY.
55
56       (GD_INDEX_ENTRY  is  a special field type for the implicit INDEX field)
57       or else one of the following special symbols:
58
59       GD_ALL_ENTRIES (=0)
60               Count entries of all types.
61
62       GD_ALIAS_ENTRIES
63               Count only aliases.  This is the only way to get  a  count  in‐
64               cluding aliases which do not point to valid field codes.
65
66       GD_SCALAR_ENTRIES
67               Count only scalar field types (CONST, CARRAY, SARRAY, STRING).
68
69       GD_VECTOR_ENTRIES
70               Count  only  numeric-valued vector field types (all field types
71               except SINDIR and the scalar field types listed above).
72
73       The flags argument should be zero or more of the following flags,  bit‐
74       wise or'd together:
75
76       GD_ENTRIES_HIDDEN
77               Include hidden entries (see gd_hidden(3)) in the count: normal‐
78               ly hidden entries are skipped;
79
80       GD_ENTRIES_NOALIAS
81               Exclude aliases from the count: normally aliases are considered
82               the same as their target (that is: a field with n aliases, plus
83               its canonical name, will be counted n+1 times).
84
85
86       This  function   has   a   subset   of   the   functionality   of   the
87       gd_match_entries(3) function (q.v.).
88
89
90   Special Cases
91       The call
92              gd_nfields(dirfile);
93
94       is equivalent to
95              gd_nentries(dirfile, NULL, GD_ALL_ENTRIES, 0);
96
97       The call
98              gd_nfields_by_type(dirfile, type);
99
100       is equivalent to
101              gd_nentries(dirfile, NULL, type, 0);
102
103       The call
104              gd_nmfields(dirfile, parent);
105
106       is equivalent to
107              gd_nentries(dirfile, parent, GD_ALL_ENTRIES, 0);
108
109       The call
110              gd_nmfields_by_type(dirfile, parent, type);
111
112       is equivalent to
113              gd_nentries(dirfile, parent, type, 0);
114
115       The call
116              gd_nmvectors(dirfile, parent);
117
118       is equivalent to
119              gd_nentries(dirfile, parent, GD_VECTOR_ENTRIES, 0);
120
121       The call
122              gd_nvectors(dirfile);
123
124       is equivalent to
125              gd_nentries(dirfile, NULL, GD_VECTOR_ENTRIES, 0);
126
127

RETURN VALUE

129       Upon successful completion, these functions return an unsigned in indi‐
130       cating the number of entries in the database  satisfying  the  supplied
131       criteria.
132
133       On error, these functions return zero and store a negative-valued error
134       code in the DIRFILE object which may be retrieved by a subsequent  call
135       to gd_error(3).  Possible error codes are:
136
137       GD_E_BAD_CODE
138               The  supplied parent field code was not found, or referred to a
139               metafield itself.
140
141       GD_E_BAD_DIRFILE
142               The supplied dirfile was invalid.
143
144       GD_E_BAD_ENTRY
145               The type parameter supplied was not one of the  symbols  listed
146               above.
147
148       A  descriptive  error  string  for the error may be obtained by calling
149       gd_error_string(3).
150
151

HISTORY

153       The get_nfields() function appeared in GetData-0.3.0.
154
155       The  get_nfields_by_type(),   get_nmfields(),   get_nmfields_by_type(),
156       get_nmvectors(),   and  get_nvectors()  functions  appeared  in  GetDa‐
157       ta-0.4.0.
158
159       In  GetData-0.7.0,  these  functions  were  renamed  to   gd_nfields(),
160       gd_nfields_by_type(),       gd_nmfields(),       gd_nmfields_by_type(),
161       gd_nmvectors(), and gd_nvectors().
162
163       The gd_nentries() function appeared in GetData-0.8.0.
164
165

SEE ALSO

167       dirfile(5),      gd_open(3),       gd_entry_list(3),       gd_error(3),
168       gd_error_string(3), gd_hidden(3), gd_match_entries(3)
169
170
171
172Version 0.10.0                 25 December 2016                 gd_nentries(3)
Impressum