-
Notifications
You must be signed in to change notification settings - Fork 0
/
System.h
59 lines (51 loc) · 1.93 KB
/
System.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include <iostream>
#include <fstream>
#include "Bank/h/Bank.h"
#include "Helpers/Vector.hpp"
#include "Bank/h/Check.h"
class System
{
private:
Vector<Polymorphic_Ptr<User>> usersContainer;
Vector<Bank> banks_container;
User* currentUser = nullptr;
Vector<Check> checks;
System() = default;
public:
//static System& getInstance(std::ifstream& ifs, Vector<Polymorphic_Ptr<User>>&& users, User*&& curr) {
// static System system;
// system.usersContainer = users;
// system.currentUser = curr;
// ifs >> system.banks_container;
// return system;
//}
static System& getInstance() {
static System system;
return system;
}
void create_bank(const MyString& nameOfTheBank);
unsigned check_avl(const MyString& bank_name, unsigned int account_number)const;
int returnTheIndexOfTheBankWithThatName(const MyString& name)const;
int returnTheIndexOfCurrentUserInABank(int indOfBank)const;
Bank& getBankOnIndex(unsigned ind);
User* getCurrentUser();
Bank& getBankWhereEmployeeIsWorking(const Employee* e);
void addCheck(Check&& check);
int returnIndexOfCheck(const Check& check)const;
void theCheckHasBeenUsed(const Check& check);
bool someoneIsLogedIn()const;
void listAllAccountAClientHas(const Client* client)const;
void addUser(User*&& user);
unsigned getCountOfBanks()const;
void setCurrentUser(User* user);
void openAccount(Client* client, unsigned ind);
void closeAccount(Client* client, unsigned accountNumber, unsigned ind);
void changeAccount(Client* client, const MyString& oldBank, unsigned accountNumber, unsigned ind);
void sendCheckToClient(double sum, const MyString code, unsigned Id);
void useCheck(const MyString bank_name, unsigned accountNumber, const MyString code);
void whoami()const;
void exit();
//friend std::istream& operator>>(std::istream& ifs, System system);
//friend std::ostream& operator<<(std::ostream& ofs, const System system);
};