Add TNG writing and reading support
[alexxy/gromacs.git] / src / external / tng_io / include / compression / coder.h
1 /* This code is part of the tng compression routines.
2  *
3  * Written by Daniel Spangberg
4  * Copyright (c) 2010, 2013, The GROMACS development team.
5  *
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the Revised BSD License.
9  */
10
11 #ifndef CODER_H
12 #define CODER_H
13
14 #ifndef DECLSPECDLLEXPORT
15 #ifdef USE_WINDOWS
16 #define DECLSPECDLLEXPORT __declspec(dllexport)
17 #else /* USE_WINDOWS */
18 #define DECLSPECDLLEXPORT
19 #endif /* USE_WINDOWS */
20 #endif /* DECLSPECDLLEXPORT */
21
22 struct coder
23 {
24     unsigned int pack_temporary;
25     int pack_temporary_bits;
26     int stat_overflow;
27     int stat_numval;
28 };
29
30 struct coder DECLSPECDLLEXPORT *Ptngc_coder_init(void);
31 void DECLSPECDLLEXPORT Ptngc_coder_deinit(struct coder *coder);
32 unsigned char DECLSPECDLLEXPORT *Ptngc_pack_array(struct coder *coder,int *input, int *length, int coding, int coding_parameter, int natoms, int speed);
33 int DECLSPECDLLEXPORT Ptngc_unpack_array(struct coder *coder,unsigned char *packed,int *output, int length, int coding, int coding_parameter, int natoms);
34 unsigned char DECLSPECDLLEXPORT *Ptngc_pack_array_xtc2(struct coder *coder,int *input, int *length);
35 int DECLSPECDLLEXPORT Ptngc_unpack_array_xtc2(struct coder *coder,unsigned char *packed,int *output, int length);
36 unsigned char DECLSPECDLLEXPORT *Ptngc_pack_array_xtc3(int *input, int *length, int natoms, int speed);
37 int DECLSPECDLLEXPORT Ptngc_unpack_array_xtc3(unsigned char *packed,int *output, int length, int natoms);
38
39 void DECLSPECDLLEXPORT Ptngc_out8bits(struct coder *coder, unsigned char **output);
40 void DECLSPECDLLEXPORT Ptngc_pack_flush(struct coder *coder,unsigned char **output);
41 void DECLSPECDLLEXPORT Ptngc_write_pattern(struct coder *coder,unsigned int pattern, int nbits, unsigned char **output);
42
43 void DECLSPECDLLEXPORT Ptngc_writebits(struct coder *coder,unsigned int value,int nbits, unsigned char **output_ptr);
44 void DECLSPECDLLEXPORT Ptngc_write32bits(struct coder *coder,unsigned int value,int nbits, unsigned char **output_ptr);
45 void DECLSPECDLLEXPORT Ptngc_writemanybits(struct coder *coder,unsigned char *value,int nbits, unsigned char **output_ptr);
46
47
48 #endif