Ocean
Ocean::IO::ScopedInputBitstream Class Reference

This class implements a scoped input bitstream that allows to read content from a bitstream while the stream position is restored if this object is disposed. More...

Inheritance diagram for Ocean::IO::ScopedInputBitstream:

Public Member Functions

 ScopedInputBitstream (InputBitstream &stream)
 Creates a new scoped input bitstream object from a given input bitstream object and stores the current stream position of the given stream object. More...
 
 ~ScopedInputBitstream ()
 Destructs this scoped object and restores the stream position of the original input bitstream object. More...
 
- Public Member Functions inherited from Ocean::IO::InputBitstream
 InputBitstream (std::istream &stream)
 Creates a new bitstream object. More...
 
template<typename T >
bool read (T &value)
 Reads a value from the bitstream and moves the internal position inside the bitstream accordingly. More...
 
template<typename T >
readDefault (const T &defaultValue)
 Reads a value from the bitstream and moves the internal position inside the bitstream accordingly. More...
 
bool read (void *data, const size_t size)
 Reads a defined memory block from the stream into a given buffer and moves the internal position inside the bitstream accordingly. More...
 
template<typename T >
bool look (T &value)
 Reads a value from the bitstream but does not move the internal position inside the bitstream. More...
 
unsigned long long position () const
 Returns the current position inside the bitstream, in bytes counting from the beginning of the stream. More...
 
unsigned long long size () const
 Returns the current size of the bitstream, in bytes. More...
 
bool setPosition (const unsigned long long position)
 Sets the current position inside the bitstream explicitly. More...
 
 operator bool () const
 Returns whether this bitstream object is valid and can be used. More...
 

Protected Attributes

unsigned long long streamStartPosition_
 The original stream position of the original bitstream object. More...
 
- Protected Attributes inherited from Ocean::IO::InputBitstream
std::istream & inputStream
 The internal input stream object that this object encapsulates. More...
 

Detailed Description

This class implements a scoped input bitstream that allows to read content from a bitstream while the stream position is restored if this object is disposed.

The implementation of this scoped input bitstream object is not thread-safe.

See also
InputBitstream

Constructor & Destructor Documentation

◆ ScopedInputBitstream()

Ocean::IO::ScopedInputBitstream::ScopedInputBitstream ( InputBitstream stream)
inline

Creates a new scoped input bitstream object from a given input bitstream object and stores the current stream position of the given stream object.

◆ ~ScopedInputBitstream()

Ocean::IO::ScopedInputBitstream::~ScopedInputBitstream ( )
inline

Destructs this scoped object and restores the stream position of the original input bitstream object.

Field Documentation

◆ streamStartPosition_

unsigned long long Ocean::IO::ScopedInputBitstream::streamStartPosition_
protected

The original stream position of the original bitstream object.


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