-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorder.h
50 lines (38 loc) · 1.07 KB
/
order.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
#ifndef _ORDER_H
#define _ORDER_H
#include "serving.h"
#include "customer.h"
#include "server.h"
#include <vector>
#include <iostream>
#include <fstream>
namespace Mice {
enum class Order_state {Unfilled, Filled, Paid, Canceled};
enum class Order_event {Fill, Pay, Cancel};
class Order {
public:
Order(Customer customer, int order_number);
Order(std::istream& ist);
void save(std::ostream& ost);
void add_serving(Serving serving);
std::vector<Serving> servings() const;
void fill(Server server);
void pay();
void cancel();
int id() const;
double cost() const;
double price() const; // for customer
Order_state state() const;
void process_event(Order_event event, Server server = Server{"TBD", "TBD", "TBD", 0});
// Output for an order's _servings
std::string order_to_string();
private:
int _id;
Customer _customer{"", "", ""};
Server _server{"TBD", "TBD", "TBD", 0};
Order_state _state;
std::vector<Serving> _servings;
};
}
std::ostream& operator<<(std::ostream& os, const Mice::Order& order);
#endif