vil_stream_fstream64.h
Go to the documentation of this file.
1 // This is core/vil/vil_stream_fstream64.h
2 #ifndef vil_stream_fstream64_h_
3 #define vil_stream_fstream64_h_
4 #ifdef VIL_USE_FSTREAM64
5 //:
6 // \file
7 // \brief A vil_stream implementation that can handle files bigger than 2GB
8 // This file is only added to the VXL build for WIN32 builds because
9 // MSVC compilers do not support transparent large file access via std::fstream
10 // (ie. vil_stream_fstream can't support large files on this platform)
11 //
12 // \author rob@stellarscience.com
13 // \date 28 Jun 05
14 
15 #ifdef _MSC_VER
16 # include <vcl_msvc_warnings.h>
17 #endif
18 #include <vil/vil_stream.h>
19 
20 //: A vil_stream implementation using std::fstream
21 class vil_stream_fstream64 : public vil_stream
22 {
23  public:
24  vil_stream_fstream64(char const* filename, char const* mode);
25 
26 #if defined(_WIN32) && VXL_USE_WIN_WCHAR_T
27  vil_stream_fstream64(wchar_t const* filename, char const* mode);
28 #endif
29 
30  // implement virtual vil_stream interface:
31  bool ok() const { return fd_ != -1; }
32  vil_streampos write(void const* buf, vil_streampos n);
33  vil_streampos read(void* buf, vil_streampos n);
34  vil_streampos tell() const;
35  void seek(vil_streampos position);
36 
37  vil_streampos file_size() const;
38 
39  protected:
40  ~vil_stream_fstream64();
41 
42  private:
43  int fd_;
44  int mode_;
45 };
46 
47 #endif // VIL_USE_FSTREAM64
48 #endif // vil_stream_fstream64_h_
Stream interface for VIL image loaders.
virtual vil_streampos tell() const =0
Return file pointer.
virtual vil_streampos write(void const *buf, vil_streampos n)=0
Write n bytes from buf. Returns number of bytes written.
virtual void seek(vil_streampos position)=0
Goto file pointer.
virtual vil_streampos read(void *buf, vil_streampos n)=0
Read n bytes into buf. Returns number of bytes read.
Stream interface for VIL image loaders.
Definition: vil_stream.h:21
virtual bool ok() const =0
Return false if the stream is broken.
vxl_int_32 vil_streampos
Definition: vil_stream.h:16
virtual vil_streampos file_size() const =0
Amount of data in the stream.