-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReceivedOrder.cpp
46 lines (42 loc) · 1.44 KB
/
ReceivedOrder.cpp
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
/**
* @file ReceivedOrder.h
*/
#include "ReceivedOrder.h"
#include "AwaitingBill.h"
/**
* @brief Handles the behavior of a table that has received and is processing an order.
*
* This function handles the actions that a table in the "Received Order" state should perform, such as receiving an order,
* dining, and simulating a dining period.
*
* @param table The table in the "Received Order" state to be handled.
*/
void ReceivedOrder::handle(Table& table)
{
// table.giveOrder(table.getWaiter().giveOrder()); // Optionally, handle order-related logic here.
std::cout << "Table " << to_string(table.getTableNumber()) << " has received their order..." << std::endl;
std::cout << "Table " << to_string(table.getTableNumber()) << " is dining..." << std::endl;
ThreadSleep::threadSleep(); // Simulate a dining period.
}
/**
* @brief Returns the next state after handling the current state.
*
* This function returns the next state, which is "AwaitingBill," as the table transitions from dining to awaiting the bill.
*
* @return A pointer to the "AwaitingBill" state.
*/
TableState* ReceivedOrder::getNextState()
{
return new AwaitingBill();
}
/**
* @brief Returns a string representation of the "Received Order" state.
*
* This function returns a string that represents the name of the state, which is "Received Order."
*
* @return The string "Received Order."
*/
std::string ReceivedOrder::toString()
{
return "Received Order";
}