cis_config: /root/cis_interface/cis_interface/cis_interface/serialize/AsciiTableSerialize.h Source File

cis_config

AsciiTableSerialize.h
1 #ifndef CISASCIITABLESERIALIZE_H_
2 #define CISASCIITABLESERIALIZE_H_
3
4 #include <../tools.h>
5 #include <SerializeBase.h>
6 #include <../dataio/AsciiTable.h>
7
8 #ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
9 extern "C" {
10 #endif
11
22 static inline
23 int serialize_ascii_table(const seri_t s, char *buf, const size_t buf_siz,
24 int *args_used, va_list ap) {
25 asciiTable_t *table = (asciiTable_t*)s.info;
26 args_used[0] = table->ncols;
27 int ret = at_vrow_to_bytes(*table, buf, buf_siz, ap);
28 return ret;
29 };
30
39 static inline
40 int deserialize_ascii_table(const seri_t s, const char *buf, const size_t buf_siz,
41 va_list ap) {
42 // Prevent C4100 warning on windows by referencing param
43 #ifdef _WIN32
44 buf_siz;
45 #endif
46 asciiTable_t *table = (asciiTable_t*)s.info;
47 int ret = at_vbytes_to_row(*table, buf, ap);
48 return ret;
49 };
50
63 static inline
64 int serialize_ascii_table_array(const seri_t s, char *buf, const size_t buf_siz,
65 int *args_used, va_list ap) {
66 asciiTable_t *table = (asciiTable_t*)s.info;
67 args_used[0] = table->ncols + 1;
68 int ret = at_varray_to_bytes(*table, buf, buf_siz, ap);
69 return ret;
70 };
71
81 static inline
82 int deserialize_ascii_table_array(const seri_t s, const char *buf,
83 const size_t buf_siz, va_list ap) {
84 asciiTable_t *table = (asciiTable_t*)s.info;
85 int ret = at_vbytes_to_array(*table, buf, buf_siz, ap);
86 return ret;
87 };
88
89 #ifdef __cplusplus /* If this is a C++ compiler, end C linkage */
90 }
91 #endif
92
93 #endif /*CISASCIITABLESERIALIZE_H_*/
seri_t
Serializer structure.
Definition: SerializeBase.h:19
asciiTable_t::ncols
int ncols
Number of columns in the table.
Definition: AsciiTable.h:84
asciiTable_t
Structure containing information about an ASCII table.
Definition: AsciiTable.h:80