#include <bitmap.h>
Public Methods | |
| BitMap (int nitems) | |
| ~BitMap () | |
| void | Mark (int which) |
| void | Clear (int which) |
| bool | Test (int which) |
| int | Find () |
| int | NumClear () |
| void | Print () |
| void | FetchFrom (OpenFile *file) |
| void | WriteBack (OpenFile *file) |
Private Attributes | |
| int | numBits |
| int | numWords |
| unsigned int * | map |
|
|
Definition at line 20 of file bitmap.cc. References BitsInWord, Clear, divRoundUp, map, numBits, and numWords.
00021 {
00022 numBits = nitems;
00023 numWords = divRoundUp(numBits, BitsInWord);
00024 map = new unsigned int[numWords];
00025 for (int i = 0; i < numBits; i++)
00026 Clear(i);
00027 }
|
|
|
Definition at line 34 of file bitmap.cc. References map.
00035 {
00036 delete map;
00037 }
|
|
|
Definition at line 61 of file bitmap.cc. References ASSERT, BitsInWord, map, and numBits. Referenced by BitMap, FileHeader::Deallocate, and FileSystem::Remove.
00062 {
00063 ASSERT(which >= 0 && which < numBits);
00064 map[which / BitsInWord] &= ~(1 << (which % BitsInWord));
00065 }
|
|
|
Definition at line 149 of file bitmap.cc. References map, numWords, and OpenFile::ReadAt. Referenced by FileSystem::Create, FileSystem::Print, and FileSystem::Remove.
|
|
|
Definition at line 95 of file bitmap.cc. References Mark, numBits, and Test. Referenced by FileHeader::Allocate, and FileSystem::Create.
|
|
|
Definition at line 47 of file bitmap.cc. References ASSERT, BitsInWord, map, and numBits. Referenced by FileSystem::FileSystem, and Find.
00048 {
00049 ASSERT(which >= 0 && which < numBits);
00050 map[which / BitsInWord] |= 1 << (which % BitsInWord);
00051 }
|
|
|
Definition at line 112 of file bitmap.cc. Referenced by FileHeader::Allocate.
|
|
|
Definition at line 130 of file bitmap.cc. Referenced by FileSystem::FileSystem, and FileSystem::Print.
|
|
|
Definition at line 75 of file bitmap.cc. References ASSERT, BitsInWord, FALSE, map, numBits, and TRUE. Referenced by FileHeader::Deallocate, Find, NumClear, and Print.
00076 {
00077 ASSERT(which >= 0 && which < numBits);
00078
00079 if (map[which / BitsInWord] & (1 << (which % BitsInWord)))
00080 return TRUE;
00081 else
00082 return FALSE;
00083 }
|
|
|
Definition at line 162 of file bitmap.cc. References map, numWords, and OpenFile::WriteAt. Referenced by FileSystem::Create, FileSystem::FileSystem, and FileSystem::Remove.
|
|
|
Definition at line 61 of file bitmap.h. Referenced by BitMap, Clear, FetchFrom, Mark, Test, WriteBack, and ~BitMap. |
|
|
Definition at line 56 of file bitmap.h. Referenced by BitMap, Clear, Find, Mark, NumClear, Print, and Test. |
|
|
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002