Website Summary Files Commits Branches @commit @diff @stats
path: root / Week07 / Exercise01 / LibraryBanking.h
blob: 08e9d9d436d3175ecc2194772fbfe8b11fde2a8c (plain) (blame)
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
#ifndef _LIBRARY_BANKING
#define _LIBRARY_BANKING

#include "BankClerk.h"
#include "Transaction.h"

class LibraryBanking {
	BankClerk* clerks;
	unsigned clerksCount;
	unsigned clerksAlloc;

	Transaction* transactions;
	unsigned transactionsCount;
	unsigned transactionsAlloc;

	void free();
	void copyFrom(const LibraryBanking& other);

	void resizeClerks();
	void resizeTransactions();

public:
	LibraryBanking();
	~LibraryBanking();
	LibraryBanking(const LibraryBanking& other);
	LibraryBanking& operator=(const LibraryBanking& other);
	LibraryBanking(LibraryBanking&& other);
	LibraryBanking& operator=(LibraryBanking&& other);

	void RegisterClerk(const BankClerk& clerk);
	BankClerk* LoginClerk(unsigned clerkNumber, unsigned dynamicPassword, const String& staticPassword);

	void ListPendingTransactions();
	Transaction* GetTransaction(unsigned index);
	const Transaction* RegisterTransaction(const Transaction& transaction);

	void ExportNonPendingTransactions(const String& fileName);
};

#endif /* _LIBRARY_BANKING */