Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
StateRecorderImpl Class Referencefinal

Implementation of the StateRecorder class that uses a stringstream as underlying store and that implements checking if the state doesn't change upon reading. More...

#include <StateRecorderImpl.h>

Inheritance diagram for StateRecorderImpl:
StateRecorder StreamIn StreamOut NonCopyable NonCopyable

Public Member Functions

 StateRecorderImpl ()=default
 Constructor.
 
 StateRecorderImpl (StateRecorderImpl &&inRHS)
 
virtual void WriteBytes (const void *inData, size_t inNumBytes) override
 Write a string of bytes to the binary stream.
 
void Rewind ()
 Rewind the stream for reading.
 
void Clear ()
 Clear the stream for reuse.
 
virtual void ReadBytes (void *outData, size_t inNumBytes) override
 Read a string of bytes from the binary stream.
 
virtual bool IsEOF () const override
 
virtual bool IsFailed () const override
 Returns true if there was an IO failure.
 
bool IsEqual (StateRecorderImpl &inReference)
 Compare this state with a reference state and ensure they are the same.
 
std::string GetData () const
 Convert the binary data to a string.
 
size_t GetDataSize ()
 Get size of the binary data in bytes.
 
- Public Member Functions inherited from StateRecorder
 StateRecorder ()=default
 Constructor.
 
 StateRecorder (const StateRecorder &inRHS)
 
void SetValidating (bool inValidating)
 
bool IsValidating () const
 
void SetIsLastPart (bool inIsLastPart)
 
bool IsLastPart () const
 
- Public Member Functions inherited from StreamIn
virtual ~StreamIn ()=default
 Virtual destructor.
 
template<class T , std::enable_if_t< std::is_trivially_copyable_v< T >, bool > = true>
void Read (T &outT)
 Read a primitive (e.g. float, int, etc.) from the binary stream.
 
template<class T , class A , std::enable_if_t< std::is_trivially_copyable_v< T >, bool > = true>
void Read (Array< T, A > &outT)
 Read a vector of primitives from the binary stream.
 
template<class Type , class Traits , class Allocator >
void Read (std::basic_string< Type, Traits, Allocator > &outString)
 Read a string from the binary stream (reads the number of characters and then the characters)
 
template<class T , class A , typename F >
void Read (Array< T, A > &outT, const F &inReadElement)
 Read a vector of primitives from the binary stream using a custom function to read the elements.
 
void Read (Vec3 &outVec)
 Read a Vec3 (don't read W)
 
void Read (DVec3 &outVec)
 Read a DVec3 (don't read W)
 
void Read (DMat44 &outVec)
 Read a DMat44 (don't read W component of translation)
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 
- Public Member Functions inherited from StreamOut
virtual ~StreamOut ()=default
 Virtual destructor.
 
template<class T , std::enable_if_t< std::is_trivially_copyable_v< T >, bool > = true>
void Write (const T &inT)
 Write a primitive (e.g. float, int, etc.) to the binary stream.
 
template<class T , class A , std::enable_if_t< std::is_trivially_copyable_v< T >, bool > = true>
void Write (const Array< T, A > &inT)
 Write a vector of primitives to the binary stream.
 
template<class Type , class Traits , class Allocator >
void Write (const std::basic_string< Type, Traits, Allocator > &inString)
 Write a string to the binary stream (writes the number of characters and then the characters)
 
template<class T , class A , typename F >
void Write (const Array< T, A > &inT, const F &inWriteElement)
 Write a vector of primitives to the binary stream using a custom write function.
 
void Write (const Vec3 &inVec)
 Write a Vec3 (don't write W)
 
void Write (const DVec3 &inVec)
 Write a DVec3 (don't write W)
 
void Write (const DMat44 &inVec)
 Write a DMat44 (don't write W component of translation)
 

Detailed Description

Implementation of the StateRecorder class that uses a stringstream as underlying store and that implements checking if the state doesn't change upon reading.

Constructor & Destructor Documentation

◆ StateRecorderImpl() [1/2]

StateRecorderImpl::StateRecorderImpl ( )
default

Constructor.

◆ StateRecorderImpl() [2/2]

StateRecorderImpl::StateRecorderImpl ( StateRecorderImpl &&  inRHS)
inline

Member Function Documentation

◆ Clear()

void StateRecorderImpl::Clear ( )

Clear the stream for reuse.

◆ GetData()

std::string StateRecorderImpl::GetData ( ) const
inline

Convert the binary data to a string.

◆ GetDataSize()

size_t StateRecorderImpl::GetDataSize ( )
inline

Get size of the binary data in bytes.

◆ IsEOF()

virtual bool StateRecorderImpl::IsEOF ( ) const
inlineoverridevirtual

Returns true when an attempt has been made to read past the end of the file. Note that this follows the convention of std::basic_ios::eof which only returns true when an attempt is made to read past the end, not when the read pointer is at the end.

Implements StreamIn.

◆ IsEqual()

bool StateRecorderImpl::IsEqual ( StateRecorderImpl inReference)

Compare this state with a reference state and ensure they are the same.

◆ IsFailed()

virtual bool StateRecorderImpl::IsFailed ( ) const
inlineoverridevirtual

Returns true if there was an IO failure.

Implements StreamIn.

◆ ReadBytes()

void StateRecorderImpl::ReadBytes ( void *  outData,
size_t  inNumBytes 
)
overridevirtual

Read a string of bytes from the binary stream.

Implements StreamIn.

◆ Rewind()

void StateRecorderImpl::Rewind ( )

Rewind the stream for reading.

◆ WriteBytes()

JPH_NAMESPACE_BEGIN void StateRecorderImpl::WriteBytes ( const void *  inData,
size_t  inNumBytes 
)
overridevirtual

Write a string of bytes to the binary stream.

Implements StreamOut.


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