Declaration of the OrderVisitor structure and its supporting functions, OrderVisitor_Initialize(), OrderVisitor_Clear(), and OrderVisitor_VisitShop(), as used in the Visitor Pattern. More...
#include "Visitor_Shop.h"
Go to the source code of this file.
Classes | |
struct | OrderVisitor |
Represents a visitor used for ordering items from various shops. The user starts with an instance of this class and a list of what they want to order. More... | |
Macros | |
#define | __VISITOR_ORDERVISITOR_H__ |
Typedefs | |
typedef struct OrderVisitor | OrderVisitor |
Represents a visitor used for ordering items from various shops. The user starts with an instance of this class and a list of what they want to order. | |
Functions | |
void | OrderVisitor_Initialize (OrderVisitor *visitor) |
Initialize the specified OrderVisitor object. | |
void | OrderVisitor_Clear (OrderVisitor *visitor) |
Clear the specified OrderVisitor object, freeing up any memory that it was using. The resulting object is initialized as if brand new. | |
bool | OrderVisitor_VisitShop (OrderVisitor *order, Visitor_Shop *shop) |
Represents a visit to the specified Visitor_Shop with the specified order. | |
Declaration of the OrderVisitor structure and its supporting functions, OrderVisitor_Initialize(), OrderVisitor_Clear(), and OrderVisitor_VisitShop(), as used in the Visitor Pattern.
Definition in file Visitor_OrderVisitor.h.
#define __VISITOR_ORDERVISITOR_H__ |
Definition at line 9 of file Visitor_OrderVisitor.h.
typedef struct OrderVisitor OrderVisitor |
Represents a visitor used for ordering items from various shops. The user starts with an instance of this class and a list of what they want to order.
Later, a shop will used this visitor to order ingredients to make a requested item.
void OrderVisitor_Clear | ( | OrderVisitor * | visitor | ) |
Clear the specified OrderVisitor object, freeing up any memory that it was using. The resulting object is initialized as if brand new.
visitor | The OrderVisitor object to clear. |
Definition at line 25 of file Visitor_OrderVisitor.c.
References ConstStringList_Clear(), OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, and OrderVisitor_Initialize().
Referenced by Shop_PlaceOrder(), and Visitor_Exercise().
void OrderVisitor_Initialize | ( | OrderVisitor * | visitor | ) |
Initialize the specified OrderVisitor object.
Alternatively, declare the OrderVisitor instance like this:
visitor | The OrderVisitor object to initialize. |
Definition at line 12 of file Visitor_OrderVisitor.c.
References ConstStringList_Initialize(), OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, and OrderVisitor::ShopNameReceivedFrom.
Referenced by OrderVisitor_Clear(), and Visitor_Exercise().
bool OrderVisitor_VisitShop | ( | OrderVisitor * | order, |
Visitor_Shop * | shop | ||
) |
Represents a visit to the specified Visitor_Shop with the specified order.
order | The OrderVisitor object representing what is being ordered from the shop. |
shop | The Visitor_Shop that is being visited and, if it carries the ingredients, receives the order. Otherwise, the shop ignores the visit. |
Definition at line 38 of file Visitor_OrderVisitor.c.
References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name, PlaceOrderResponse_OrderAccepted, Shop_PickupOrder(), Shop_PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.
Referenced by Village_VisitShop().