HDF5Serie

Project Page
/home/user/MBSimWindows/hdf5serie/hdf5serie/hdf5serie/fileserie.h
00001 /* Copyright (C) 2009 Markus Friedrich
00002  *
00003  * This library is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU Lesser General Public
00005  * License as published by the Free Software Foundation; either
00006  * version 2.1 of the License, or (at your option) any later version.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Lesser General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public
00014  * License along with this library; if not, write to the Free Software
00015  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
00016  *
00017  * Contact:
00018  *   friedrich.at.gc@googlemail.com
00019  *
00020  */
00021 
00022 #ifndef _HDF5SERIE_FILESERIE_H_
00023 #define _HDF5SERIE_FILESERIE_H_
00024 
00025 #include <fmatvec/atom.h>
00026 #include <H5Cpp.h>
00027 #include <list>
00028 
00029 namespace H5 {
00030 
00031   class FileSerie : public H5File, public fmatvec::Atom {
00032     using H5File::flush;
00033     private:
00034       static std::list<FileSerie*> openedFile;
00035       static bool flushOnes;
00036       static void sigUSR2Handler(int);
00037       static int defaultCompression;
00038       static int defaultChunkSize;
00039     public:
00040       FileSerie(const char *name, unsigned int flags,
00041                 const FileCreatPropList &create_plist=FileCreatPropList::DEFAULT,
00042                 const FileAccPropList &access_plist=FileAccPropList::DEFAULT);
00043       FileSerie(const H5std_string &name, unsigned int flags,
00044                 const FileCreatPropList &create_plist=FileCreatPropList::DEFAULT,
00045                 const FileAccPropList &access_plist=FileAccPropList::DEFAULT);
00046       ~FileSerie();
00047       void close();
00048       void openFile(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist=FileAccPropList::DEFAULT);
00049       void openFile(const char *name, unsigned int flags, const FileAccPropList &access_plist=FileAccPropList::DEFAULT);
00050       static void flushAllFiles();
00051       static bool getFlushOnes() { return flushOnes; }
00052       static void deletePIDFiles();
00053 
00054       static int getDefaultCompression() { return defaultCompression; }
00055       static void setDefaultCompression(int comp) { defaultCompression=comp; }
00056       static int getDefaultChunkSize() { return defaultChunkSize; }
00057       static void setDefaultChunkSize(int chunk) { defaultChunkSize=chunk; }
00058   };
00059 }
00060 
00061 #endif