Page principale | Liste des namespaces | Hiérarchie des classes | Liste des classes | Répertoires | Liste des fichiers | Membres de namespace | Membres de classe | Membres de fichier

pbitmap.cc

Aller à la documentation de ce fichier.
00001 // pbitmap.c 
00002 //      Routines to manage a persistent bitmap -- a bitmap that is
00003 //      stored on disk.
00004 //
00005 // Copyright (c) 1992,1993,1995 The Regents of the University of California.
00006 // All rights reserved.  See copyright.h for copyright notice and limitation 
00007 // of liability and disclaimer of warranty provisions.
00008 
00009 #include "copyright.h"
00010 #include "pbitmap.h"
00011 
00012 //----------------------------------------------------------------------
00013 // PersistentBitmap::PersistentBitmap(int)
00014 //      Initialize a bitmap with "numItems" bits, so that every bit is clear.
00015 //      it can be added somewhere on a list.
00016 //
00017 //      "numItems" is the number of bits in the bitmap.
00018 //
00019 //      This constructor does not initialize the bitmap from a disk file
00020 //----------------------------------------------------------------------
00021 
00022 PersistentBitmap::PersistentBitmap(int numItems):Bitmap(numItems) 
00023 { 
00024 }
00025 
00026 //----------------------------------------------------------------------
00027 // PersistentBitmap::PersistentBitmap(OpenFile*,int)
00028 //      Initialize a persistent bitmap with "numItems" bits,
00029 //      so that every bit is clear.
00030 //
00031 //      "numItems" is the number of bits in the bitmap.
00032 //      "file" refers to an open file containing the bitmap (written
00033 //        by a previous call to PersistentBitmap::WriteBack
00034 //
00035 //      This constructor initializes the bitmap from a disk file
00036 //----------------------------------------------------------------------
00037 
00038 PersistentBitmap::PersistentBitmap(OpenFile *file, int numItems):Bitmap(numItems) 
00039 { 
00040     // map has already been initialized by the BitMap constructor,
00041     // but we will just overwrite that with the contents of the
00042     // map found in the file
00043     file->ReadAt((char *)map, numWords * sizeof(unsigned), 0);
00044 }
00045 
00046 //----------------------------------------------------------------------
00047 // PersistentBitmap::~PersistentBitmap
00048 //      De-allocate a persistent bitmap.
00049 //----------------------------------------------------------------------
00050 
00051 PersistentBitmap::~PersistentBitmap()
00052 { 
00053 }
00054 
00055 //----------------------------------------------------------------------
00056 // PersistentBitmap::FetchFrom
00057 //      Initialize the contents of a persistent bitmap from a Nachos file.
00058 //
00059 //      "file" is the place to read the bitmap from
00060 //----------------------------------------------------------------------
00061 
00062 void
00063 PersistentBitmap::FetchFrom(OpenFile *file) 
00064 {
00065     file->ReadAt((char *)map, numWords * sizeof(unsigned), 0);
00066 }
00067 
00068 //----------------------------------------------------------------------
00069 // PersistentBitmap::WriteBack
00070 //      Store the contents of a persistent bitmap to a Nachos file.
00071 //
00072 //      "file" is the place to write the bitmap to
00073 //----------------------------------------------------------------------
00074 
00075 void
00076 PersistentBitmap::WriteBack(OpenFile *file)
00077 {
00078    file->WriteAt((char *)map, numWords * sizeof(unsigned), 0);
00079 }

Généré le Sun Jan 15 00:45:45 2006 pour Système NachOS : par  doxygen 1.4.4