// CMSC 341 - Spring 2024 - Project 4 #include "vacdb.h" VacDB::VacDB(int size, hash_fn hash, prob_t probing = DEFPOLCY){ } VacDB::~VacDB(){ } void VacDB::changeProbPolicy(prob_t policy){ } bool VacDB::insert(Patient patient){ } bool VacDB::remove(Patient patient){ } const Patient VacDB::getPatient(string name, int serial) const{ } bool VacDB::updateSerialNumber(Patient patient, int serial){ } float VacDB::lambda() const { } float VacDB::deletedRatio() const { } void VacDB::dump() const { cout << "Dump for the current table: " << endl; if (m_currentTable != nullptr) for (int i = 0; i < m_currentCap; i++) { cout << "[" << i << "] : " << m_currentTable[i] << endl; } cout << "Dump for the old table: " << endl; if (m_oldTable != nullptr) for (int i = 0; i < m_oldCap; i++) { cout << "[" << i << "] : " << m_oldTable[i] << endl; } } bool VacDB::isPrime(int number){ bool result = true; for (int i = 2; i <= number / 2; ++i) { if (number % i == 0) { result = false; break; } } return result; } int VacDB::findNextPrime(int current){ //we always stay within the range [MINPRIME-MAXPRIME] //the smallest prime starts at MINPRIME if (current < MINPRIME) current = MINPRIME-1; for (int i=current; i sqrt(i) && i != current) { return i; } } } //if a user tries to go over MAXPRIME return MAXPRIME; } ostream& operator<<(ostream& sout, const Patient* patient ) { if ((patient != nullptr) && !(patient->getKey().empty())) sout << patient->getKey() << " (" << patient->getSerial() << ", "<< patient->getUsed() << ")"; else sout << ""; return sout; } bool operator==(const Patient& lhs, const Patient& rhs){ // since the uniqueness of an object is defined by name and serial number // the equality operator considers only those two criteria return ((lhs.getKey() == rhs.getKey()) && (lhs.getSerial() == rhs.getSerial())); } bool Patient::operator==(const Patient* & rhs){ // since the uniqueness of an object is defined by name and serial number // the equality operator considers only those two criteria return ((getKey() == rhs->getKey()) && (getSerial() == rhs->getSerial())); }