Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

timeblock.h

Go to the documentation of this file.
00001 // -*- C++ -*- 
00002 /*
00003 ** Copyright (C) 2000 Alan McIvor <alan@mcivor.gen.nz>
00004 **  
00005 ** This program is free software; you can redistribute it and/or modify
00006 ** it under the terms of the GNU General Public License as published by
00007 ** the Free Software Foundation; either version 2 of the License, or
00008 ** (at your option) any later version.
00009 ** 
00010 ** This program is distributed in the hope that it will be useful,
00011 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ** GNU General Public License for more details.
00014 ** 
00015 ** You should have received a copy of the GNU General Public License
00016 ** along with this program; if not, write to the Free Software 
00017 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef TIMEBLOCK_H
00021 #define TIMEBLOCK_H
00022 
00023 #include <string>
00024 #include <vector>
00025 using namespace std;
00026 
00027 class TASK;
00028 class RESOURCE;
00029 
00030 class TimeBlock
00031 {
00032 public:
00033 
00034     enum Type
00035     {
00036         MANUAL_SCHEDULE,
00037         AUTO_SCHEDULE,
00038         WORK_DONE,
00039         INVALID
00040     };
00041 
00042     TimeBlock(int start, int finish, Type type);
00043     virtual ~TimeBlock() = 0;
00044     int start() const { return mStart; };
00045     int finish() const { return mFinish; };
00046     Type type() const { return mType; };
00047 
00048     bool overlap(int start, int finish) const;
00049 
00050 private:
00051     int mStart;
00052     int mFinish;
00053     Type mType;
00054 };
00055 
00056 
00057 class TaskTimeBlock : public TimeBlock
00058 {
00059 public:
00060     TaskTimeBlock(RESOURCE *r, int start, int finish, Type type);
00061     ~TaskTimeBlock() {};
00062     RESOURCE * resource() const { return mResource; };
00063 
00064 private:
00065     RESOURCE *mResource;
00066 };
00067 
00068 typedef vector<TaskTimeBlock> TaskTimeBlockList;
00069 typedef TaskTimeBlockList::const_iterator TaskTimeBlockIterator;
00070 
00071 
00072 class ResourceTimeBlock : public TimeBlock
00073 {
00074 public:
00075     ResourceTimeBlock(TASK *r, int start, int finish, Type type);
00076     ~ResourceTimeBlock() {};
00077     TASK * task() const { return mTask; };
00078 
00079 private:
00080     TASK *mTask;
00081 };
00082 
00083 typedef vector<ResourceTimeBlock> ResourceTimeBlockList;
00084 typedef ResourceTimeBlockList::const_iterator ResourceTimeBlockIterator;
00085 
00086 
00087 #endif

Generated on Wed Feb 18 22:23:54 2004 for Opensched by doxygen1.2.15