129 lines
2.9 KiB
C++
129 lines
2.9 KiB
C++
/*
|
|
File: DataStore.cpp
|
|
Description: Implements the DataStore class which provides a centralized singleton repository
|
|
for managing system data in the Vehicle Service Management System.
|
|
Includes accessors for users, services, combo packages, service bookings,
|
|
job cards, inventory items, invoices, and payments.
|
|
Author: Trenser
|
|
Date: 19-May-2026
|
|
*/
|
|
|
|
#include "DataStore.h"
|
|
|
|
/*
|
|
Function: getInstance
|
|
Description: Provides a singleton instance of the DataStore class.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to the single DataStore instance.
|
|
*/
|
|
DataStore& DataStore::getInstance()
|
|
{
|
|
static DataStore dataStore;
|
|
return dataStore;
|
|
}
|
|
|
|
/*
|
|
Function: getUsers
|
|
Description: Retrieves the internal map of users.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, User*> containing all users.
|
|
*/
|
|
util::Map<std::string, User*>& DataStore::getUsers()
|
|
{
|
|
return m_users;
|
|
}
|
|
|
|
/*
|
|
Function: getServices
|
|
Description: Retrieves the internal map of services.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, Service*> containing all services.
|
|
*/
|
|
util::Map<std::string, Service*>& DataStore::getServices()
|
|
{
|
|
return m_services;
|
|
}
|
|
|
|
/*
|
|
Function: getComboPackages
|
|
Description: Retrieves the internal map of combo packages.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, ComboPackage*> containing all combo packages.
|
|
*/
|
|
util::Map<std::string, ComboPackage*>& DataStore::getComboPackages()
|
|
{
|
|
return m_comboPackages;
|
|
}
|
|
|
|
/*
|
|
Function: getServiceBookings
|
|
Description: Retrieves the internal map of service bookings.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, ServiceBooking*> containing all service bookings.
|
|
*/
|
|
util::Map<std::string, ServiceBooking*>& DataStore::getServiceBookings()
|
|
{
|
|
return m_serviceBookings;
|
|
}
|
|
|
|
/*
|
|
Function: getJobCards
|
|
Description: Retrieves the internal map of job cards.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, JobCard*> containing all job cards.
|
|
*/
|
|
util::Map<std::string, JobCard*>& DataStore::getJobCards()
|
|
{
|
|
return m_jobCards;
|
|
}
|
|
|
|
/*
|
|
Function: getInventoryItems
|
|
Description: Retrieves the internal map of inventory items.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, InventoryItem*> containing all inventory items.
|
|
*/
|
|
util::Map<std::string, InventoryItem*>& DataStore::getInventoryItems()
|
|
{
|
|
return m_inventoryItems;
|
|
}
|
|
|
|
/*
|
|
Function: getInvoices
|
|
Description: Retrieves the internal map of invoices.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, Invoice*> containing all invoices.
|
|
*/
|
|
util::Map<std::string, Invoice*>& DataStore::getInvoices()
|
|
{
|
|
return m_invoices;
|
|
}
|
|
|
|
/*
|
|
Function: getPayments
|
|
Description: Retrieves the internal map of payments.
|
|
Parameters:
|
|
- None
|
|
Returns:
|
|
- Reference to util::Map<std::string, Payment*> containing all payments.
|
|
*/
|
|
util::Map<std::string, Payment*>& DataStore::getPayments()
|
|
{
|
|
return m_payments;
|
|
} |