-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomerContainer.h
57 lines (42 loc) · 1.27 KB
/
customerContainer.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
/**
* CustomerContainer.h
* CustomerContainer class holds a list of customert in CustomMap(hashTable)
*
* @author Olga Kuriatnyk
*/
#ifndef CUSTOMERCONTAINER_H
#define CUSTOMERCONTAINER_H
#include "customMap.h"
using namespace std;
class CustomerContainer {
public:
// get instance of this class
static CustomerContainer &getInstance() {
static CustomerContainer instance;
return instance;
}
// constructor
CustomerContainer() = default;
// destructor
~CustomerContainer() = default;
// copy constructor not allowed
CustomerContainer(const CustomerContainer &c) = delete;
// move not allowed
CustomerContainer(CustomerContainer &&other) = delete;
// assignment not allowed
CustomerContainer &operator=(const CustomerContainer &other) = delete;
// move assignment not allowed
CustomerContainer &operator=(CustomerContainer &&other) = delete;
// insert new Customer to the list of customers
void insert(Customer *customer);
// @return true if id is not used for another customer
// and it's 4 digits
bool validID(int id);
// retrieve customer from the list
// @return pointer to a customer, or nullptr if not found
Customer *retrieve(int id);
private:
static CustomerContainer *instance;
CustomMap customersList;
};
#endif