core/vil/vil_stream_fstream64.h
Go to the documentation of this file.
00001 // This is core/vil/vil_stream_fstream64.h
00002 #ifndef vil_stream_fstream64_h_
00003 #define vil_stream_fstream64_h_
00004 #ifdef VIL_USE_FSTREAM64
00005 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00006 #pragma interface
00007 #endif
00008 //:
00009 // \file
00010 // \brief A vil_stream implementation that can handle files bigger than 2GB
00011 // This file is only added to the VXL build for WIN32 builds because
00012 // MSVC compilers do not support transparent large file access via std::fstream
00013 // (ie. vil_stream_fstream can't support large files on this platform)
00014 //
00015 // \author  rob@stellarscience.com
00016 // \date 28 Jun 05
00017 
00018 #include "vcl_compiler.h"
00019 #include <vil/vil_stream.h>
00020 
00021 //: A vil_stream implementation using vcl_fstream
00022 class vil_stream_fstream64 : public vil_stream
00023 {
00024  public:
00025   vil_stream_fstream64(char const* filename, char const* mode);
00026 
00027 #if defined(VCL_WIN32) && VXL_USE_WIN_WCHAR_T
00028   vil_stream_fstream64(wchar_t const* filename, char const* mode);
00029 #endif
00030 
00031   // implement virtual vil_stream interface:
00032   bool ok() const { return fd_ != -1; }
00033   vil_streampos write(void const* buf, vil_streampos n);
00034   vil_streampos read(void* buf, vil_streampos n);
00035   vil_streampos tell() const;
00036   void seek(vil_streampos position);
00037 
00038   vil_streampos file_size() const;
00039 
00040  protected:
00041   ~vil_stream_fstream64();
00042 
00043  private:
00044   int fd_;
00045   int mode_;
00046 };
00047 
00048 #endif // VIL_USE_FSTREAM64
00049 #endif // vil_stream_fstream64_h_