Assimp v5.2.2 (January 2022)
The Asset-Importer-Lib API documentation.
Assimp::StreamWriter< SwapEndianess, RuntimeSwitch > Class Template Reference

Wrapper class around IOStream to allow for consistent writing of binary data in both little and big endian format. More...

#include <StreamWriter.h>

Public Member Functions

void Flush ()
 Flush the contents of the internal buffer, and the output IOStream. More...
 
std::size_t GetCurrentPos () const
 
template<typename T >
StreamWriteroperator<< (T f)
 overload operator<< and allow chaining of MM ops. More...
 
template<typename T >
void Put (T f)
 Generic write method. More...
 
void PutChar (char c)
 Write a single character to the stream. More...
 
void PutF4 (float f)
 Write a float to the stream
More...
 
void PutF8 (double d)
 Write a double to the stream
More...
 
void PutI1 (int8_t n)
 Write a signed 8 bit integer to the stream. More...
 
void PutI2 (int16_t n)
 Write a signed 16 bit integer to the stream. More...
 
void PutI4 (int32_t n)
 Write an signed 32 bit integer to the stream. More...
 
void PutI8 (int64_t n)
 Write a signed 64 bit integer to the stream. More...
 
void PutString (const aiString &s)
 Write an aiString to the stream. More...
 
void PutString (const std::string &s)
 Write a std::string to the stream. More...
 
void PutU1 (uint8_t n)
 Write a unsigned 8 bit integer to the stream. More...
 
void PutU2 (uint16_t n)
 Write a unsigned 16 bit integer to the stream. More...
 
void PutU4 (uint32_t n)
 Write an unsigned 32 bit integer to the stream. More...
 
void PutU8 (uint64_t n)
 Write a unsigned 64 bit integer to the stream. More...
 
aiReturn Seek (size_t pOffset, aiOrigin pOrigin=aiOrigin_SET)
 Seek to the given offset / origin in the output IOStream. More...
 
void SetCurrentPos (std::size_t new_cursor)
 
 StreamWriter (IOStream *stream, bool le=false)
 
 StreamWriter (std::shared_ptr< IOStream > stream, bool le=false)
 Construction from a given stream with a well-defined endianness. More...
 
size_t Tell ()
 Tell the current position in the output IOStream. More...
 
 ~StreamWriter ()
 

Detailed Description

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
class Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >

Wrapper class around IOStream to allow for consistent writing of binary data in both little and big endian format.

Don't attempt to instance the template directly. Use StreamWriterLE to write to a little-endian stream and StreamWriterBE to write to a BE stream. Alternatively, there is StreamWriterAny if the endianness of the output stream is to be determined at runtime.

Constructor & Destructor Documentation

◆ StreamWriter() [1/2]

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::StreamWriter ( std::shared_ptr< IOStream stream,
bool  le = false 
)
inline

Construction from a given stream with a well-defined endianness.

The StreamReader holds a permanent strong reference to the stream, which is released upon destruction.

Parameters
streamInput stream. The stream is not re-seeked and writing continues at the current position of the stream cursor.
leIf RuntimeSwitch is true: specifies whether the stream is in little endian byte order. Otherwise the endianness information is defined by the SwapEndianess template parameter and this parameter is meaningless.

◆ StreamWriter() [2/2]

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::StreamWriter ( IOStream stream,
bool  le = false 
)
inline

◆ ~StreamWriter()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::~StreamWriter ( )
inline

Member Function Documentation

◆ Flush()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::Flush ( )
inline

Flush the contents of the internal buffer, and the output IOStream.

◆ GetCurrentPos()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
std::size_t Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::GetCurrentPos ( ) const
inline

◆ operator<<()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
template<typename T >
StreamWriter & Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::operator<< ( f)
inline

overload operator<< and allow chaining of MM ops.

◆ Put()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
template<typename T >
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::Put ( f)
inline

Generic write method.

ByteSwap::Swap(T*) must be defined

◆ PutChar()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutChar ( char  c)
inline

Write a single character to the stream.

◆ PutF4()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutF4 ( float  f)
inline

Write a float to the stream

◆ PutF8()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutF8 ( double  d)
inline

Write a double to the stream

◆ PutI1()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutI1 ( int8_t  n)
inline

Write a signed 8 bit integer to the stream.

◆ PutI2()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutI2 ( int16_t  n)
inline

Write a signed 16 bit integer to the stream.

◆ PutI4()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutI4 ( int32_t  n)
inline

Write an signed 32 bit integer to the stream.

◆ PutI8()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutI8 ( int64_t  n)
inline

Write a signed 64 bit integer to the stream.

◆ PutString() [1/2]

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutString ( const aiString s)
inline

Write an aiString to the stream.

◆ PutString() [2/2]

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutString ( const std::string &  s)
inline

Write a std::string to the stream.

◆ PutU1()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutU1 ( uint8_t  n)
inline

Write a unsigned 8 bit integer to the stream.

◆ PutU2()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutU2 ( uint16_t  n)
inline

Write a unsigned 16 bit integer to the stream.

◆ PutU4()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutU4 ( uint32_t  n)
inline

Write an unsigned 32 bit integer to the stream.

◆ PutU8()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::PutU8 ( uint64_t  n)
inline

Write a unsigned 64 bit integer to the stream.

◆ Seek()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
aiReturn Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::Seek ( size_t  pOffset,
aiOrigin  pOrigin = aiOrigin_SET 
)
inline

Seek to the given offset / origin in the output IOStream.

Flushes the internal buffer and the output IOStream prior to seeking.

◆ SetCurrentPos()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
void Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::SetCurrentPos ( std::size_t  new_cursor)
inline

◆ Tell()

template<bool SwapEndianess = false, bool RuntimeSwitch = false>
size_t Assimp::StreamWriter< SwapEndianess, RuntimeSwitch >::Tell ( )
inline

Tell the current position in the output IOStream.

First flushes the internal buffer and the output IOStream.


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