SVCS - English Documentation
Loading...
Searching...
No Matches
svcs::test::server::MockEventBus Class Reference
Inheritance diagram for svcs::test::server::MockEventBus:
svcs::services::ISubject

Public Member Functions

void attach (std::shared_ptr< svcs::services::IObserver > observer) override
 Attaches an observer to the subject.
void detach (std::shared_ptr< svcs::services::IObserver > observer) override
 Detaches an observer from the subject.
void notify (const svcs::services::Event &event) const override
 Notifies all attached observers about an event.
Public Member Functions inherited from svcs::services::ISubject
virtual ~ISubject ()=default
 Virtual destructor.

Public Attributes

svcs::services::Event last_event
int notification_count = 0
std::vector< std::shared_ptr< svcs::services::IObserver > > observers

Additional Inherited Members

Protected Attributes inherited from svcs::services::ISubject
std::vector< IObserver * > observers
 Collection of registered observers.

Member Function Documentation

◆ attach()

void svcs::test::server::MockEventBus::attach ( std::shared_ptr< svcs::services::IObserver > observer)
inlineoverridevirtual

Attaches an observer to the subject.

Parameters
observerA smart pointer to the observer object to attach.

Implements svcs::services::ISubject.

◆ detach()

void svcs::test::server::MockEventBus::detach ( std::shared_ptr< svcs::services::IObserver > observer)
inlineoverridevirtual

Detaches an observer from the subject.

Parameters
observerA smart pointer to the observer object to detach.

Implements svcs::services::ISubject.

◆ notify()

void svcs::test::server::MockEventBus::notify ( const svcs::services::Event & event) const
inlineoverridevirtual

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.

Parameters
eventThe constant reference to the event structure to be sent.

Implements svcs::services::ISubject.


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