00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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