Change shared pointers to raw pointers in model classes

This commit is contained in:
Princy Jerin
2026-04-16 18:08:56 +05:30
parent c7b9d7bcd5
commit 703cea447e
30 changed files with 15 additions and 38 deletions
+2 -3
View File
@@ -4,7 +4,6 @@
* Author: Trenser
* Created: 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -16,7 +15,7 @@ public:
const std::string& name,
const std::string& phone,
const std::string& email,
std::shared_ptr<Payroll> payroll
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::ADMIN, payroll) {};
Admin(const std::string& id,
const std::string& name,
@@ -36,4 +35,4 @@ public:
Enums::EmployeeType::ADMIN,
accountStatus) {}
~Admin() = default;
};
};
@@ -189,7 +189,7 @@ std::string Employee::serialize() const
return serializedEmployee.str();
}
std::shared_ptr<Employee> Employee::deserialize(const std::string& record)
Employee* Employee::deserialize(const std::string& record)
{
std::string id, name, phone, password, email;
std::string teamId, teamStatusString, accountStatusString, employeeTypeString;
@@ -94,7 +94,7 @@ public:
void addLeave(Leave* leave);
Enums::EmployeeType getEmployeeType() const;
virtual std::string serialize() const;
static std::shared_ptr<Employee> deserialize(const std::string&);
static Employee* deserialize(const std::string&);
static std::string getHeaders();
virtual ~Employee() = default;
};
@@ -15,7 +15,7 @@ public:
const std::string& name,
const std::string& phone,
const std::string& email,
std::shared_ptr<Payroll> payroll
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::FINANCE, payroll) {};
FinanceExecutive(const std::string& id,
const std::string& name,
@@ -34,7 +34,7 @@ std::string GeneralEmployee::serialize() const
return serializedEmployee.str();
}
std::shared_ptr<GeneralEmployee> GeneralEmployee::deserialize(const std::string& record)
GeneralEmployee* GeneralEmployee::deserialize(const std::string& record)
{
std::string id, name, phone, password, email;
std::string teamId, teamStatusString, accountStatusString, employeeTypeString, employeeDesignationString;
@@ -48,7 +48,7 @@ public:
Enums::EmployeeDesignation getDesignation() const;
void setDesignation(Enums::EmployeeDesignation designation);
std::string serialize() const override;
static std::shared_ptr<GeneralEmployee> deserialize(const std::string&);
static GeneralEmployee* deserialize(const std::string&);
static std::string getHeaders();
~GeneralEmployee() = default;
};
@@ -15,7 +15,7 @@ public:
const std::string& name,
const std::string& phone,
const std::string& email,
std::shared_ptr<Payroll> payroll
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::HR, payroll) {};
HRManager(const std::string& id,
const std::string& name,
@@ -15,7 +15,7 @@ public:
const std::string& name,
const std::string& phone,
const std::string& email,
std::shared_ptr<Payroll> payroll
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::IT, payroll) {};
ITExecutive(const std::string& id,
const std::string& name,
@@ -4,7 +4,6 @@ File: JobListing.cpp
* Author : Trenser
* Created : 01-Apr-2026
*/
#include "JobListing.h"
int JobListing::m_uid = 0;
@@ -4,7 +4,6 @@ File: JobListing.h
* Author : Trenser
* Created : 01-Apr-2026
*/
#pragma once
#include <string>
#include <map>
@@ -4,7 +4,6 @@ File: Leave.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Leave.h"
int Leave::m_uid = 0;
@@ -4,7 +4,6 @@ File: Leave.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -4,7 +4,6 @@ File: Log.cpp
* Author : Trenser
* Created : 01-Apr-2026
*/
#include "Log.h"
//Getters and setters
-1
View File
@@ -4,7 +4,6 @@ File: Log.h
* Author : Trenser
* Created : 01-Apr-2026
*/
#pragma once
#include <string>
#include "Timestamp.h"
@@ -4,7 +4,6 @@ File: Notification.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Notification.h"
int Notification::m_uid = 0;
@@ -4,7 +4,6 @@ File: Notification.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"
@@ -4,7 +4,6 @@ File: Payroll.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Payroll.h"
#include "StringHelper.h"
#include "Factory.h"
@@ -111,7 +110,7 @@ std::string Payroll::serialize() const
return serializedPayroll.str();
}
std::shared_ptr<Payroll> Payroll::deserialize(const std::string& record)
Payroll* Payroll::deserialize(const std::string& record)
{
std::string id, employeeId;
std::string basicSalaryString, houseRentAllowanceString, foodAllowanceString, employeePFString, employerPFString;
+1 -2
View File
@@ -4,7 +4,6 @@ File: Payroll.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include <memory>
@@ -62,6 +61,6 @@ public:
void setEmployeePFContribution(double);
void setEmployerPFContribution(double);
std::string serialize() const;
static std::shared_ptr<Payroll> deserialize(const std::string&);
static Payroll* deserialize(const std::string&);
static std::string getHeaders();
};
@@ -4,7 +4,6 @@ File: Payslip.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include <sstream>
#include "Payslip.h"
#include "StringHelper.h"
@@ -68,7 +67,7 @@ std::string Payslip::serialize() const
return serializedPayslip.str();
}
std::shared_ptr<Payslip> Payslip::deserialize(const std::string& record)
Payslip* Payslip::deserialize(const std::string& record)
{
std::string id, employeeId, timestampString;
std::string salaryString;
+1 -2
View File
@@ -4,7 +4,6 @@ File: Payslip.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <memory>
#include <string>
@@ -32,6 +31,6 @@ public:
const util::Timestamp& getTimestamp() const;
const std::string& getEmployeeId() const;
std::string serialize() const;
static std::shared_ptr<Payslip> deserialize(const std::string&);
static Payslip* deserialize(const std::string&);
static std::string getHeaders();
};
@@ -4,7 +4,6 @@ File: Room.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Room.h"
int Room::m_uid = 0;
@@ -4,7 +4,6 @@ File: Room.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include <map>
@@ -4,5 +4,4 @@ File: TalentExecutive.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "TalentExecutive.h"
@@ -4,7 +4,6 @@ File: TalentExecutive.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -16,7 +15,7 @@ public:
const std::string& name,
const std::string& phone,
const std::string& email,
std::shared_ptr<Payroll> payroll
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::TALENT_ACQUISITION, payroll) {};
TalentExecutive(const std::string& id,
const std::string& name,
@@ -4,7 +4,6 @@ File: Team.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Team.h"
int Team::m_uid = 0;
@@ -4,7 +4,6 @@ File: Team.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include <map>
@@ -4,5 +4,4 @@ File: TeamExecutive.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "TeamExecutive.h"
@@ -4,7 +4,6 @@ File: TeamExecutive.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include "Employee.h"
@@ -16,7 +15,7 @@ public:
const std::string& name,
const std::string& phone,
const std::string& email,
std::shared_ptr<Payroll> payroll
Payroll* payroll
) :Employee(name, phone, email, Enums::EmployeeType::TEAM, payroll) {};
TeamExecutive(const std::string& id,
const std::string& name,
@@ -4,7 +4,6 @@ File: Ticket.cpp
* Author : Trenser
* Created : 31-Mar-2026
*/
#include "Ticket.h"
int Ticket::m_uid = 0;
@@ -4,7 +4,6 @@ File: Ticket.h
* Author : Trenser
* Created : 31-Mar-2026
*/
#pragma once
#include <string>
#include "Enums.h"