Panda3D
|
This class provides a locking wrapper around an arbitrary istream pointer. More...
#include "streamWrapper.h"
Public Member Functions | |
IStreamWrapper (istream *stream, bool owns_pointer) | |
IStreamWrapper (istream &stream) | |
int | get () |
Atomically reads a single character from the stream. | |
istream * | get_istream () const |
Returns the istream this object is wrapping. | |
void | read (char *buffer, streamsize num_bytes, streamsize &read_bytes, bool &eof) |
Atomically reads a number of bytes from the stream. | |
void | read (char *buffer, streamsize num_bytes) |
Atomically reads a number of bytes from the stream, without error detection. | |
void | read (char *buffer, streamsize num_bytes, streamsize &read_bytes) |
Atomically reads a number of bytes from the stream. | |
streamsize | seek_gpos_eof () |
Atomically seeks to EOF and returns the gpos there; that is, returns the file size. | |
void | seek_read (streamsize pos, char *buffer, streamsize num_bytes, streamsize &read_bytes, bool &eof) |
Atomically seeks to a particular offset from the beginning of the file, and reads a number of bytes from the stream. |
This class provides a locking wrapper around an arbitrary istream pointer.
A thread may use this class to perform an atomic seek/read/gcount operation.
Definition at line 53 of file streamWrapper.h.
int IStreamWrapper::get | ( | ) | [inline] |
Atomically reads a single character from the stream.
Definition at line 113 of file streamWrapper.I.
References StreamWrapperBase::acquire(), and StreamWrapperBase::release().
istream * IStreamWrapper::get_istream | ( | ) | const [inline] |
Returns the istream this object is wrapping.
Definition at line 103 of file streamWrapper.I.
Referenced by Multifile::flush().
void IStreamWrapper::read | ( | char * | buffer, |
streamsize | num_bytes | ||
) |
Atomically reads a number of bytes from the stream, without error detection.
If fewer bytes than requested are read, quietly fills the remaining bytes with 0.
Definition at line 47 of file streamWrapper.cxx.
References StreamWrapperBase::acquire(), and StreamWrapperBase::release().
void IStreamWrapper::read | ( | char * | buffer, |
streamsize | num_bytes, | ||
streamsize & | read_bytes, | ||
bool & | eof | ||
) |
Atomically reads a number of bytes from the stream.
Returns the number of bytes actually read, and whether an eof condition was detected by the operation.
Definition at line 99 of file streamWrapper.cxx.
References StreamWrapperBase::acquire(), and StreamWrapperBase::release().
void IStreamWrapper::read | ( | char * | buffer, |
streamsize | num_bytes, | ||
streamsize & | read_bytes | ||
) |
Atomically reads a number of bytes from the stream.
Returns the number of bytes actually read.
Definition at line 81 of file streamWrapper.cxx.
References StreamWrapperBase::acquire(), and StreamWrapperBase::release().
streamsize IStreamWrapper::seek_gpos_eof | ( | ) |
Atomically seeks to EOF and returns the gpos there; that is, returns the file size.
Note that the EOF might have been moved in another thread by the time this method returns.
Definition at line 140 of file streamWrapper.cxx.
References StreamWrapperBase::acquire(), and StreamWrapperBase::release().
Referenced by SubStreamBuf::seekoff().
void IStreamWrapper::seek_read | ( | streamsize | pos, |
char * | buffer, | ||
streamsize | num_bytes, | ||
streamsize & | read_bytes, | ||
bool & | eof | ||
) |
Atomically seeks to a particular offset from the beginning of the file, and reads a number of bytes from the stream.
Returns the number of bytes actually read, and whether an eof condition was detected by the operation.
Definition at line 119 of file streamWrapper.cxx.
References StreamWrapperBase::acquire(), and StreamWrapperBase::release().
Referenced by Multifile::read_subfile(), and SubStreamBuf::underflow().