Panda3D

Loading...
Searching...
No Matches
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.
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.
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.
Public Member Functions inherited from StreamWrapperBase
void | acquire ()
| Acquires the internal lock.
void | ref () const
| Increments the reference count.
void | release ()
| Releases the internal lock.
bool | unref () const
| Decrements the reference count.

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

## 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.

## Constructor & Destructor Documentation

## ◆ IStreamWrapper() [1/2]

IStreamWrapper::IStreamWrapper | ( | std::istream * | stream,
|  | bool | owns_pointer )
| inline

Definition at line 82 of file streamWrapper.I.

## ◆ IStreamWrapper() [2/2]

IStreamWrapper::IStreamWrapper | ( | std::istream & | stream | ) |
| inline explicit

Definition at line 92 of file streamWrapper.I.

## ◆ ~IStreamWrapper()

IStreamWrapper::~IStreamWrapper | ( |  | ) |

Definition at line 21 of file streamWrapper.cxx.

## Member Function Documentation

## ◆ get()

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

Atomically reads a single character from the stream.

Definition at line 110 of file streamWrapper.I.

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

## ◆ 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