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

[AI] Represents a source file handler for SI (Streamer Interface) files, providing buffered access for reading SI file data and managing chunks. More...

#include <mxdsfile.h>

Inheritance diagram for MxDSFile:
Collaboration diagram for MxDSFile:

Classes

struct  ChunkHeader
 [AI] Represents the SI file stream's header chunk, containing versioning and SI buffer info. More...
 

Public Member Functions

 MxDSFile (const char *p_filename, MxULong p_skipReadingChunks)
 [AI] Constructs an MxDSFile object with the specified filename and chunk-read behavior. More...
 
 __declspec (dllexport) ~MxDSFile() override
 [AI] Destructor (exported for DLL builds). More...
 
const char * ClassName () const override
 [AI] Class identification. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Type comparison with other class names (for dynamic type identification). More...
 
MxResult Open (MxULong) override
 [AI] Opens the SI file for reading or writing with the specified style flags. More...
 
MxResult Close () override
 [AI] Closes the file and releases internal file buffers. More...
 
MxResult Read (unsigned char *, MxULong) override
 [AI] Reads up to the specified number of bytes from the file into a buffer. More...
 
MxResult Seek (MxLong, MxS32) override
 [AI] Seeks to an absolute or relative position in the file. More...
 
MxULong GetBufferSize () override
 [AI] Returns the SI chunk's buffer size, as obtained from the SI file header. More...
 
MxULong GetStreamBuffersNum () override
 [AI] Returns the number of streaming buffers, as specified in the SI file header. More...
 
void SetFileName (const char *p_filename)
 [AI] Sets the SI file's name. More...
 
MxS32 CalcFileSize ()
 [AI] Calculates and returns the file size by querying the system (Windows GetFileSize). More...
 
- Public Member Functions inherited from MxDSSource
 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...
 

Additional Inherited Members

- Protected Attributes inherited from MxDSSource
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] Represents a source file handler for SI (Streamer Interface) files, providing buffered access for reading SI file data and managing chunks.

This class is responsible for opening, reading, and managing SI files compliant with major version 2 and minor version 2, and makes header and data chunk information available to OMNI engine subsystems.

The MxDSFile can be instructed to defer chunk reading until explicitly requested (via the m_skipReadingChunks flag).

Inherits from MxDSSource.

Definition at line 20 of file mxdsfile.h.

Constructor & Destructor Documentation

◆ MxDSFile()

MxDSFile::MxDSFile ( const char *  p_filename,
MxULong  p_skipReadingChunks 
)

[AI] Constructs an MxDSFile object with the specified filename and chunk-read behavior.

Parameters
p_filenamePath to the SI file to open. [AI]
p_skipReadingChunksIf nonzero, chunk reading is skipped until explicitly called through ReadChunks. [AI]

Definition at line 17 of file mxdsfile.cpp.

Member Function Documentation

◆ __declspec()

MxDSFile::__declspec ( dllexport  )
inlineoverride

[AI] Destructor (exported for DLL builds).

Automatically closes the file and releases associated resources. [AI]

Definition at line 38 of file mxdsfile.h.

◆ CalcFileSize()

MxS32 MxDSFile::CalcFileSize ( )
inline

[AI] Calculates and returns the file size by querying the system (Windows GetFileSize).

Returns
The file's size, or an error code from GetFileSize. [AI]

Definition at line 108 of file mxdsfile.h.

◆ ClassName()

const char * MxDSFile::ClassName ( ) const
inlineoverridevirtual

[AI] Class identification.

Returns
Returns this object's class name ("MxDSFile"). [AI]

Reimplemented from MxCore.

Definition at line 45 of file mxdsfile.h.

◆ Close()

MxLong MxDSFile::Close ( )
overridevirtual

[AI] Closes the file and releases internal file buffers.

[AI]

[AI] Resets file state and deletes memory buffer of loaded chunk data.

Implements MxDSSource.

Definition at line 92 of file mxdsfile.cpp.

◆ GetBufferSize()

MxULong MxDSFile::GetBufferSize ( )
overridevirtual

[AI] Returns the SI chunk's buffer size, as obtained from the SI file header.

[AI]

Implements MxDSSource.

Definition at line 132 of file mxdsfile.cpp.

◆ GetStreamBuffersNum()

MxULong MxDSFile::GetStreamBuffersNum ( )
overridevirtual

[AI] Returns the number of streaming buffers, as specified in the SI file header.

[AI]

Implements MxDSSource.

Definition at line 139 of file mxdsfile.cpp.

◆ IsA()

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

[AI] Type comparison with other class names (for dynamic type identification).

Parameters
p_nameThe name of the class for comparison. [AI]
Returns
True if the provided name matches this or a parent class, otherwise false. [AI]

Reimplemented from MxCore.

Definition at line 56 of file mxdsfile.h.

◆ Open()

MxResult MxDSFile::Open ( MxULong  p_uStyle)
overridevirtual

[AI] Opens the SI file for reading or writing with the specified style flags.

Parameters
[in]p_uStyleFlags for file access mode (e.g. read/write). [AI]

[AI] Also optionally reads SI chunks immediately, unless m_skipReadingChunks is enabled.

Implements MxDSSource.

Definition at line 25 of file mxdsfile.cpp.

◆ Read()

MxResult MxDSFile::Read ( unsigned char *  p_buf,
MxULong  p_nbytes 
)
overridevirtual

[AI] Reads up to the specified number of bytes from the file into a buffer.

Parameters
p_bufBuffer to read into. [AI]
p_nbytesNumber of bytes to read. [AI]

Implements MxDSSource.

Definition at line 108 of file mxdsfile.cpp.

◆ Seek()

MxResult MxDSFile::Seek ( MxLong  p_lOffset,
MxS32  p_iOrigin 
)
overridevirtual

[AI] Seeks to an absolute or relative position in the file.

Parameters
p_lOffsetOffset to seek to (from origin). [AI]
p_iOriginOne of SEEK_SET, SEEK_CUR, or SEEK_END. [AI]

Implements MxDSSource.

Definition at line 120 of file mxdsfile.cpp.

◆ SetFileName()

void MxDSFile::SetFileName ( const char *  p_filename)
inline

[AI] Sets the SI file's name.

Parameters
p_filenameNew filename to use for this object. [AI]

Definition at line 102 of file mxdsfile.h.


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