Class to represent a reservation. More...
#include <reservation.h>
Public Member Functions | |
const Task * | task () const |
const Resource * | resource () const |
const QDateTime & | time () const |
const Duration & | duration () const |
QDateTime | endTime () const |
bool | overlapsWith (const Reservation *, const Duration &duration) const |
bool | isActive () const |
Private Member Functions | |
Reservation (Task *task, Resource *resource, const QDateTime &time, const Duration &duration) | |
Creates new reservation with the given properties. | |
~Reservation () | |
Reservation (const Reservation &other) | |
Reservation & | operator= (const Reservation &other) |
Private Attributes | |
ReservationPrivate *const | d |
Friends | |
class | TaskManagerData |
Class to represent a reservation.
A reservation is made between a Task and a Resource. This class provides the means to make and use such a reservation.
Constructors and destructor are private, creating and deleting reservations is handled by TaskManagerData.
Definition at line 27 of file reservation.h.
domain::Reservation::Reservation | ( | Task * | task, | |
Resource * | resource, | |||
const QDateTime & | time, | |||
const Duration & | duration | |||
) | [private] |
Creates new reservation with the given properties.
task | The task this reservation is for | |
resource | The resource for the reservation | |
time | The starting time for the reservation | |
duration | The schedule for which the reservation will last |
InvalidDataException | If the resource already has a reservation for the specified time. | |
StringException | If it is impossible to create the links with the given task or resource. |
Definition at line 20 of file reservation.cpp.
domain::Reservation::~Reservation | ( | ) | [private] |
Destructor for the reservation
Definition at line 50 of file reservation.cpp.
const domain::Duration & domain::Reservation::duration | ( | ) | const |
Returns the duration for which the reservation is made.
Definition at line 72 of file reservation.cpp.
QDateTime domain::Reservation::endTime | ( | ) | const |
Returns the end time of this reservation.
Definition at line 77 of file reservation.cpp.
bool domain::Reservation::isActive | ( | ) | const |
Indicates whether this reservation is "active". A reservation is active when Clock::currentTime() is between time() and endTime().
Definition at line 101 of file reservation.cpp.
bool domain::Reservation::overlapsWith | ( | const Reservation * | res, | |
const Duration & | duration | |||
) | const |
Indicates whether the given reservation overlaps with this reservation for at least the given duration.
Definition at line 83 of file reservation.cpp.
const Resource * domain::Reservation::resource | ( | ) | const |
Returns the resource for which this reservation is made.
Definition at line 62 of file reservation.cpp.
const Task * domain::Reservation::task | ( | ) | const |
Returns the task this reservation is for.
Definition at line 57 of file reservation.cpp.
const QDateTime & domain::Reservation::time | ( | ) | const |
Returns the starting time of this reservation.
Definition at line 67 of file reservation.cpp.