/****************************************************************************** * * Copyright (C) 2010 by * * CGTD ICARE * Université des Sciences et Technologies de Lille 1 * Polytech'Lille - Bâtiment Eydoux - Bureau E207 * Avenue Paul Langevin * 59650 Villeneuve d'Ascq Cedex * France * * Description : * ------------- * * This application copy copy an duplicate an HDF file and compress its datasets * * Limitations : * ------------- * * - Only supports the GZip compression * - Only supports duplication of : * File attributes * SDS data and attributes * * Synopsis : * ---------- * * hdfcompress * * Input : * ------- * * a valid and existing HDF file [REQUIRED] * path to the compressed output file [REQUIRED] * gzip compression level, from 0 to 9 [OPTIONAL]. If not set, 5 is used by default * * Output : * -------- * * 0 if run end normally | 1 if something has gone wrong * * Prerequisites : * --------------- * * The HDF4 library must be installed * * Author : * -------- * * CGTD-ICARE/UDEV Nicolas PASCAL * * License : * --------- * * This file must be used under the terms of the CeCILL. * This source file is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt * * History : * -------- * * v0.0.0 : 04/01/2010 * - creation * *****************************************************************************/ #include "HDFCompressor.h" #include void usage ( const char * app_name ) { cerr << "Not enough command line arguments" << endl << endl; cerr << "Usage: " << app_name << " " << endl << endl; cerr << "where" << endl << endl; cerr << " a valid and existing HDF file [REQUIRED]" << endl; cerr << " path to the compressed output file [REQUIRED]" << endl; cerr << " gzip compression level, from 0 to 9 [OPTIONAL]. If not set, " << DEFAULT_COMPRESSION_LEVEL << " is used by default" << endl << endl; } int main ( int argc, char* argv [] ) { // check number of command line args if ( argc < 3 ) { usage ( argv [0] ); return EXIT_FAILURE; } // read command line args string infile ( argv [1] ); string outfile ( argv [2] ); int comp_level ( DEFAULT_COMPRESSION_LEVEL ); char * pend; if ( argc > 3 ) comp_level = strtol ( argv [3], &pend, 10 ); // init compression processor HDFCompressor compressor ( infile, outfile, comp_level ); cout << compressor << endl; compressor.run(); return EXIT_SUCCESS; }