Nugget
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
psyqo::CDRom Class Referenceabstract

The base CDRom class. More...

#include <psyqo/cdrom.hh>

Inheritance diagram for psyqo::CDRom:
Inheritance graph
[legend]

Classes

struct  ReadRequest
 An asynchronous read request. More...
 

Public Member Functions

virtual ~CDRom ()
 
virtual void readSectors (uint32_t sector, uint32_t count, void *buffer, eastl::function< void(bool)> &&callback)=0
 Read a sector from the CDRom.
 
TaskQueue::Task scheduleReadSectors (uint32_t sector, uint32_t count, void *buffer)
 Schedule a read operation.
 
TaskQueue::Task scheduleReadRequest (ReadRequest *request)
 Schedule a read operation.
 
ReadSectorsAwaiter readSectorsForCoroutine (uint32_t sector, uint32_t count, void *buffer)
 Wrapper around the readSectors method for coroutines.
 

Detailed Description

The base CDRom class.

The CDRom system is meant to be swappable between multiple implementations, so the base class is a pure abstraction. This allows the ISO9660 parser to be used with any CDRom implementation.

Constructor & Destructor Documentation

◆ ~CDRom()

virtual psyqo::CDRom::~CDRom ( )
inlinevirtual

Member Function Documentation

◆ readSectors()

virtual void psyqo::CDRom::readSectors ( uint32_t  sector,
uint32_t  count,
void buffer,
eastl::function< void(bool)> &&  callback 
)
pure virtual

Read a sector from the CDRom.

The function will make reasonable attempts at reading the disk, but it is not guaranteed to succeed. Failures may be caused by the disk being faulty, the lid being opened, or no valid disk being present. Only one operation can be in progress at a time.

Parameters
sectorThe sector to read.
bufferThe buffer to read into.
sizeThe size of the buffer.
callbackThe callback to call when the read is done. It will be called from the main thread when possible. Its one argument is a boolean indicating whether the read was successful.

Implemented in psyqo::CDRomDevice.

◆ readSectorsForCoroutine()

ReadSectorsAwaiter psyqo::CDRom::readSectorsForCoroutine ( uint32_t  sector,
uint32_t  count,
void buffer 
)
inline

Wrapper around the readSectors method for coroutines.

This method will return an Awaiter object that can be used to suspend the coroutine until the read operation is complete. This is meant to be used in conjunction with the co_await keyword, in a coroutine.

Parameters
sectorThe sector to read.
countThe number of sectors to read.
bufferThe buffer to read into.
Returns
ReadSectorsAwaiter The awaitable object to be used with the co_await keyword.

◆ scheduleReadRequest()

psyqo::TaskQueue::Task psyqo::CDRom::scheduleReadRequest ( ReadRequest request)

Schedule a read operation.

This is a convenience function that will schedule a read operation and return a task that can be waited on. The difference with scheduleReadSectors is that this method will read its arguments right before the operation is processed, so the request data can be filled in at the last moment.

Parameters
[in]requestThe request to schedule.
Returns
A task that can be queued into a TaskQueue

◆ scheduleReadSectors()

psyqo::TaskQueue::Task psyqo::CDRom::scheduleReadSectors ( uint32_t  sector,
uint32_t  count,
void buffer 
)

Schedule a read operation.

This is a convenience function that will schedule a read operation and return a task that can be waited on.

Parameters
sectorThe sector to read.
bufferThe buffer to read into.
sizeThe size of the buffer.
Returns
A task that can be queued into a TaskQueue

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