vil_stream_section Struct Reference

#include <vil_stream_section.h>

Inheritance diagram for vil_stream_section:

vil_stream List of all members.

Detailed Description

make a section of a vil_stream behave like a vil_stream.

It is possible to have multiple vil_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 vil_stream_section.h.


Public Member Functions

 vil_stream_section (vil_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.
 vil_stream_section (vil_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.
vil_streampos write (void const *buf, vil_streampos n)
 Write n bytes from buf. Returns number of bytes written.
vil_streampos read (void *buf, vil_streampos n)
 Read n bytes into buf. Returns number of bytes read.
vil_streampos tell () const
 Return file pointer.
void seek (vil_streampos position)
 Goto file pointer.
vil_streampos file_size () const
 Amount of data in the stream.
void ref ()
 up/down the reference count.
void unref ()

Protected Member Functions

 ~vil_stream_section ()

Private Attributes

vil_streamunderlying_
vil_streampos begin_
vil_streampos end_
vil_streampos current_

Constructor & Destructor Documentation

vil_stream_section::vil_stream_section ( vil_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 vil_stream_section.cxx.

vil_stream_section::vil_stream_section ( vil_stream underlying,
int  begin,
int  end 
)

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

Definition at line 29 of file vil_stream_section.cxx.

vil_stream_section::~vil_stream_section (  )  [protected]

Definition at line 41 of file vil_stream_section.cxx.


Member Function Documentation

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

Return false if the stream is broken.

Implements vil_stream.

Definition at line 34 of file vil_stream_section.h.

vil_streampos vil_stream_section::write ( void const *  buf,
vil_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 vil_stream.

Definition at line 50 of file vil_stream_section.cxx.

vil_streampos vil_stream_section::read ( void *  buf,
vil_streampos  n 
) [virtual]

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

The return value is less than n only at eof.

Implements vil_stream.

Definition at line 77 of file vil_stream_section.cxx.

vil_streampos vil_stream_section::tell (  )  const [inline, virtual]

Return file pointer.

Implements vil_stream.

Definition at line 37 of file vil_stream_section.h.

void vil_stream_section::seek ( vil_streampos  position  )  [virtual]

Goto file pointer.

Implements vil_stream.

Definition at line 104 of file vil_stream_section.cxx.

vil_streampos vil_stream_section::file_size (  )  const [virtual]

Amount of data in the stream.

Implements vil_stream.

Definition at line 116 of file vil_stream_section.cxx.

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

up/down the reference count.

Definition at line 48 of file vil_stream.h.

void vil_stream::unref (  )  [inherited]

Definition at line 31 of file vil_stream.cxx.


Member Data Documentation

vil_stream* vil_stream_section::underlying_ [private]

Definition at line 46 of file vil_stream_section.h.

vil_streampos vil_stream_section::begin_ [private]

Definition at line 47 of file vil_stream_section.h.

vil_streampos vil_stream_section::end_ [private]

Definition at line 48 of file vil_stream_section.h.

vil_streampos vil_stream_section::current_ [private]

Definition at line 49 of file vil_stream_section.h.


The documentation for this struct was generated from the following files:
Generated on Sat Nov 22 05:08:01 2008 for core/vil by  doxygen 1.5.1