An in-core vil_stream implementation. More...
#include <vil_stream_core.h>
Public Member Functions | |
vil_stream_core (unsigned block_size=16384) | |
vil_streampos | size () const |
get current file size. | |
vil_streampos | m_transfer (char *buf, vil_streampos pos, vil_streampos n, bool read) |
Read or write n bytes at position pos. | |
bool | ok () const |
Return false if the stream is broken. | |
vil_streampos | read (void *buf, vil_streampos n) |
Read n bytes into buf. Returns number of bytes read. | |
vil_streampos | write (void const *buf, vil_streampos n) |
Write n bytes from buf. Returns number of bytes written. | |
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_core () | |
Private Attributes | |
vil_streampos | curpos_ |
unsigned | blocksize_ |
vcl_vector< char * > | block_ |
vil_streampos | tailpos_ |
Related Functions | |
(Note that these are not member functions.) | |
vil_stream * | vil_open (char const *what, char const *how="r") |
make a vil_stream from a filename, an URL, etc. | |
float | vil_stream_read_big_endian_float (vil_stream *is) |
Reads in a 4-byte big-endian float. | |
void | vil_stream_read_big_endian_int_16 (vil_stream *is, vxl_uint_16 *data, unsigned n) |
Reads in n 16 bit unsigned ints. | |
void | vil_stream_write_big_endian_uint_16 (vil_stream *, vxl_uint_16) |
void | vil_stream_write_little_endian_uint_16 (vil_stream *, vxl_uint_16) |
void | vil_stream_write_big_endian_uint_32 (vil_stream *, vxl_uint_32) |
void | vil_stream_write_little_endian_uint_32 (vil_stream *, vxl_uint_32) |
An in-core vil_stream implementation.
This is an infinite stream - reads past the last point written will succeed but will return garbage data.
Definition at line 18 of file vil_stream_core.h.
vil_stream_core::vil_stream_core | ( | unsigned | block_size = 16384 | ) |
Definition at line 14 of file vil_stream_core.cxx.
vil_stream_core::~vil_stream_core | ( | ) | [protected] |
Definition at line 20 of file vil_stream_core.cxx.
vil_streampos vil_stream_core::file_size | ( | ) | const [inline, virtual] |
Amount of data in the stream.
Implements vil_stream.
Definition at line 43 of file vil_stream_core.h.
vil_streampos vil_stream_core::m_transfer | ( | char * | buf, |
vil_streampos | pos, | ||
vil_streampos | n, | ||
bool | read | ||
) |
Read or write n bytes at position pos.
This does not change the current position. When read=false, buf is actually a "char const *".
Definition at line 50 of file vil_stream_core.cxx.
bool vil_stream_core::ok | ( | ) | const [inline, virtual] |
Return false if the stream is broken.
Implements vil_stream.
Definition at line 37 of file vil_stream_core.h.
vil_streampos vil_stream_core::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 29 of file vil_stream_core.cxx.
void vil_stream::ref | ( | ) | [inline, inherited] |
up/down the reference count.
Definition at line 48 of file vil_stream.h.
void vil_stream_core::seek | ( | vil_streampos | position | ) | [inline, virtual] |
vil_streampos vil_stream_core::size | ( | ) | const [inline] |
get current file size.
Definition at line 29 of file vil_stream_core.h.
vil_streampos vil_stream_core::tell | ( | ) | const [inline, virtual] |
void vil_stream::unref | ( | ) | [inherited] |
Definition at line 31 of file vil_stream.cxx.
vil_streampos vil_stream_core::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 40 of file vil_stream_core.cxx.
vil_stream * vil_open | ( | char const * | what, |
char const * | how = "r" |
||
) | [related] |
make a vil_stream from a filename, an URL, etc.
Definition at line 19 of file vil_open.cxx.
float vil_stream_read_big_endian_float | ( | vil_stream * | is | ) | [related] |
Reads in a 4-byte big-endian float.
Definition at line 109 of file vil_stream_read.cxx.
void vil_stream_read_big_endian_int_16 | ( | vil_stream * | is, |
vxl_uint_16 * | data, | ||
unsigned | n | ||
) | [related] |
Reads in n 16 bit unsigned ints.
Caller is responsible for allocating enough space.
Definition at line 121 of file vil_stream_read.cxx.
void vil_stream_write_big_endian_uint_16 | ( | vil_stream * | , |
vxl_uint_16 | |||
) | [related] |
Definition at line 17 of file vil_stream_write.cxx.
void vil_stream_write_big_endian_uint_32 | ( | vil_stream * | , |
vxl_uint_32 | |||
) | [related] |
Definition at line 33 of file vil_stream_write.cxx.
void vil_stream_write_little_endian_uint_16 | ( | vil_stream * | , |
vxl_uint_16 | |||
) | [related] |
Definition at line 25 of file vil_stream_write.cxx.
void vil_stream_write_little_endian_uint_32 | ( | vil_stream * | , |
vxl_uint_32 | |||
) | [related] |
Definition at line 43 of file vil_stream_write.cxx.
vcl_vector<char*> vil_stream_core::block_ [private] |
Definition at line 22 of file vil_stream_core.h.
unsigned vil_stream_core::blocksize_ [private] |
Definition at line 21 of file vil_stream_core.h.
vil_streampos vil_stream_core::curpos_ [private] |
Definition at line 20 of file vil_stream_core.h.
vil_streampos vil_stream_core::tailpos_ [private] |
Definition at line 23 of file vil_stream_core.h.