|
SVCS - English Documentation
|
The Subject (Publisher) Interface (Abstract Base Class). More...
#include <ISubject.hxx>
Public Member Functions | |
| virtual | ~ISubject ()=default |
| Virtual destructor. | |
| virtual void | attach (std::shared_ptr< IObserver > observer)=0 |
| Attaches an observer to the subject. | |
| virtual void | detach (std::shared_ptr< IObserver > observer)=0 |
| Detaches an observer from the subject. | |
| virtual void | notify (const Event &event) const =0 |
| Notifies all attached observers about an event. | |
Protected Attributes | |
| std::vector< IObserver * > | observers |
| Collection of registered observers. | |
The Subject (Publisher) Interface (Abstract Base Class).
Core classes (e.g., Repository, EventBus) implement this interface to allow observers to subscribe to events. The contract requires all management functions (attach, detach) to handle std::shared_ptr<IObserver>.
|
virtualdefault |
Virtual destructor.
Ensures correct cleanup of derived subject classes.
|
pure virtual |
Attaches an observer to the subject.
| observer | A smart pointer to the observer object to attach. |
Implemented in svcs::core::Repository, svcs::services::EventBus, svcs::test::cli::mocks::MockSubject, svcs::test::cli::utils::MockSubject, svcs::test::core::MockSubject, svcs::test::core::MockSubject, svcs::test::server::MockEventBus, svcs::test::server::SimpleEventBus, svcs::test::server::SimpleEventBus, and svcs::test::server::TestEventBus.
|
pure virtual |
Detaches an observer from the subject.
| observer | A smart pointer to the observer object to detach. |
Implemented in svcs::core::Repository, svcs::services::EventBus, svcs::test::cli::mocks::MockSubject, svcs::test::cli::utils::MockSubject, svcs::test::core::MockSubject, svcs::test::core::MockSubject, svcs::test::server::MockEventBus, svcs::test::server::SimpleEventBus, svcs::test::server::SimpleEventBus, and svcs::test::server::TestEventBus.
|
pure virtual |
Notifies all attached observers about an event.
This method is made public so that component classes (like ObjectStorage) can publish events through the injected ISubject pointer. The method is declared as const because event notification is a logically non-mutating action on the Subject's state.
| event | The constant reference to the event structure to be sent. |
Implemented in svcs::core::Repository, svcs::services::EventBus, svcs::test::cli::mocks::MockSubject, svcs::test::cli::utils::MockSubject, svcs::test::core::mocks::MockSubject, svcs::test::core::MockSubject, svcs::test::core::MockSubject, svcs::test::server::MockEventBus, svcs::test::server::SimpleEventBus, svcs::test::server::SimpleEventBus, svcs::test::server::ssh::MockEventBus, and svcs::test::server::TestEventBus.