SVCS - English Documentation
Loading...
Searching...
No Matches
ISubject.hxx
Go to the documentation of this file.
1
19#pragma once
20
21#include "IObserver.hxx"
22#include <memory>
23#include <vector>
24
25
38 * механизм уведомлений, реализацию шаблона Observer и другие сквозные задачи,
39 * которые поддерживают операции СКВ.
40 */
41namespace svcs::services {
42
58class ISubject {
59protected:
67 std::vector<IObserver*> observers;
68
69public:
78
79 virtual ~ISubject() = default;
80
90 virtual void attach(std::shared_ptr<IObserver> observer) = 0;
91
101 virtual void detach(std::shared_ptr<IObserver> observer) = 0;
102
118 virtual void notify(const Event& event) const = 0;
119};
120
121}
Defines the interface for the Observer pattern component.
The Subject (Publisher) Interface (Abstract Base Class).
Definition ISubject.hxx:38
virtual void detach(std::shared_ptr< IObserver > observer)=0
Detaches an observer from the subject.
virtual ~ISubject()=default
Virtual destructor.
std::vector< IObserver * > observers
Collection of registered observers.
Definition ISubject.hxx:44
virtual void notify(const Event &event) const =0
Notifies all attached observers about an event.
virtual void attach(std::shared_ptr< IObserver > observer)=0
Attaches an observer to the subject.
Service layer components and infrastructure services.
Structure describing an event published by the VCS core.
Definition Event.hxx:30