Gator Library
An implementation of the Red-Black Tree and Priority queue data structure in C++.
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | List of all members
book Class Reference

Represents a book in the library. More...

#include <book.hpp>

Collaboration diagram for book:
Collaboration graph

Public Member Functions

void AddReservation (reservation newReservation)
 Adds a new reservation for the book.
 
void DeleteReservation (int patronID)
 Deletes a reservation for the book.
 
void PrintBook ()
 Prints the details of the book.
 
 book (int id, string name, string author, string availabilityStatus)
 Constructs a book object with the given parameters.
 
 book (int id, string name, string author, BookAvailability available)
 Constructs a book object with the given parameters.
 
 ~book ()
 Destructs the book object.
 

Public Attributes

int BookId
 
string BookName
 
string AuthorName
 
BookAvailability AvailabilityStatus
 
int BorrowedBy
 
pq_reservation ReservationHeap
 

Private Member Functions

void printReservations ()
 Prints the reservations for the book.
 

Detailed Description

Represents a book in the library.

This class provides functionality to manage reservations, borrowings, and information about a book. It contains member variables to store the book's ID, name, author, availability status, and borrower. The class also includes a priority queue for managing reservations.

See also
reservation pq_reservation

Constructor & Destructor Documentation

◆ book() [1/2]

book::book ( int  id,
string  name,
string  author,
string  availabilityStatus 
)

Constructs a book object with the given parameters.

Parameters
idThe ID of the book.
nameThe name of the book.
authorThe name of the author of the book.
availabilityStatusThe availability status of the book as a string.

◆ book() [2/2]

book::book ( int  id,
string  name,
string  author,
BookAvailability  available 
)

Constructs a book object with the given parameters.

Parameters
idThe ID of the book.
nameThe name of the book.
authorThe name of the author of the book.
availableThe availability status of the book as an enum value.

◆ ~book()

book::~book ( )

Destructs the book object.

Member Function Documentation

◆ AddReservation()

void book::AddReservation ( reservation  newReservation)

Adds a new reservation for the book.

Parameters
newReservationThe reservation to be added.
See also
reservation

Add the reservation to the reservation heap. Reservation heap is a min heap based on priority number and time of reservation.

Here is the call graph for this function:

◆ DeleteReservation()

void book::DeleteReservation ( int  patronID)

Deletes a reservation for the book.

Parameters
patronIDThe ID of the patron whose reservation needs to be deleted.

◆ PrintBook()

void book::PrintBook ( )

Prints the details of the book.

Here is the call graph for this function:

◆ printReservations()

void book::printReservations ( )
private

Prints the reservations for the book.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ AuthorName

string book::AuthorName

The name of the author of the book.

◆ AvailabilityStatus

BookAvailability book::AvailabilityStatus

The availability status of the book.

◆ BookId

int book::BookId

The ID of the book.

◆ BookName

string book::BookName

The name of the book.

◆ BorrowedBy

int book::BorrowedBy

The ID of the patron who borrowed the book.

◆ ReservationHeap

pq_reservation book::ReservationHeap

The priority queue for managing reservations.


The documentation for this class was generated from the following files: