-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplayhistory.cpp
More file actions
48 lines (42 loc) · 1.05 KB
/
displayhistory.cpp
File metadata and controls
48 lines (42 loc) · 1.05 KB
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
/*
* displayhistory.cpp
*
* @authors Juan Arias & Nick Tibbott
*
* Implementations for DisplayHistory & DisplayHistoryFactory
*
*/
#include "store.h"
#include "displayhistory.h"
/*
* Constructs a DisplayHistory object with a given Store and customer ID
*/
DisplayHistory::DisplayHistory(Store* store, const string& fileName,
long customerID)
:Transaction(store, fileName), customerID(customerID) {
}
/*
* Executes the instruction
*/
void DisplayHistory::execute() const {
store->displayHistory(fileName, customerID);
}
/*
* Creates and returns the right Transaction from the vector of string
*/
Transaction* DisplayHistoryFactory::create(Store* store,
const ItemType* itemType, const string& fileName, const string& line) const {
return new DisplayHistory(store, fileName, stol(line.substr(2)));
}
/*
* Default constructor to self register in Transaction class
*/
DisplayHistoryFactory::DisplayHistoryFactory() {
Transaction::registerType('H', this);
}
/*
* Anonymous global for self registering
*/
namespace {
DisplayHistoryFactory historyFactory;
}