15 Name =
"Village of Self-Sufficiency";
18 shops.push_back(std::make_unique<Visitor_Restaurant>());
20 shop->SetName(
"Joe's Burger Joint");
21 shop->SetAddress(
"47 Millings Rd.");
22 shop->SetVillage(
this);
24 {
"hamburger", {
"ground beef",
"hamburger buns",
"ketchup",
"mustard",
"mayonnaise",
"lettuce",
"tomato",
"onion",
"pickles" } }
29 shops.push_back(std::make_unique<Visitor_Butcher>());
31 shop->SetName(
"Amelia's Butcher Shop");
32 shop->SetAddress(
"12 Klaxon Ave.");
33 shop->SetVillage(
this);
40 shops.push_back(std::make_unique<Visitor_Baker>());
42 shop->SetName(
"Oxel's Breads and Buns Bakery");
43 shop->SetAddress(
"131 Worthington Dr.");
44 shop->SetVillage(
this);
46 {
"hamburger buns", { } }
51 shops.push_back(std::make_unique<Visitor_CondimentGrocer>());
53 shop->SetName(
"Connie's Condiments");
54 shop->SetAddress(
"83 Millings Rd.");
55 shop->SetVillage(
this);
57 {
"ketchup", {
"fresh ketchup" } },
58 {
"mustard", {
"fresh mustard" } },
59 {
"mayonnaise", {
"fresh mayonnaise" } }
64 shops.push_back(std::make_unique<Visitor_VegetableGrocer>());
66 shop->SetName(
"Florence's Vegetables");
67 shop->SetAddress(
"32 Main St.");
68 shop->SetVillage(
this);
74 {
"mustard seed", { } }
79 shops.push_back(std::make_unique<Visitor_PickleGrocer>());
81 shop->SetName(
"Larry's Pickle Emporium");
82 shop->SetAddress(
"34 Main St.");
83 shop->SetVillage(
this);
85 {
"pickles", {
"vinegar",
"cucumber",
"salt" } }
90 shops.push_back(std::make_unique<Visitor_Maker>());
92 shop->SetName(
"Klyde and Sons Ketchup Makers");
93 shop->SetAddress(
"800 Overtown Rd.");
94 shop->SetVillage(
this);
96 {
"fresh ketchup", { } }
101 shops.push_back(std::make_unique<Visitor_Maker>());
103 shop->SetName(
"Molly's Mustard Mart");
104 shop->SetAddress(
"810 Overtown Rd.");
105 shop->SetVillage(
this);
107 {
"fresh mustard", {
"vinegar",
"mustard seed" } }
112 shops.push_back(std::make_unique<Visitor_Maker>());
114 shop->SetName(
"Turk's Mayo Supply");
115 shop->SetAddress(
"820 Overtown Rd.");
116 shop->SetVillage(
this);
118 {
"fresh mayonnaise", { } }
123 shops.push_back(std::make_unique<Visitor_Maker>());
125 shop->SetName(
"Vinnies' Sour Flavors");
126 shop->SetAddress(
"830 Overtown Rd.");
127 shop->SetVillage(
this);
134 shops.push_back(std::make_unique<Visitor_Maker>());
136 shop->SetName(
"Jessie's Salt Works");
137 shop->SetAddress(
"920 Overtown Rd.");
138 shop->SetVillage(
this);
148 for(
auto& shop :
shops)
150 shop->Accept(visitor);
Declaration of the Visitor base class and the various shop classes used in the Visitor Pattern.
std::unique_ptr< Visitor_Shop > unique_ptr_t
Alias to make it easier to refer to a unique instance of this class.
void LoadVillage()
Load the village.
std::vector< Visitor_Shop::unique_ptr_t > shops
List of shops in this village.
void Accept(Visitor *visitor)
std::string Name
Name of this village.
All visitors must implement this base class and then override one or more of the VisitXXX() methods,...
Declaration of the Visitor_Village class used in the Visitor Pattern.
The namespace containing all Design Pattern Examples implemented in C++.
Represents a list of structures that map strings to ConstStringList objects.