Design Pattern Examples
Overview of object-oriented design patterns
OrderVisitor Class Reference

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...

#include <Visitor_Visitor_Class.h>

Inheritance diagram for OrderVisitor:
Inheritance graph
Collaboration diagram for OrderVisitor:
Collaboration graph

Public Member Functions

 OrderVisitor (StringList itemsToOrder)
 Constructor.
 
void VisitBaker (Visitor_Baker *shop) override
 Let the visitor visit a Visitor_Baker shop.
 
void VisitButcher (Visitor_Butcher *shop) override
 Let the visitor visit a Visitor_Butcher shop.
 
void VisitPickleGrocer (Visitor_PickleGrocer *shop) override
 Let the visitor visit a Visitor_PickleGrocer shop.
 
void VisitCondimentGrocer (Visitor_CondimentGrocer *shop) override
 Let the visitor visit a Visitor_CondimentGrocer shop.
 
void VisitVegetableGrocer (Visitor_VegetableGrocer *shop) override
 Let the visitor visit a Visitor_VegetableGrocer shop.
 
void VisitMaker (Visitor_Maker *shop) override
 Let the visitor visit a Visitor_Maker shop.
 
void VisitRestaurant (Visitor_Restaurant *shop) override
 Let the visitor visit a Visitor_Restaurant shop.
 
virtual void VisitRestaurant (Visitor_Restaurant *shop)
 Let the visitor visit a Visitor_Restaurant shop.
 
virtual void VisitButcher (Visitor_Butcher *shop)
 Let the visitor visit a Visitor_Butcher shop.
 
virtual void VisitBaker (Visitor_Baker *shop)
 Let the visitor visit a Visitor_Baker shop.
 
virtual void VisitVegetableGrocer (Visitor_VegetableGrocer *shop)
 Let the visitor visit a Visitor_VegetableGrocer shop.
 
virtual void VisitCondimentGrocer (Visitor_CondimentGrocer *shop)
 Let the visitor visit a Visitor_CondimentGrocer shop.
 
virtual void VisitPickleGrocer (Visitor_PickleGrocer *shop)
 Let the visitor visit a Visitor_PickleGrocer shop.
 
virtual void VisitMaker (Visitor_Maker *shop)
 Let the visitor visit a Visitor_Maker shop.
 

Public Attributes

StringList ItemsReceived
 List of items received from an order/pickup process.
 
std::string ShopNameReceivedFrom
 Name of the shop that provided the item(s).
 

Protected Attributes

StringList ItemsToOrder
 Items to be ordered from any shop that sells the item.
 

Detailed Description

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.

A shop will used this visitor to order ingredients to make a requested item.

Definition at line 24 of file Visitor_Visitor_Class.h.

Constructor & Destructor Documentation

◆ OrderVisitor()

OrderVisitor ( StringList  itemsToOrder)
inline

Constructor.

Parameters
itemsToOrderList of items to order.

Definition at line 47 of file Visitor_Visitor_Class.h.

Member Function Documentation

◆ VisitBaker()

void VisitBaker ( Visitor_Baker shop)
inlineoverridevirtual

Let the visitor visit a Visitor_Baker shop.

Parameters
shopThe specific baker shop being visited.

Reimplemented from Visitor.

Definition at line 52 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

◆ VisitButcher()

void VisitButcher ( Visitor_Butcher shop)
inlineoverridevirtual

Let the visitor visit a Visitor_Butcher shop.

Parameters
shopThe specific butcher shop being visited.

Reimplemented from Visitor.

Definition at line 64 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

◆ VisitCondimentGrocer()

void VisitCondimentGrocer ( Visitor_CondimentGrocer shop)
inlineoverridevirtual

Let the visitor visit a Visitor_CondimentGrocer shop.

Parameters
shopThe specific condiment grocer being visited.

Reimplemented from Visitor.

Definition at line 88 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

◆ VisitMaker()

void VisitMaker ( Visitor_Maker shop)
inlineoverridevirtual

Let the visitor visit a Visitor_Maker shop.

Parameters
shopThe specific maker shop being visited.

Reimplemented from Visitor.

Definition at line 112 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

◆ VisitPickleGrocer()

void VisitPickleGrocer ( Visitor_PickleGrocer shop)
inlineoverridevirtual

Let the visitor visit a Visitor_PickleGrocer shop.

Parameters
shopThe specific pickle grocer being visited.

Reimplemented from Visitor.

Definition at line 76 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

◆ VisitRestaurant()

void VisitRestaurant ( Visitor_Restaurant shop)
inlineoverridevirtual

Let the visitor visit a Visitor_Restaurant shop.

Parameters
shopThe specific restaurant being visited.

Reimplemented from Visitor.

Definition at line 124 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

◆ VisitVegetableGrocer()

void VisitVegetableGrocer ( Visitor_VegetableGrocer shop)
inlineoverridevirtual

Let the visitor visit a Visitor_VegetableGrocer shop.

Parameters
shopThe specific vegetable grocer being visited.

Reimplemented from Visitor.

Definition at line 100 of file Visitor_Visitor_Class.h.

References OrderVisitor::ItemsReceived, OrderVisitor::ItemsToOrder, Visitor_Shop::Name(), Visitor_Shop::PickupOrder(), Visitor_Shop::PlaceOrder(), and OrderVisitor::ShopNameReceivedFrom.

Member Data Documentation

◆ ItemsReceived

◆ ItemsToOrder

◆ ShopNameReceivedFrom


The documentation for this class was generated from the following file: