Panda3D

Public Member Functions | Public Attributes | List of all members
IStreamWrapper Class Reference

This class provides a locking wrapper around an arbitrary istream pointer. More...

`#include "streamWrapper.h"`

Inheritance diagram for IStreamWrapper:

## Public Member Functions
| IStreamWrapper (std::istream &stream)
| IStreamWrapper (std::istream *stream, bool owns_pointer)
int | get ()
| Atomically reads a single character from the stream. More...
std::istream * | get_istream () const
void | read (char *buffer, std::streamsize num_bytes)
void | read (char *buffer, std::streamsize num_bytes, std::streamsize &read_bytes)
void | read (char *buffer, std::streamsize num_bytes, std::streamsize &read_bytes, bool &eof)
std::streamsize | seek_gpos_eof ()
| Atomically seeks to EOF and returns the gpos there; that is, returns the file size. More...
void | seek_read (std::streamsize pos, char *buffer, std::streamsize num_bytes, std::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. More...
Public Member Functions inherited from StreamWrapperBase
void | acquire ()
| Acquires the internal lock. More...
void | ref () const
| Increments the reference count. More...
void | release ()
| Releases the internal lock. More...
bool | unref () const
| Decrements the reference count. More...

## Public Attributes
| get_istream
| Returns the istream this object is wrapping. More...

## Detailed Description

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 59 of file streamWrapper.h.

## Member Function Documentation

## ◆ get()

int IStreamWrapper::get | ( |  | ) |
| inline

Atomically reads a single character from the stream.

Definition at line 110 of file streamWrapper.I.

## ◆ seek_gpos_eof()

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 122 of file streamWrapper.cxx.

References StreamWrapperBase::acquire(), and StreamWrapperBase::release().

## ◆ seek_read()

void IStreamWrapper::seek_read | ( | std::streamsize | pos,
|  | char * | buffer,
|  | std::streamsize | num_bytes,
|  | std::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 104 of file streamWrapper.cxx.

References StreamWrapperBase::acquire(), and StreamWrapperBase::release().

## Member Data Documentation

## ◆ get_istream

std::istream * IStreamWrapper::get_istream
| inline

Returns the istream this object is wrapping.

Definition at line 67 of file streamWrapper.h.

The documentation for this class was generated from the following files:

- dtool/src/prc/streamWrapper.h
- dtool/src/prc/streamWrapper.cxx
- dtool/src/prc/streamWrapper.I