]> Creatis software - gdcm.git/blob - src/gdcmjpegls/Decoder/gdcmfstream.h
In order to allow to use current version (1.3) of gdcm *and* ITK (that includes
[gdcm.git] / src / gdcmjpegls / Decoder / gdcmfstream.h
1 /*=========================================================================
2   
3   Program:   gdcm
4   Module:    $RCSfile: gdcmfstream.h,v $
5   Language:  C++
6   Date:      $Date: 2007/05/23 14:18:14 $
7   Version:   $Revision: 1.2 $
8   
9   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10   l'Image). All rights reserved. See Doc/License.txt or
11   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
12   
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notices for more information.
16   
17 =========================================================================*/
18
19 #ifndef __gdcmfstream_
20 #define __gdcmfstream_
21
22 #include <fstream>
23 #include <list>
24
25 namespace GDCM_NAME_SPACE {
26
27 class ifstream : public std::ifstream
28 {
29 // First the position of the fragment, then the fragment lenght
30 typedef std::pair<std::streampos, std::streamsize> fragment;
31
32 public:
33   explicit ifstream(const char* filename,
34     std::ios_base::openmode mode = std::ios_base::in);
35
36   std::istream&  read (char* s, std::streamsize n );
37   inline void add_fragment(fragment f) { fragments.push_back(f); }
38
39 private:
40   std::list<fragment> fragments;
41 };
42
43 } //end namespace gdcm
44
45 #endif