Isle
Loading...
Searching...
No Matches
MxDSSource Class Referenceabstract

[AI] Abstract base class representing a source of streamable data, providing an interface for reading, seeking, and buffer management used for audio/video/other resource streaming in the LEGO Island engine. More...

#include <mxdssource.h>

Inheritance diagram for MxDSSource:
Collaboration diagram for MxDSSource:

Public Member Functions

 MxDSSource ()
 [AI] Constructor, initializes buffer pointer to NULL, position to -1 and lengthInDWords to 0. More...
 
 ~MxDSSource () override
 [AI] Virtual destructor, frees internal buffer if allocated. More...
 
const char * ClassName () const override
 [AI] Returns the class name string ("MxDSSource"). More...
 
MxBool IsA (const char *p_name) const override
 [AI] Runtime type information check. More...
 
virtual MxLong Open (MxULong p_param)=0
 [AI] Opens the source (e.g., a file, memory buffer, etc). More...
 
virtual MxLong Close ()=0
 [AI] Closes the source and releases any resources held. More...
 
virtual MxResult ReadToBuffer (MxDSBuffer *p_buffer)
 [AI] Reads from this source into a provided MxDSBuffer up to the buffer's current write offset. More...
 
virtual MxResult Read (unsigned char *p_dest, MxULong p_count)=0
 [AI] Read a specified number of bytes into user-supplied buffer, starting at the current position. More...
 
virtual MxLong Seek (MxLong p_offset, MxS32 p_origin)=0
 [AI] Seek to a specific position in the source, relative to the start, current, or end. More...
 
virtual MxULong GetBufferSize ()=0
 [AI] Returns the total buffer size in bytes (implementation-dependent). More...
 
virtual MxULong GetStreamBuffersNum ()=0
 [AI] Returns the number of buffers the stream is internally segmented into (for multi-buffered streaming). More...
 
virtual MxLong GetLengthInDWords ()
 [AI] Gets the length of the data in DWORDs (32-bit units). More...
 
virtual MxU32GetBuffer ()
 [AI] Returns a pointer to the internal buffer as a DWORD (32-bit) pointer. More...
 
MxLong GetPosition () const
 [AI] Returns the current per-source seek/read/write position. 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

MxULong m_lengthInDWords
 [AI] Length of valid data in the stream, in DWORDs (32-bit units). Used for sizing and range checking. More...
 
MxU32m_pBuffer
 [AI] Pointer to allocated buffer, or NULL if uninitialized. Contains the raw read/streamed data. More...
 
MxLong m_position
 [AI] Current seek/read/write position in the source. -1 if uninitialized, otherwise logical/physical offset. More...
 

Detailed Description

[AI] Abstract base class representing a source of streamable data, providing an interface for reading, seeking, and buffer management used for audio/video/other resource streaming in the LEGO Island engine.

Handles internal buffer memory, length in double words (DWORDs), and position management. Derived classes implement low-level IO such as file- or memory-backed streams.

[AI] Used as a parent for data sources (such as SI files, memory buffers, etc.) that can be consumed by higher-level deserialization or playback mechanisms (e.g., MxDSFile, MxDSMPEG, etc.). Not intended for external use directly; to be subclassed for data-specific sources. Manages a buffer (allocated as an array of MxU32) and an internal length for data integrity and direct access.

Definition at line 20 of file mxdssource.h.

Constructor & Destructor Documentation

◆ MxDSSource()

MxDSSource::MxDSSource ( )
inline

[AI] Constructor, initializes buffer pointer to NULL, position to -1 and lengthInDWords to 0.

Definition at line 25 of file mxdssource.h.

◆ ~MxDSSource()

MxDSSource::~MxDSSource ( )
inlineoverride

[AI] Virtual destructor, frees internal buffer if allocated.

Definition at line 30 of file mxdssource.h.

Member Function Documentation

◆ ClassName()

const char * MxDSSource::ClassName ( ) const
inlineoverridevirtual

[AI] Returns the class name string ("MxDSSource").

Used for runtime type checks.

Returns
[AI] String literal "MxDSSource".

Reimplemented from MxCore.

Definition at line 36 of file mxdssource.h.

◆ Close()

virtual MxLong MxDSSource::Close ( )
pure virtual

[AI] Closes the source and releases any resources held.

Returns
Implementation-defined result; generally, negative on failure.

Implemented in MxDSFile.

◆ GetBuffer()

virtual MxU32 * MxDSSource::GetBuffer ( )
inlinevirtual

[AI] Returns a pointer to the internal buffer as a DWORD (32-bit) pointer.

Useful for direct access to loaded or mapped data.

Returns
[AI] Pointer to buffer, or NULL if not allocated.

Definition at line 116 of file mxdssource.h.

◆ GetBufferSize()

virtual MxULong MxDSSource::GetBufferSize ( )
pure virtual

[AI] Returns the total buffer size in bytes (implementation-dependent).

Implemented in MxDSFile.

◆ GetLengthInDWords()

virtual MxLong MxDSSource::GetLengthInDWords ( )
inlinevirtual

[AI] Gets the length of the data in DWORDs (32-bit units).

This is often used to determine streamable length.

Returns
[AI] Length in DWORDs.

Definition at line 109 of file mxdssource.h.

◆ GetPosition()

MxLong MxDSSource::GetPosition ( ) const
inline

[AI] Returns the current per-source seek/read/write position.

Returns
Current position (implementation meaning: byte offset, index, etc). -1 if not set.

Definition at line 122 of file mxdssource.h.

◆ GetStreamBuffersNum()

virtual MxULong MxDSSource::GetStreamBuffersNum ( )
pure virtual

[AI] Returns the number of buffers the stream is internally segmented into (for multi-buffered streaming).

Implemented in MxDSFile.

◆ IsA()

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

[AI] Runtime type information check.

Returns true if the object's class name matches p_name or matches a parent class. Used for type-safe downcasting.

Parameters
p_nameName of the type to check.
Returns
TRUE if this object is a MxDSSource or matches parent; FALSE otherwise.

Reimplemented from MxCore.

Definition at line 49 of file mxdssource.h.

◆ Open()

virtual MxLong MxDSSource::Open ( MxULong  p_param)
pure virtual

[AI] Opens the source (e.g., a file, memory buffer, etc).

The meaning of the parameter depends on the implementation.

Parameters
p_param[AI] Implementation-specific parameter (may be a filename handle, a memory buffer, etc).
Returns
Implementation-defined result; generally, negative on failure.

Implemented in MxDSFile.

◆ Read()

virtual MxResult MxDSSource::Read ( unsigned char *  p_dest,
MxULong  p_count 
)
pure virtual

[AI] Read a specified number of bytes into user-supplied buffer, starting at the current position.

Implemented by each derived class.

Parameters
p_dest[AI] Destination buffer.
p_count[AI] Number of bytes to read.
Returns
Result indicating success or failure.

Implemented in MxDSFile.

◆ ReadToBuffer()

virtual MxResult MxDSSource::ReadToBuffer ( MxDSBuffer p_buffer)
inlinevirtual

[AI] Reads from this source into a provided MxDSBuffer up to the buffer's current write offset.

Parameters
p_buffer[AI] Target buffer to read data into.
Returns
Result indicating success or nature of failure.

Definition at line 73 of file mxdssource.h.

◆ Seek()

virtual MxLong MxDSSource::Seek ( MxLong  p_offset,
MxS32  p_origin 
)
pure virtual

[AI] Seek to a specific position in the source, relative to the start, current, or end.

Parameters
p_offset[AI] Seek offset.
p_origin[AI] Reference position (SEEK_SET, SEEK_CUR, or SEEK_END).
Returns
New position or negative on failure.

Implemented in MxDSFile.

Member Data Documentation

◆ m_lengthInDWords

MxULong MxDSSource::m_lengthInDWords
protected

[AI] Length of valid data in the stream, in DWORDs (32-bit units). Used for sizing and range checking.

Definition at line 125 of file mxdssource.h.

◆ m_pBuffer

MxU32* MxDSSource::m_pBuffer
protected

[AI] Pointer to allocated buffer, or NULL if uninitialized. Contains the raw read/streamed data.

Definition at line 126 of file mxdssource.h.

◆ m_position

MxLong MxDSSource::m_position
protected

[AI] Current seek/read/write position in the source. -1 if uninitialized, otherwise logical/physical offset.

Definition at line 127 of file mxdssource.h.


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