00001 #ifndef RESERVATION_H 00002 #define RESERVATION_H 00003 00004 #include "storabledata.h" 00005 #include "duration.h" 00006 00007 #include <tools/global.h> 00008 00009 #include <QDateTime> 00010 00011 namespace domain 00012 { 00013 00014 class Task; 00015 class Resource; 00016 struct ReservationPrivate; 00017 00027 class DOMAIN_EXPORT Reservation : public StorableData 00028 { 00029 Q_OBJECT 00030 00031 friend class TaskManagerData; 00032 00033 public: 00034 00038 const Task* task() const; 00039 00043 const Resource* resource() const; 00044 00048 const QDateTime& time() const; 00049 00053 const Duration& duration() const; 00054 00058 QDateTime endTime() const; 00059 00064 bool overlapsWith(const Reservation*, const Duration& duration) const; 00065 00071 bool isActive() const; 00072 00073 private: 00074 00092 Reservation(Task* task, Resource* resource, const QDateTime& time, 00093 const Duration& duration); 00094 00098 ~Reservation(); 00099 00100 Reservation(const Reservation& other); 00101 Reservation& operator=(const Reservation& other); 00102 00103 ReservationPrivate* const d; 00104 }; 00105 00113 struct ReservationData 00114 { 00115 QDateTime startDate; 00116 Duration duration; 00117 Resource* resource; 00118 }; 00119 00120 } 00121 00122 #endif