]> Creatis software - gdcm.git/blob - src/gdcmjpegls/Decoder/gdcmfstream.h
3a332a2d3b4f0f02cc53dbaba8d1074964a06b0c
[gdcm.git] / src / gdcmjpegls / Decoder / gdcmfstream.h
1 /*=========================================================================
2   
3   Program:   gdcm
4   Module:    $RCSfile: gdcmfstream.h,v $
5   Language:  C++
6   Date:      $Date: 2005/06/13 00:22:14 $
7   Version:   $Revision: 1.1 $
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 {
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