C++ features by examples
patterns.cpp File Reference

skeleton C++ examples of OOP and Design patterns More...

#include <bits/stdc++.h>
Include dependency graph for patterns.cpp:

Go to the source code of this file.

Classes

struct  Setter_interface< ValueType >
 
struct  Getter_interface< ValueType >
 
struct  Change_interface< ValueType >
 
class  Synchronised_encapsulated_value< ValueType >
 encapsulating class with only public accessor and mutator intrfaces More...
 
struct  Interface
 is a common pure virtual interface More...
 
struct  Singleton_demo
 
struct  Factory_method_demo
 
struct  Sample_product
 
struct  Sample_factory_method_demo
 
struct  Abstract_factory
 
struct  Sample_factory
 
struct  Prototype
 is the factory of himself More...
 
struct  Builder
 
struct  Standalone
 is wrapped by Bridge. AKA adaptee of Adapter More...
 
struct  Bridge
 is a wrapper using different from Standalone interface. AKA Adapter More...
 
struct  Proxy
 is a opaque wrapper with same as wrapped object Interface More...
 
struct  Decorator
 is a partial wrapper of an object with same as wrapped object Interface More...
 
struct  Composite
 
struct  Observer
 is virtual observer of a Subject More...
 
struct  Subject
 of Observer More...
 
struct  Command
 encapsulates arguments. AKA Intent, operation. More...
 
struct  Component
 accepts a pure virtual Visitor More...
 
struct  Visitor
 is a pure virtual visitor of Sample_component and other specific components More...
 
struct  Sample_component
 one of many components is independed from Sample_visitor and implemenation of function visit. More...
 
struct  Handler
 is a virtual command handler of Chain_of_responsibility More...
 
struct  Chain_of_responsibility
 list based implementation without recursion More...
 
struct  Message
 
struct  Member
 
struct  Mediator
 
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...
 
struct  Subscriber
 
struct  Publisher
 
class  Synchronized_queue< T, Container >
 
struct  Active_object
 Active object More...
 

Macros

#define SINGLETON(Singleton)
 

Functions

void oop_demo ()
 
void creational_patterns_demo ()
 
void structural_patterns_demo ()
 
string client_visit (const forward_list< unique_ptr< Component > > &components, const forward_list< unique_ptr< Visitor > > &visitors)
 knows only virtual visitor and component More...
 
void visitor_demo ()
 
void mediator_demo ()
 
void behavioral_patterns_demo ()
 
void architectural_patterns_demo ()
 
void concurrency_patterns_demo ()
 
int main ()
 

Detailed Description

skeleton C++ examples of OOP and Design patterns

© 2021 Constantine Shulyupin

Patterns help to conform to SOLID principles:

Code style: Using struct because is it like class with default public members and methods. Less is more. Skeleton code with minimal optional code and duplications. Each word "Sample" in an inventers assumes multiple instances like Sample1, Sample2 ... SampleN

Contents

Definition in file patterns.cpp.