BAPS/packing/BP/SortVessel.h

00001 /**********************************************************************
00002  *
00003  * Filename    : SortVessel.h
00004  * Author      : Chen Li Wen
00005  *
00006  * Version     : 1.0
00007  * Date        : Aug. 13, 1998
00008  *
00009  * Description : This class is written to do various sorting for a 
00010  *               list of vessels according to different compare 
00011  *               rules.
00012  *
00013  * Reference   : nil
00014  *
00015  * Notes       : nil
00016  *
00017  * Changes     : nil
00018  *
00019  * Copyright   : Copyright (c) 1998
00020  *               All rights reserved by
00021  *               Resource Allocation and Scheduling Group
00022  *               Department of Computer Science
00023  *               School of Computing
00024  *               National University of Singapore
00025  *
00026  ********************************************************************/
00027 
00028 #ifndef __SORT_VESSEL_H__
00029 #define __SORT_VESSEL_H__
00030 
00031 #include "Vessel.h"
00032 #include <LEDA/list.h>
00033 
00034 
00035 // Define the number of compare rules. Now, we have
00036 // 20 distinct compare ruls.
00037 const int NUM_FUNC = 20;
00038 
00039 // This is an array of function pointers which point to
00040 // distinct compare functions.
00041 typedef int (*COMP_FUNC)(const Vessel&, const Vessel&);
00042 
00043 
00044 class SortVessel
00045 {
00046    public:
00047       SortVessel();
00048       ~SortVessel();
00049 
00050       // This function will set the parameter list, which will
00051       // tell you how to compare two vessels.
00052       void SetParamList(int *aParamList, int aSize);
00053 
00054       // Access functions.
00055       int  GetParamSize() const { return mParamSize; }
00056       int* GetParamList() const { return mParamList; }
00057 
00058       // Function to sort a vessel list according to the 
00059       // parameter list.
00060       void Sort(list<Vessel>& aVesselList);
00061    
00062    // Compare function defined by parameter list.
00063    friend int Compare(const Vessel& Lhs, const Vessel& Rhs);
00064 
00065    private:
00066       int *mParamList;
00067       int mParamSize;
00068 };
00069 
00070 #endif

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