2003-10-23 05:55:07 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef H5REPACK_H__
|
|
|
|
#define H5REPACK_H__
|
|
|
|
|
|
|
|
#include "hdf5.h"
|
|
|
|
|
|
|
|
#define PFORMAT "%-7s %-7s %-7s\n" /*chunk info, compression info, name*/
|
|
|
|
#define PFORMAT1 "%-7s %-7s %-7s" /*chunk info, compression info, name*/
|
|
|
|
|
|
|
|
#define MAX_NC_NAME 256 /* max length of a name */
|
|
|
|
#define MAX_VAR_DIMS 32 /* max per variable dimensions */
|
|
|
|
|
2003-10-30 01:46:11 +08:00
|
|
|
#if 1
|
|
|
|
#define H5_REPACK_DEBUG
|
|
|
|
#endif
|
2003-10-23 05:55:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* data structures for command line options
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* a list of names */
|
|
|
|
typedef struct {
|
|
|
|
char obj[MAX_NC_NAME];
|
|
|
|
} obj_list_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
the type of compression and additional parameter
|
|
|
|
type can be one of the filters
|
|
|
|
H5Z_FILTER_NONE 0, uncompress if compressed
|
|
|
|
H5Z_FILTER_DEFLATE 1 , deflation like gzip
|
|
|
|
H5Z_FILTER_SZIP 4 , szip compression
|
|
|
|
*/
|
|
|
|
typedef struct {
|
|
|
|
int type;
|
|
|
|
int info;
|
|
|
|
} comp_info_t;
|
|
|
|
|
|
|
|
/* chunk lengths along each dimension and rank */
|
|
|
|
typedef struct {
|
|
|
|
hsize_t chunk_lengths[MAX_VAR_DIMS];
|
|
|
|
int rank;
|
|
|
|
} chunk_info_t;
|
|
|
|
|
|
|
|
/* information for one object, contains PATH, CHUNK info and COMP info */
|
|
|
|
typedef struct {
|
|
|
|
char path[MAX_NC_NAME]; /* name of object */
|
|
|
|
comp_info_t comp; /* compression information */
|
|
|
|
chunk_info_t chunk; /* chunk information */
|
|
|
|
} pack_info_t;
|
|
|
|
|
2003-10-29 01:40:05 +08:00
|
|
|
/* store a table of all objects */
|
2003-10-23 05:55:07 +08:00
|
|
|
typedef struct {
|
|
|
|
int size;
|
|
|
|
int nelems;
|
|
|
|
pack_info_t *objs;
|
2003-10-29 01:40:05 +08:00
|
|
|
} pack_opttbl_t;
|
2003-10-23 05:55:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* command line options
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* all the above, ready to go to the hrepack call */
|
|
|
|
typedef struct {
|
2003-10-29 01:40:05 +08:00
|
|
|
pack_opttbl_t *op_tbl; /*table with all -c and -t options */
|
2003-10-23 05:55:07 +08:00
|
|
|
int all_chunk; /*chunk all objects, input of "*" */
|
|
|
|
int all_comp; /*comp all objects, input of "*" */
|
|
|
|
comp_info_t comp_g; /*global compress INFO for the ALL case */
|
|
|
|
chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
|
|
|
|
int verbose; /*verbose mode */
|
|
|
|
int trip; /*which cycle are we in */
|
|
|
|
int threshold; /*minimum size to compress, in bytes */
|
|
|
|
|
2003-10-29 01:40:05 +08:00
|
|
|
} pack_opt_t;
|
2003-10-23 05:55:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* public functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2003-11-11 04:59:32 +08:00
|
|
|
int h5repack (const char* infile, const char* outfile, pack_opt_t *options);
|
|
|
|
int h5repack_addcomp (const char* str, pack_opt_t *options);
|
|
|
|
int h5repack_addchunk(const char* str, pack_opt_t *options);
|
2003-10-29 01:40:05 +08:00
|
|
|
int h5repack_init (pack_opt_t *options, int verbose);
|
|
|
|
int h5repack_end (pack_opt_t *options);
|
2003-10-23 05:55:07 +08:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2003-10-24 03:51:51 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* private functions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-11-11 04:59:32 +08:00
|
|
|
void read_info(const char *filename,pack_opt_t *options);
|
2003-10-24 03:51:51 +08:00
|
|
|
|
2003-10-23 05:55:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* H5REPACK_H__ */
|