// This file defines the data structures for the class "reservations", which // manages a linked list of reservation names and times. The list will be // sorted by time, with the earliest reservations first. No overlap of time // will be permitted for adjacent reservations. #ifndef RESERVATIONS_H #define RESERVATIONS_H #define RES_EARLIER 1 // new reservation earlier than existing one #define RES_CONFLICT 2 // new reservation conflicts with existing #define RES_LATER 3 // new reservation later than existing one struct res_element { time_slot res_data; // one reservation res_element *next; // next reservation in linked list }; class reservations { private: res_element *head; // points at first reservation in linked list int count; // the number of reservations public: reservations(); ~reservations(); int add(const time_slot_info info); time_slot_info *get_all(int &count); int remove(const int slot_unique_id); }; res_element *find_insert_point(res_element *head, const time_t start_time, const time_t finish_time, int &outcome); int compare_times(const time_t new_start_time, const time_t new_finish_time, const time_t existing_start_time, const time_t existing_finish_time); #endif