vil1_stream_section Struct Reference

#include <vil1_stream_section.h>

Inheritance diagram for vil1_stream_section:

vil1_stream List of all members.

Detailed Description

make a section of a vil1_stream behave like a vil1_stream.

It is possible to have multiple vil1_stream_sections using the same underlying stream simultaneously. This is accomplished by keeping a note of the current position and seeking a lot.

Note however that this is *not* threadsafe.

Definition at line 21 of file vil1_stream_section.h.


Public Member Functions

 vil1_stream_section (vil1_stream *underlying, int begin)
 skip to position 'begin' in underlying stream and translate seeks, reads and writes relative to that position into seeks, reads and writes in the underlying stream.
 vil1_stream_section (vil1_stream *underlying, int begin, int end)
 as above, but will not allow seeks, reads or writes past 'end'.
bool ok () const
 Return false if the stream is broken.
vil1_streampos write (void const *buf, vil1_streampos n)
 Write n bytes from buf. Returns number of bytes written.
vil1_streampos read (void *buf, vil1_streampos n)
 Read n bytes into buf. Returns number of bytes read.
vil1_streampos tell () const
 Return file pointer.
void seek (vil1_streampos position)
 Goto file pointer.
void ref ()
 up/down the reference count.
void unref ()

Protected Member Functions

 ~vil1_stream_section ()

Private Attributes

vil1_streamunderlying_
vil1_streampos begin_
vil1_streampos end_
vil1_streampos current_

Constructor & Destructor Documentation

vil1_stream_section::vil1_stream_section ( vil1_stream underlying,
int  begin 
)

skip to position 'begin' in underlying stream and translate seeks, reads and writes relative to that position into seeks, reads and writes in the underlying stream.

Definition at line 18 of file vil1_stream_section.cxx.

vil1_stream_section::vil1_stream_section ( vil1_stream underlying,
int  begin,
int  end 
)

as above, but will not allow seeks, reads or writes past 'end'.

Definition at line 29 of file vil1_stream_section.cxx.

vil1_stream_section::~vil1_stream_section (  )  [protected]

Definition at line 41 of file vil1_stream_section.cxx.


Member Function Documentation

bool vil1_stream_section::ok (  )  const [inline, virtual]

Return false if the stream is broken.

Implements vil1_stream.

Definition at line 34 of file vil1_stream_section.h.

vil1_streampos vil1_stream_section::write ( void const *  buf,
vil1_streampos  n 
) [virtual]

Write n bytes from buf. Returns number of bytes written.

The return value is less than n only in case of device failure.

Implements vil1_stream.

Definition at line 50 of file vil1_stream_section.cxx.

vil1_streampos vil1_stream_section::read ( void *  buf,
vil1_streampos  n 
) [virtual]

Read n bytes into buf. Returns number of bytes read.

The return value is less than n only at eof.

Implements vil1_stream.

Definition at line 77 of file vil1_stream_section.cxx.

vil1_streampos vil1_stream_section::tell (  )  const [inline, virtual]

Return file pointer.

Implements vil1_stream.

Definition at line 37 of file vil1_stream_section.h.

void vil1_stream_section::seek ( vil1_streampos  position  )  [virtual]

Goto file pointer.

Implements vil1_stream.

Definition at line 104 of file vil1_stream_section.cxx.

void vil1_stream::ref (  )  [inline, inherited]

up/down the reference count.

Definition at line 38 of file vil1_stream.h.

void vil1_stream::unref (  )  [inherited]

Definition at line 31 of file vil1_stream.cxx.


Member Data Documentation

vil1_stream* vil1_stream_section::underlying_ [private]

Definition at line 44 of file vil1_stream_section.h.

vil1_streampos vil1_stream_section::begin_ [private]

Definition at line 45 of file vil1_stream_section.h.

vil1_streampos vil1_stream_section::end_ [private]

Definition at line 46 of file vil1_stream_section.h.

vil1_streampos vil1_stream_section::current_ [private]

Definition at line 47 of file vil1_stream_section.h.


The documentation for this struct was generated from the following files:
Generated on Wed Oct 15 05:08:21 2008 for core/vil1 by  doxygen 1.5.1