YAZ  5.23.1
z-univ.c
Go to the documentation of this file.
1 
6 #if HAVE_CONFIG_H
7 #include <config.h>
8 #endif
9 
10 #include <yaz/z-univ.h>
11 
12 int z_UniverseReportHits(ODR o, Z_UniverseReportHits **p, int opt, const char *name)
13 {
14  if (!odr_sequence_begin(o, p, sizeof(**p), name))
15  return odr_missing(o, opt, name) && odr_ok (o);
16  return
17  z_StringOrNumeric(o, &(*p)->database, 0, "database") &&
18  z_StringOrNumeric(o, &(*p)->hits, 0, "hits") &&
20 }
21 
23 {
24  if (!odr_sequence_begin(o, p, sizeof(**p), name))
25  return odr_missing(o, opt, name) && odr_ok (o);
26  return
27  z_StringOrNumeric(o, &(*p)->hitno, 0, "hitno") &&
29 }
30 
31 int z_UniverseReport(ODR o, Z_UniverseReport **p, int opt, const char *name)
32 {
33  static Odr_arm arm[] = {
35  (Odr_fun) z_UniverseReportHits, "databaseHits"},
37  (Odr_fun) z_UniverseReportDuplicate, "duplicate"},
38  {-1, -1, -1, -1, (Odr_fun) 0, 0}
39  };
40  if (!odr_sequence_begin(o, p, sizeof(**p), name))
41  return odr_missing(o, opt, name) && odr_ok (o);
42  return
43  odr_integer(o, &(*p)->totalHits, 0, "totalHits") &&
44  odr_choice(o, arm, &(*p)->u, &(*p)->which, 0) &&
46 }
#define odr_ok(o)
Definition: odr.h:215
int z_StringOrNumeric(ODR o, Z_StringOrNumeric **p, int opt, const char *name)
Definition: z-core.c:1603
#define Z_UniverseReport_databaseHits
Definition: z-univ.h:45
int z_UniverseReport(ODR o, Z_UniverseReport **p, int opt, const char *name)
Definition: z-univ.c:31
int odr_sequence_begin(ODR o, void *p, int size, const char *name)
Definition: odr_seq.c:15
char * name
Definition: initopt.c:18
#define Z_UniverseReport_duplicate
Definition: z-univ.h:46
ASN.1 Module ResourceReport-Format-Universe-1.
int odr_integer(ODR o, Odr_int **p, int opt, const char *name)
Definition: odr_int.c:19
int odr_choice(ODR o, Odr_arm arm[], void *p, void *whichp, const char *name)
Definition: odr_choice.c:17
int(* Odr_fun)(ODR, char **, int, const char *)
Definition: odr.h:135
int which
Definition: odr.h:142
Definition: odr.h:137
int odr_missing(ODR o, int opt, const char *name)
Definition: odr_util.c:82
int z_UniverseReportHits(ODR o, Z_UniverseReportHits **p, int opt, const char *name)
Definition: z-univ.c:12
Definition: odr.h:124
int odr_sequence_end(ODR o)
Definition: odr_seq.c:61
int z_UniverseReportDuplicate(ODR o, Z_UniverseReportDuplicate **p, int opt, const char *name)
Definition: z-univ.c:22
int opt
Definition: initopt.c:19
#define ODR_IMPLICIT
Definition: odr.h:59
#define ODR_CONTEXT
Definition: odr.h:67