BAPS/packing/BP/FreeSpace.h

00001 /**********************************************************************
00002  *
00003  * Filename    : FreeSpace.h
00004  * Author      : Chen Li Wen
00005  *
00006  * Version     : 1.03
00007  * Date        : July 15, 1998
00008  *
00009  * Description : Interface file for class FreeSpace. It's a collection 
00010  *               FreeBlocks which can packed to vessels. 
00011  *
00012  * Reference   : nil
00013  *
00014  * Notes       : nil
00015  *
00016  * Changes     : Add the function Last. July 12, 1998.
00017  *
00018  * Copyright   : Copyright (c) 1998
00019  *               All rights reserved by
00020  *               Resource Allocation and Scheduling Group
00021  *               Department of Information Systems and Computer Science
00022  *               National University of Singapore
00023  *
00024  **********************************************************************/
00025 
00026 #ifndef __FREESPACE_H__
00027 #define __FREESPACE_H__
00028 
00029 #include "FreeBlock.h"
00030 #include "Vessel.h"
00031 
00032 #include <LEDA/list.h>
00033 
00034 class FreeSpace
00035 {
00036    public:
00037       FreeSpace();
00038       FreeSpace(int aSize);
00039       FreeSpace(list<FreeBlock>& aListOfFreeBlocks);
00040       FreeSpace(const FreeSpace& aFreeSpace);
00041       ~FreeSpace();
00042 
00043       // Debugger facility
00044       void Print(int aWidth = 1, int aDetail = 0) const;
00045 
00046       // Initialization
00047       void Initialize(int aSize);
00048 
00049       // Useful Functions for doing packing and liberating.
00050       void Remove(FreeBlock& aFreeBlock);
00051       void Substitute(FreeBlock& OldFB, FreeBlock& NewFB);
00052 
00053       // If aDirection is 0, it will insert before, else, will insert after
00054       void Insert(FreeBlock& aPosition, FreeBlock& aFreeBlock, 
00055                   int aDirection = 0);
00056       
00057       // Assign Vessel to FreeBlcok.
00058       void AssignVessel(FreeBlock& aFreeBlock, Vessel& aVessel);
00059       
00060       // Liberating Vessel from FreeBlock
00061       void Liberation(Vessel& aVessel);
00062       
00063       // Access function
00064       list<FreeBlock> GetFreeBlockList() const;
00065       FreeBlock First() const;
00066       FreeBlock Last() const;
00067       int GetLength() const;
00068 
00069    private:
00070       list<FreeBlock> mFreeBlockList;
00071 };
00072 
00073 #endif

Generated on Tue Sep 9 15:40:10 2008 for BAP by  doxygen 1.5.3