7 # include <vcl_msvc_warnings.h> 18 static const vil_streampos maxVilStreamPos = std::numeric_limits< vil_streampos >::max();
19 static const vil_streampos minVilStreamPos = std::numeric_limits< vil_streampos >::min();
35 std::stringstream str;
36 str <<
"name " <<
mId++;
37 std::string nm = str.str();
38 unsigned n = nm.size();
39 char* name =
new char[n+1];
41 for(std::string::iterator sit = nm.begin(); sit !=nm.end(); ++sit, ++i)
44 *(CNCSError*)
this = CNCSJPCIOStream::Open(name, bWrite);
46 return *(CNCSError*)
this;
57 *(CNCSError*)
this = NCS_SUCCESS;
59 return *(CNCSError*)
this;
79 absoluteOffset += offset;
82 absoluteOffset +=
Size() - 1 - offset;
85 absoluteOffset +=
Tell() + offset;
88 *(CNCSError*)
this = NCS_FILE_IO_ERROR;
93 if ( ! ( absoluteOffset >= 0 && absoluteOffset <= mVilStream->file_size() ) ) {
94 *(CNCSError*)
this = NCS_FILE_SEEK_ERROR;
100 *(CNCSError*)
this = NCS_SUCCESS;
102 return *(CNCSError*)
this == NCS_SUCCESS;
118 if ( bytesRead != count ){
119 *(CNCSError*)
this = NCS_INVALID_PARAMETER;
128 if ( bytesWritten != count ){
129 *(CNCSError*)
this = NCS_INVALID_PARAMETER;
Stream interface for VIL image loaders.
virtual vil_streampos tell() const =0
Return file pointer.
virtual CNCSError Close()
virtual vil_streampos write(void const *buf, vil_streampos n)=0
Write n bytes from buf. Returns number of bytes written.
virtual bool NCS_FASTCALL Seek()
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.
vil_stream * mVilStream
The stream I get all my data from (and write too)
virtual bool NCS_FASTCALL Write(void *buffer, UINT32 count)
Stream interface for VIL image loaders.
static unsigned short mId
virtual bool NCS_FASTCALL Read(void *buffer, UINT32 count)
void ref()
up/down the reference count.
virtual CNCSError Open(vil_stream *stream, bool bWrite=false)
Pass me the stream you want me to wrap.
vil_streampos mHomePos
This position is my home position (ie.
virtual INT64 NCS_FASTCALL Size()
virtual vil_streampos file_size() const =0
Amount of data in the stream.
virtual INT64 NCS_FASTCALL Tell()