profuse/ProDOS/Bitmap.h
ksherlock 304164ecfa integrate profuse (classic)
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@386 aa027e90-d47c-11dd-86d7-074df07e0730
2011-03-13 16:02:30 +00:00

54 lines
888 B
C++

#ifndef __BITMAP_H__
#define __BITMAP_H__
#include <stdint.h>
#include <vector>
namespace Device
{
class BlockDevice;
class BlockCache;
}
namespace ProDOS {
class Bitmap {
public:
Bitmap(unsigned blocks);
Bitmap(Device::BlockCache *cache, unsigned keyPointer, unsigned blocks);
~Bitmap();
int allocBlock();
int allocBlock(unsigned block);
void freeBlock(unsigned block);
unsigned freeBlocks() const { return _freeBlocks; }
unsigned blocks() const { return _blocks; }
unsigned bitmapBlocks() const { return _bitmapBlocks; }
unsigned bitmapSize() const { return _bitmapBlocks * 512; }
const void *bitmap() const { return &_bitmap[0]; }
private:
unsigned _freeIndex;
unsigned _freeBlocks;
unsigned _blocks;
unsigned _bitmapBlocks;
std::vector<uint8_t> _bitmap;
};
}
#endif