C++ features by examples

Architectural patterns More...

Collaboration diagram for Architectural:

Modules

 Publish–subscribe pattern
 Publish–subscribe pattern
 

Classes

struct  Model
 is part of MVC with View and Controller More...
 
struct  View
 is concrete Observer More...
 
struct  Controller
 is part of MVC with Model and View More...
 

Functions

void architectural_patterns_demo ()
 

Detailed Description

Architectural patterns

https://refactoring.guru/design-patterns/behavioral-patterns

Function Documentation

◆ architectural_patterns_demo()

void architectural_patterns_demo ( )

Definition at line 698 of file patterns.cpp.

699{
700 Model mod;
701 View view(mod);
702 mod.register_observer(view);
703 mod.notify_observers();
704 Controller ctrl(mod);
705 ctrl.command(Command());
706 Command cmnd;
707 ctrl.command(cmnd);
708
709 Subscriber sub;
710 Publisher pub;
711 pub.topic_subscribers["sample_topic"].push_front(sub);
712 Message m;
713 pub.publish("sample_topic", m);
714}
encapsulates arguments. AKA Intent, operation.
Definition: patterns.cpp:423
is part of MVC with Model and View
Definition: patterns.cpp:661
is part of MVC with View and Controller
Definition: patterns.cpp:625
void register_observer(Observer &o)
Definition: patterns.cpp:626
map< string, forward_list< reference_wrapper< Subscriber > > > topic_subscribers
Definition: patterns.cpp:689
void publish(const string &topic, Message &m)
Definition: patterns.cpp:691
void notify_observers()
Definition: patterns.cpp:407
is concrete Observer
Definition: patterns.cpp:646
Here is the call graph for this function:
Here is the caller graph for this function: