UniRec  2.9.3
unirec2csv.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (C) 2019 CESNET
9  *
10  * SPDX-License-Identifier: BSD-3-Clause
11  *
12  */
13 
14 #ifndef _UNIREC2CSV_H_
15 #define _UNIREC2CSV_H_
16 
17 #include "unirec.h"
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
47 typedef struct urcsv_s {
52 
56  char *buffer;
57 
61  char *curpos;
62 
66  uint32_t buffer_size;
67 
71  uint32_t free_space;
72 
76  char delimiter;
77 } urcsv_t;
78 
88 urcsv_t *urcsv_init(ur_template_t *tmplt, char delimiter);
89 
96 void urcsv_free(urcsv_t **urcsv);
97 
105 char *urcsv_header(urcsv_t *urcsv);
106 
115 char *urcsv_record(urcsv_t *urcsv, const void *rec);
116 
128 int urcsv_field(char *dst, uint32_t size, const void *rec, ur_field_type_t id, ur_template_t *tmplt);
129 /* unirec2csv */
133 
134 #ifdef __cplusplus
135 } // extern "C"
136 #endif
137 
138 #endif
139 
char * urcsv_record(urcsv_t *urcsv, const void *rec)
Definition: unirec2csv.c:209
ur_template_t * tmplt
Definition: unirec2csv.h:51
uint32_t buffer_size
Definition: unirec2csv.h:66
char * urcsv_header(urcsv_t *urcsv)
Definition: unirec2csv.c:37
void * rec
char * buffer
Definition: unirec2csv.h:56
char delimiter
Definition: unirec2csv.h:76
uint32_t free_space
Definition: unirec2csv.h:71
Definition of UniRec structures and functions.
char * curpos
Definition: unirec2csv.h:61
ur_field_type_t
Definition: unirec.h:95
urcsv_t * urcsv_init(ur_template_t *tmplt, char delimiter)
Definition: unirec2csv.c:7
int urcsv_field(char *dst, uint32_t size, const void *rec, ur_field_type_t id, ur_template_t *tmplt)
Definition: unirec2csv.c:129
UniRec template. It contains a table mapping a field to its position in an UniRec record...
Definition: unirec.h:191
void urcsv_free(urcsv_t **urcsv)
Definition: unirec2csv.c:28