Declaration of the Village structure and its supporting functions, Village_Initialize(), Village_Clear(), Village_Load(), Village_AddShop(), and Village_VisitShop(), as used in the Visitor Pattern. More...
#include "Visitor_OrderVisitor.h"
Go to the source code of this file.
Classes | |
struct | Village |
Represents a collection of shops that can be visited. More... | |
Macros | |
#define | __VISITOR_VILLAGE_H__ |
Typedefs | |
typedef struct Village | Village |
Represents a collection of shops that can be visited. | |
Functions | |
void | Village_Initialize (Village *village) |
Initialize the specified Village object. | |
void | Village_Clear (Village *village) |
Clear the specified Village object, releasing any allocated memory associated with the village and its contents. The Village object is left in an newly-initialized state. | |
bool | Village_Load (Village *village) |
Set up the specified Village object with all the shops that can be visited. | |
bool | Village_VisitShop (Village *village, OrderVisitor *visitor) |
Visit all shops in the given Village object to find the ingredients specified in the OrderVisitor object. | |
Declaration of the Village structure and its supporting functions, Village_Initialize(), Village_Clear(), Village_Load(), Village_AddShop(), and Village_VisitShop(), as used in the Visitor Pattern.
Definition in file c/Visitor_Village.h.
#define __VISITOR_VILLAGE_H__ |
Definition at line 10 of file c/Visitor_Village.h.
void Village_Clear | ( | Village * | village | ) |
Clear the specified Village object, releasing any allocated memory associated with the village and its contents. The Village object is left in an newly-initialized state.
village | The Village object to clear. |
Definition at line 72 of file Visitor_Village.c.
References Shop_Destroy(), Village::shops, Village::shops_count, and Village_Initialize().
Referenced by Visitor_Exercise().
void Village_Initialize | ( | Village * | village | ) |
Initialize the specified Village object.
village | The Village object to initialize. |
Definition at line 59 of file Visitor_Village.c.
References Village::Name, Village::shops, and Village::shops_count.
Referenced by Village_Clear(), and Visitor_Exercise().
bool Village_Load | ( | Village * | village | ) |
Set up the specified Village object with all the shops that can be visited.
village | The Village object to load. |
Definition at line 88 of file Visitor_Village.c.
References Visitor_Shop::IngredientsForItems, MapOfStrings_AddArray(), Village::Name, Shop_Create(), Shop_Destroy(), and Village_AddShop().
Referenced by Visitor_Exercise().
bool Village_VisitShop | ( | Village * | village, |
OrderVisitor * | visitor | ||
) |
Visit all shops in the given Village object to find the ingredients specified in the OrderVisitor object.
village | The Village object whose shops are to be visited. |
visitor | The OrderVisitor object describing what is being ordered. |
Definition at line 338 of file Visitor_Village.c.
References OrderVisitor_VisitShop(), Village::shops, and Village::shops_count.
Referenced by Shop_PlaceOrder(), and Visitor_Exercise().