Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::IOutputStream Class Referenceabstract

#include <IOutputStream.h>

Inheritance diagram for ph::IOutputStream:
ph::IDataStream ph::StdOutputStream ph::BinaryFileOutputStream ph::FormattedTextOutputStream

Public Member Functions

virtual void write (std::size_t numBytes, const std::byte *bytes)=0
 Write data in the form of raw bytes in one go. The method does not return before finishing the writing process.
 
virtual void writeString (std::string_view str)=0
 Write a string in one go.
 
virtual void seekPut (std::size_t pos)=0
 Set the output position of the stream. The unit of the position is defined by the implementation.
 
virtual std::optional< std::size_t > tellPut ()=0
 Get the current output position of the stream. The unit of the position is defined by the implementation.
 
 operator bool () const override=0
 
virtual std::size_t writeSome (std::size_t numBytes, const std::byte *bytes)
 Write some data in the form of raw bytes. The method may return before finish writing all bytes. In such case, the method returns how many bytes were actually written.
 
void writeLine (std::string_view str)
 Write a line. Equivalent to calling writeString(std::string_view) with '
' as an extra character.
 
- Public Member Functions inherited from ph::IDataStream
virtual ~IDataStream ()=default
 
virtual std::string acquireName () const
 Access to the stream's name. This method is not meant to be used in a high performance context, unless otherwise stated by the overridder. Stream name is not always available.
 

Member Function Documentation

◆ operator bool()

ph::IOutputStream::operator bool ( ) const
overridepure virtual
Returns
Whether the stream is good for write.

Implements ph::IDataStream.

Implemented in ph::StdOutputStream.

◆ seekPut()

virtual void ph::IOutputStream::seekPut ( std::size_t pos)
pure virtual

Set the output position of the stream. The unit of the position is defined by the implementation.

Exceptions
IOExceptionIf the seeking process failed.

Implemented in ph::StdOutputStream.

◆ tellPut()

virtual std::optional< std::size_t > ph::IOutputStream::tellPut ( )
pure virtual

Get the current output position of the stream. The unit of the position is defined by the implementation.

Returns
Current output position. Empty if the position is unavailable.

Implemented in ph::StdOutputStream.

◆ write()

virtual void ph::IOutputStream::write ( std::size_t numBytes,
const std::byte * bytes )
pure virtual

Write data in the form of raw bytes in one go. The method does not return before finishing the writing process.

Exceptions
IOExceptionIf the write operation failed.

Implemented in ph::StdOutputStream.

◆ writeLine()

void ph::IOutputStream::writeLine ( std::string_view str)
inline

Write a line. Equivalent to calling writeString(std::string_view) with '
' as an extra character.

Parameters
strThe written string. Ideally should not include the new-line character.
Exceptions
IOExceptionIf the write operation failed.

◆ writeSome()

std::size_t ph::IOutputStream::writeSome ( std::size_t numBytes,
const std::byte * bytes )
inlinevirtual

Write some data in the form of raw bytes. The method may return before finish writing all bytes. In such case, the method returns how many bytes were actually written.

Returns
How many bytes were actually written.
Exceptions
IOExceptionIf the write operation failed.

◆ writeString()

virtual void ph::IOutputStream::writeString ( std::string_view str)
pure virtual

Write a string in one go.

Parameters
strThe written string.
Exceptions
IOExceptionIf the write operation failed.

Implemented in ph::FormattedTextOutputStream, and ph::StdOutputStream.


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