Debian Codegraph @

matio-1.5.0/src/mat5.h

raw
1 /*
2 * Copyright (C) 2008-2011 Christopher C. Hulbert
3 *
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY CHRISTOPHER C. HULBERT ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL CHRISTOPHER C. HULBERT OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28 #ifndef MAT5_H
29 #define MAT5_H
30
31 #ifdef __cplusplus
32 # define EXTERN extern "C"
33 #else
34 # define EXTERN extern
35 #endif
36
37 static size_t GetStructFieldBufSize(matvar_t *matvar);
38 static size_t GetCellArrayFieldBufSize(matvar_t *matvar);
39 static size_t GetMatrixMaxBufSize(matvar_t *matvar);
40 static size_t GetEmptyMatrixMaxBufSize(const char *name,int rank);
41 static int WriteEmptyCharData(mat_t *mat, int N, enum matio_types data_type);
42 static int WriteEmptyData(mat_t *mat,int N,enum matio_types data_type);
43 static int ReadNextCell( mat_t *mat, matvar_t *matvar );
44 static int ReadNextStructField( mat_t *mat, matvar_t *matvar );
45 static int ReadNextFunctionHandle(mat_t *mat, matvar_t *matvar);
46 static int WriteCellArrayFieldInfo(mat_t *mat,matvar_t *matvar);
47 static int WriteCellArrayField(mat_t *mat,matvar_t *matvar );
48 static int WriteStructField(mat_t *mat,matvar_t *matvar);
49 static size_t Mat_WriteEmptyVariable5(mat_t *mat,const char *name,int rank,
50 size_t *dims);
51 #if defined(HAVE_ZLIB)
52 static size_t WriteCompressedCharData(mat_t *mat,z_stream *z,void *data,int N,
53 enum matio_types data_type);
54 static int WriteCompressedEmptyData(mat_t *mat,z_stream *z,int N,
55 enum matio_types data_type);
56 static size_t WriteCompressedData(mat_t *mat,z_stream *z,void *data,int N,
57 enum matio_types data_type);
58 static size_t WriteCompressedCellArrayField(mat_t *mat,matvar_t *matvar,
59 z_stream *z);
60 static size_t WriteCompressedStructField(mat_t *mat,matvar_t *matvar,
61 z_stream *z);
62 static size_t Mat_WriteCompressedEmptyVariable5(mat_t *mat,const char *name,
63 int rank,size_t *dims,z_stream *z);
64 #endif
65
66 /* mat5.c */
67 EXTERN mat_t *Mat_Create5(const char *matname,const char *hdr_str);
68
69 matvar_t *Mat_VarReadNextInfo5( mat_t *mat );
70 void Read5(mat_t *mat, matvar_t *matvar);
71 int ReadData5(mat_t *mat,matvar_t *matvar,void *data,
72 int *start,int *stride,int *edge);
73 int Mat_VarWrite5(mat_t *mat,matvar_t *matvar,int compress);
74 int WriteCharDataSlab2(mat_t *mat,void *data,enum matio_types data_type,
75 size_t *dims,int *start,int *stride,int *edge);
76 int WriteData(mat_t *mat,void *data,int N,enum matio_types data_type);
77 int WriteDataSlab2(mat_t *mat,void *data,enum matio_types data_type,
78 size_t *dims,int *start,int *stride,int *edge);
79 void WriteInfo5(mat_t *mat, matvar_t *matvar);
80
81 #endif