forked from abduld/libwb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wbExport.h
81 lines (61 loc) · 2.6 KB
/
wbExport.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef __WB_EXPORT_H__
#define __WB_EXPORT_H__
#include <wb.h>
#include <wbFile.h>
#include <wbPPM.h>
typedef enum en_wbExportKind_t {
wbExportKind_unknown = -1,
wbExportKind_raw = 0x1000,
wbExportKind_csv,
wbExportKind_tsv,
wbExportKind_ppm,
} wbExportKind_t;
typedef struct st_wbExportRaw_t {
int rows;
int columns;
wbFile_t file;
} * wbExportRaw_t;
#define wbExportRaw_getColumnCount(raw) ((raw)->columns)
#define wbExportRaw_getRowCount(raw) ((raw)->rows)
#define wbExportRaw_getFile(raw) ((raw)->file)
#define wbExportRaw_setRowCount(raw, val) (wbExportRaw_getRowCount(raw) = val)
#define wbExportRaw_setColumnCount(raw, val) (wbExportRaw_getColumnCount(raw) = val)
typedef struct st_wbExportCVS_t {
int rows;
int columns;
wbFile_t file;
char seperator;
} * wbExportCSV_t;
#define wbExportCSV_getRowCount(csv) ((csv)->rows)
#define wbExportCSV_getColumnCount(csv) ((csv)->columns)
#define wbExportCSV_getFile(csv) ((csv)->file)
#define wbExportCSV_getSeperator(csv) ((csv)->seperator)
#define wbExportCSV_setRowCount(csv, val) (wbExportCSV_getRowCount(csv) = val)
#define wbExportCSV_setColumnCount(csv, val) (wbExportCSV_getColumnCount(csv) = val)
#define wbExportCSV_setSeperator(csv, val) (wbExportCSV_getSeperator(csv) = val)
typedef struct st_wbExport_t {
wbExportKind_t kind;
union {
wbExportRaw_t raw;
wbExportCSV_t csv;
wbImage_t img;
} container;
char * file;
} wbExport_t;
#define wbExport_getKind(exprt) ((exprt).kind)
#define wbExport_getContainer(exprt) ((exprt).container)
#define wbExport_getRaw(exprt) (wbExport_getContainer(exprt).raw)
#define wbExport_getCSV(exprt) (wbExport_getContainer(exprt).csv)
#define wbExport_getImage(exprt) (wbExport_getContainer(exprt).img)
#define wbExport_getFile(exprt) ((exprt).file)
#define wbExport_setKind(exprt, val) (wbExport_getKind(exprt) = val)
#define wbExport_setRaw(exprt, val) (wbExport_getRaw(exprt) = val)
#define wbExport_setCSV(exprt, val) (wbExport_getCSV(exprt) = val)
#define wbExport_setImage(exprt, val) (wbExport_getImage(exprt) = val)
#define wbExport_setFile(exprt, val) (wbExport_getFile(exprt) = val)
void wbExport(const char * file, int * data, int rows, int columns);
void wbExport(const char * file, int * data, int rows);
void wbExport(const char * file, wbReal_t * data, int rows, int columns);
void wbExport(const char * file, wbReal_t * data, int rows);
void wbExport(const char * file, wbImage_t img);
#endif /* __WB_EXPORT_H__ */