Isle
Loading...
Searching...
No Matches
MxRAMStreamProvider Class Reference

[AI] Provides RAM-backed stream data access. More...

#include <mxramstreamprovider.h>

Inheritance diagram for MxRAMStreamProvider:
Collaboration diagram for MxRAMStreamProvider:

Public Member Functions

 MxRAMStreamProvider ()
 [AI] Constructs a new MxRAMStreamProvider and initializes the buffer members to defaults/nullptr. More...
 
 ~MxRAMStreamProvider () override
 [AI] Destroys the MxRAMStreamProvider, releasing all memory buffers. More...
 
const char * ClassName () const override
 [AI] Returns the runtime class name string for this object. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Runtime type check against this and parent class. More...
 
MxResult SetResourceToGet (MxStreamController *p_resource) override
 [AI] Loads the requested resource (SI file) fully into memory, prepares internal buffers for fast access. More...
 
MxU32 GetFileSize () override
 [AI] Returns the loaded file's full byte size. More...
 
MxS32 GetStreamBuffersNum () override
 [AI] Returns number of stream buffers contained (always 1 for RAM provider). More...
 
MxU32 GetLengthInDWords () override
 [AI] Returns length (number) of 32-bit words in buffer (DWORD units). More...
 
MxU32GetBufferForDWords () override
 [AI] Returns pointer to the buffer as array of 32bit values (DWORDs), for data accessing aligned to 4 bytes. More...
 
MxU8GetBufferOfFileSize ()
 [AI] Returns pointer to raw file buffer as byte array. More...
 
- Public Member Functions inherited from MxStreamProvider
 MxStreamProvider ()
 [AI] Default constructor. Initializes stream provider with no lookup or file resource attached. [AI] More...
 
const char * ClassName () const override
 [AI] Returns the name identifier for this class. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Checks if this object is of the requested class name, or a subclass thereof. More...
 
virtual MxResult SetResourceToGet (MxStreamController *p_pLookup)
 [AI] Attaches a stream controller as the resource to provide data for. More...
 
virtual MxU32 GetFileSize ()=0
 [AI] Gets the file size, in bytes, of the underlying SI file resource. More...
 
virtual MxS32 GetStreamBuffersNum ()=0
 [AI] Returns the number of stream buffers internally maintained for this resource. More...
 
virtual void VTable0x20 (MxDSAction *p_action)
 [AI] Virtual hook for subclasses to react to new stream actions being queued. More...
 
virtual MxU32 GetLengthInDWords ()=0
 [AI] Gets the full buffer length, interpreted as a DWORD-count, for direct buffer streaming. More...
 
virtual MxU32GetBufferForDWords ()=0
 [AI] Returns a pointer to the underlying buffer, cast as an array of DWORDs, for streaming purposes. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Protected Attributes

MxU32 m_bufferSize
 [AI] Actual size in bytes of the buffer allocated for file (may match or exceed file size). More...
 
MxU32 m_fileSize
 [AI] Size in bytes of the loaded resource file. More...
 
MxU8m_pBufferOfFileSize
 [AI] Pointer to full byte buffer with loaded SI file contents. More...
 
MxU32 m_lengthInDWords
 [AI] Number of DWORD (4 byte) entries in buffer. More...
 
MxU32m_bufferForDWords
 [AI] Pointer to DWORD buffer for 4-byte-aligned access to SI chunk data. More...
 
- Protected Attributes inherited from MxStreamProvider
MxStreamControllerm_pLookup
 [AI] The stream controller using this provider as its data source. [AI] More...
 
MxDSFilem_pFile
 [AI] Pointer to the loaded SI file associated with this provider. [AI] More...
 

Detailed Description

[AI] Provides RAM-backed stream data access.

Handles loading entire SI files into memory buffers for fast reading and easy chunk combination. Subclass of MxStreamProvider.

[AI] The MxRAMStreamProvider loads the whole referenced SI file either from the HDD or CD to a dedicated memory buffer, and provides methods to access the buffer directly in various formats (raw bytes, DWORDs). It is essential for efficient in-memory streaming access, especially for objects that don't require disk streaming.

Definition at line 13 of file mxramstreamprovider.h.

Constructor & Destructor Documentation

◆ MxRAMStreamProvider()

MxRAMStreamProvider::MxRAMStreamProvider ( )

[AI] Constructs a new MxRAMStreamProvider and initializes the buffer members to defaults/nullptr.

Definition at line 13 of file mxramstreamprovider.cpp.

◆ ~MxRAMStreamProvider()

MxRAMStreamProvider::~MxRAMStreamProvider ( )
override

[AI] Destroys the MxRAMStreamProvider, releasing all memory buffers.

Definition at line 47 of file mxramstreamprovider.cpp.

Member Function Documentation

◆ ClassName()

const char * MxRAMStreamProvider::ClassName ( ) const
inlineoverridevirtual

[AI] Returns the runtime class name string for this object.

Returns
[AI] "MxRAMStreamProvider"

Reimplemented from MxCore.

Definition at line 29 of file mxramstreamprovider.h.

◆ GetBufferForDWords()

MxU32 * MxRAMStreamProvider::GetBufferForDWords ( )
overridevirtual

[AI] Returns pointer to the buffer as array of 32bit values (DWORDs), for data accessing aligned to 4 bytes.

Implements MxStreamProvider.

Definition at line 41 of file mxramstreamprovider.cpp.

◆ GetBufferOfFileSize()

MxU8 * MxRAMStreamProvider::GetBufferOfFileSize ( )
inline

[AI] Returns pointer to raw file buffer as byte array.

Definition at line 75 of file mxramstreamprovider.h.

◆ GetFileSize()

MxU32 MxRAMStreamProvider::GetFileSize ( )
overridevirtual

[AI] Returns the loaded file's full byte size.

Returns 0 if nothing loaded.

Implements MxStreamProvider.

Definition at line 23 of file mxramstreamprovider.cpp.

◆ GetLengthInDWords()

MxU32 MxRAMStreamProvider::GetLengthInDWords ( )
overridevirtual

[AI] Returns length (number) of 32-bit words in buffer (DWORD units).

Implements MxStreamProvider.

Definition at line 35 of file mxramstreamprovider.cpp.

◆ GetStreamBuffersNum()

MxS32 MxRAMStreamProvider::GetStreamBuffersNum ( )
overridevirtual

[AI] Returns number of stream buffers contained (always 1 for RAM provider).

[AI]

Implements MxStreamProvider.

Definition at line 29 of file mxramstreamprovider.cpp.

◆ IsA()

MxBool MxRAMStreamProvider::IsA ( const char *  p_name) const
inlineoverridevirtual

[AI] Runtime type check against this and parent class.

Parameters
p_nameName to check type against (case-sensitive/classname) [AI]
Returns
[AI] Returns true if p_name matches this class or any parent.

Reimplemented from MxCore.

Definition at line 40 of file mxramstreamprovider.h.

◆ SetResourceToGet()

MxResult MxRAMStreamProvider::SetResourceToGet ( MxStreamController p_resource)
overridevirtual

[AI] Loads the requested resource (SI file) fully into memory, prepares internal buffers for fast access.

Tries HDD, then CD for the file.

Parameters
p_resourceStream controller providing atom name and linkage. [AI]
Returns
[AI] SUCCESS if resource could be loaded, FAILURE if not.

Reimplemented from MxStreamProvider.

Definition at line 62 of file mxramstreamprovider.cpp.

Member Data Documentation

◆ m_bufferForDWords

MxU32* MxRAMStreamProvider::m_bufferForDWords
protected

[AI] Pointer to DWORD buffer for 4-byte-aligned access to SI chunk data.

Definition at line 82 of file mxramstreamprovider.h.

◆ m_bufferSize

MxU32 MxRAMStreamProvider::m_bufferSize
protected

[AI] Actual size in bytes of the buffer allocated for file (may match or exceed file size).

Definition at line 78 of file mxramstreamprovider.h.

◆ m_fileSize

MxU32 MxRAMStreamProvider::m_fileSize
protected

[AI] Size in bytes of the loaded resource file.

Definition at line 79 of file mxramstreamprovider.h.

◆ m_lengthInDWords

MxU32 MxRAMStreamProvider::m_lengthInDWords
protected

[AI] Number of DWORD (4 byte) entries in buffer.

Definition at line 81 of file mxramstreamprovider.h.

◆ m_pBufferOfFileSize

MxU8* MxRAMStreamProvider::m_pBufferOfFileSize
protected

[AI] Pointer to full byte buffer with loaded SI file contents.

Definition at line 80 of file mxramstreamprovider.h.


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