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

Represent a maker (of things). More...

#include <Visitor_Element_Classes.h>

Inheritance diagram for Visitor_Maker:
Inheritance graph
Collaboration diagram for Visitor_Maker:
Collaboration graph

Private Member Functions

void Accept (Visitor *visitor)
 Handle visitors to this class.
 

Additional Inherited Members

- Public Types inherited from Visitor_Shop
using unique_ptr_t = std::unique_ptr< Visitor_Shop >
 Alias to make it easier to refer to a unique instance of this class.
 
- Public Member Functions inherited from Visitor_Shop
 Visitor_Shop ()
 Default Constructor.
 
virtual ~Visitor_Shop ()
 Virtual destructor.
 
std::string Name ()
 Name of the shop.
 
void SetName (std::string name)
 
std::string Address ()
 Address of the shop (could be a structure but a simple string is sufficient for this example).
 
void SetAddress (std::string address)
 
Visitor_VillageVillage ()
 The Village that contains this shop.
 
void SetVillage (Visitor_Village *v)
 
const MapOfStringsIngredientsForItems ()
 Specifies the ingredients needed for each item sold by the shop. Also, the keys are what the shop sells. The ingredient list could be empty if this shop is the origin of the item used as the key.
 
void SetIngredientsForItems (const MapOfStrings &ingredients)
 
bool DoesShopSellItem (std::string item)
 Determine if this shop sells the specified item.
 
bool IsItemInStock (std::string item)
 Determine if this shop has the specified item in stock.
 
void AddItemToInventory (std::string item)
 Add the specified item to this shop's inventory.
 
std::string StringizeList (StringList items)
 Convert a string list to a comma-delimited string. Useful for displaying the list.
 
bool PlaceOrder (StringList items)
 Place an order for the specified items. If the inventory is empty, replenish the inventory by visiting other shops for the missing ingredients.
 
void PickupOrder (StringList items, StringList &itemsToBePickedUp)
 Pick up the items sold by this shop (assumes the items were ordered already). Basically, this reduces the inventory for the given items that are sold by this shop.
 
virtual void Accept (Visitor *visitor)=0
 The visitor will call this method on each element it wants to visit.
 
- Public Attributes inherited from Visitor_Shop
std::map< std::string, int > Inventory
 Inventory for this shop.
 

Detailed Description

Represent a maker (of things).

Definition at line 231 of file Visitor_Element_Classes.h.

Member Function Documentation

◆ Accept()

void Accept ( Visitor visitor)
inlineprivatevirtual

Handle visitors to this class.

Parameters
visitorThe visitor

Implements Visitor_Shop.

Definition at line 237 of file Visitor_Element_Classes.h.

References Visitor::VisitMaker().


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