-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataRepository.h
34 lines (27 loc) · 923 Bytes
/
DataRepository.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Created by Claudio Delgado on 2024-11-11.
#ifndef DATAREPOSITORY_H
#define DATAREPOSITORY_H
#include <memory>
#include <vector>
#include <string>
#include "Student.h"
#include "Course.h"
class DataRepository {
public:
static DataRepository& getInstance() {
static DataRepository instance;
return instance;
}
void addStudent(const std::shared_ptr<Student>& student);
void addCourse(const std::shared_ptr<Course>& course);
std::shared_ptr<Student> getStudentByRollNumber(const std::string& rollNumber);
std::shared_ptr<Course> getCourseByCode(const std::string& code);
void saveStudentData(const std::shared_ptr<Student>& student);
void saveCourseData(const std::shared_ptr<Course>& course);
private:
DataRepository() = default;
std::vector<std::shared_ptr<Student>> students;
std::vector<std::shared_ptr<Course>> courses;
};
#endif // DATAREPOSITORY_H