00001 #ifndef RESOURCE_H 00002 #define RESOURCE_H 00003 00004 #include "storabledata.h" 00005 #include "task.h" 00006 #include "duration.h" 00007 00008 #include <tools/global.h> 00009 00010 class QString; 00011 00012 namespace domain 00013 { 00014 00015 class ResourceType; 00016 class Reservation; 00017 struct ResourcePrivate; 00018 00030 class DOMAIN_EXPORT Resource : public StorableData 00031 { 00032 Q_OBJECT 00033 00034 friend class Reservation; 00035 friend class TaskManagerData; 00036 00037 public: 00038 00042 const QString& description() const; 00043 00048 QList<StorableData*> dependentData() const; 00049 00053 QList<const Reservation*> reservations() const; 00054 00058 QString resourceTypeName() const; 00059 00063 ResourceType* resourceType() const; 00064 00072 bool alreadyReserved(QDateTime startTime, Duration duration) const; 00073 00074 private: 00075 00083 Resource(ResourceType* type, const QString& description); 00084 00088 Resource(const Resource& other); 00089 00093 virtual ~Resource(); 00094 00095 Resource& operator=(const Resource& other); 00096 00097 void addReservation(Reservation* reservation); 00098 void removeReservation(Reservation* reservation); 00099 00100 ResourcePrivate* const d; 00101 00102 }; 00103 00104 } 00105 00106 #endif