95 lines
2.0 KiB
C++
95 lines
2.0 KiB
C++
/*
|
|
* File: DataStore.cpp
|
|
* Description: Central Storage for all the System Data.
|
|
* Author: Trenser
|
|
* Created: 01-04-2026
|
|
*/
|
|
|
|
#include "DataStore.h"
|
|
|
|
/*
|
|
* Function: getInstance
|
|
* Description: provides a singleton instance of the DataStore.
|
|
* Parameters:
|
|
* None
|
|
* Returns:
|
|
* DataStore& - reference to the single DataStore object.
|
|
*/
|
|
|
|
DataStore& DataStore::getInstance()
|
|
{
|
|
static DataStore dataStore;
|
|
return dataStore;
|
|
}
|
|
|
|
/*
|
|
* Function: getLogs
|
|
* Description: retrieves the log map containing system logs.
|
|
* Parameters:
|
|
* None
|
|
* Returns:
|
|
* logMap& - reference to the log map.
|
|
*/
|
|
|
|
logMap& DataStore::getLogs()
|
|
{
|
|
return m_logs;
|
|
}
|
|
|
|
/*
|
|
* Function: getAuthenticatedEmployee
|
|
* Description: returns the currently authenticated employee.
|
|
* Parameters:
|
|
* None
|
|
* Returns:
|
|
* std::shared_ptr<Employee>& - reference to the authenticated employee object.
|
|
*/
|
|
|
|
std::shared_ptr<Employee>& DataStore::getAuthenticatedEmployee()
|
|
{
|
|
return m_authenticatedEmployee;
|
|
}
|
|
|
|
/*
|
|
* Function: setAuthenticatedEmployee
|
|
* Description: sets the currently authenticated employee.
|
|
* Parameters:
|
|
* authenticatedEmployee - shared pointer to the employee object to be set as authenticated.
|
|
* Returns:
|
|
* void - no return value.
|
|
*/
|
|
|
|
void DataStore::setAuthenticatedEmployee(std::shared_ptr<Employee> authenticatedEmployee)
|
|
{
|
|
m_authenticatedEmployee = authenticatedEmployee;
|
|
}
|
|
|
|
/*
|
|
* Function: getEmployees
|
|
* Description: retrieves the employee map containing all employees.
|
|
* Parameters:
|
|
* None
|
|
* Returns:
|
|
* employeeMap& - reference to the employee map.
|
|
*/
|
|
|
|
employeeMap& DataStore::getEmployees()
|
|
{
|
|
return m_employees;
|
|
}
|
|
|
|
/*
|
|
* Function: getAuthenticatedUser
|
|
* Description: alias for getAuthenticatedEmployee, returns the currently authenticated employee.
|
|
* Parameters:
|
|
* None
|
|
* Returns:
|
|
* std::shared_ptr<Employee>& - reference to the authenticated employee object.
|
|
*/
|
|
|
|
std::shared_ptr<Employee>& DataStore::getAuthenticatedUser()
|
|
{
|
|
return m_authenticatedEmployee;
|
|
}
|
|
|