Mkd64 module API  1.3b
API for creating own mkd64 modules
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Track Class Reference

Class representing a track on a C64 disk. More...

#include <mkd64/track.h>

Related Functions

(Note that these are not member functions.)

size_t Track_objectSize (void)
 Get object size for a track.
TrackTrack_init (Track *self, int tracknum, size_t num_sectors)
 Initialize a track instance.
void Track_done (Track *self)
 Delete a track instance.
BlockStatus Track_blockStatus (const Track *self, int sector)
 Get the block status of the block in a given sector.
size_t Track_numSectors (const Track *self)
 Get number of sectors on this track.
int Track_freeSectors (const Track *self, BlockStatus mask)
 Get number of free sectors on this track.
int Track_reserveBlock (Track *self, int sector, IModule *by)
 Reserve the block in a given sector.
int Track_allocateBlock (Track *self, int sector)
 Allocate the block in a given sector.
int Track_allocateFirstFreeFrom (Track *self, int sector, int considerReserved)
 Allocate first available block from a given start sector.
BlockTrack_block (const Track *self, int sector)
 Get the block object at a given sector number.

Detailed Description

Class representing a track on a C64 disk.

Friends And Related Function Documentation

int Track_allocateBlock ( Track self,
int  sector 
)
related

Allocate the block in a given sector.

ATTENTION: This does not check anything. Make sure you never allocate a block that is currently reserved by some other module. If you need a reserved block, ask for it using block_unReserve()!

Parameters
selfthe track
sectorthe sector number
Returns
1 on success, 0 otherwise
int Track_allocateFirstFreeFrom ( Track self,
int  sector,
int  considerReserved 
)
related

Allocate first available block from a given start sector.

This is a convenience function to find and allocate the next available sector by searching sequentially from a given sector number, mostly useful while implementing a custom IBlockAllocator.

Parameters
selfthe track
sectorthe number of the sector to try first
considerReservedif 1, try unreserving any reserved but not yet allocated sector.
Returns
the sector number of the newly allocated block, or -1 if no available block was found.
Block * Track_block ( const Track self,
int  sector 
)
related

Get the block object at a given sector number.

Parameters
selfthe track
sectorthe sector number
Returns
the block object, or 0 if no block at the given sector number exists
BlockStatus Track_blockStatus ( const Track self,
int  sector 
)
related

Get the block status of the block in a given sector.

Parameters
selfthe track
sectorthe sector number
Returns
the block status
void Track_done ( Track self)
related

Delete a track instance.

This frees all memory allocated by this track and the blocks contained in it

Parameters
selfthe track to delete
int Track_freeSectors ( const Track self,
BlockStatus  mask 
)
related

Get number of free sectors on this track.

Parameters
selfthe track
maska mask of BlockStatus values to be considered "free" in addition to blocks with the "BS_NONE" status. E.g. specify "BS_RESERVED" here to include reserved blocks, that are not allocated yet.
Returns
the number of free sectors
Track * Track_init ( Track self,
int  tracknum,
size_t  num_sectors 
)
related

Initialize a track instance.

Parameters
selfthe track
tracknumthe number of this track on the disk image
num_sectorsthe number of sectors to use on this track
Returns
a new track instance
size_t Track_numSectors ( const Track self)
related

Get number of sectors on this track.

Parameters
selfthe track
Returns
the number of sectors
size_t Track_objectSize ( void  )
related

Get object size for a track.

Returns
size of a track instance
int Track_reserveBlock ( Track self,
int  sector,
IModule by 
)
related

Reserve the block in a given sector.

Parameters
selfthe track
sectorthe sector number
bythe module reserving the block
Returns
1 on success, 0 otherwise

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