SmartSoft Component-Developer API
|
This class implements the Observer part of the Observer design pattern for implementing a uniform shutdown procedure for all component's resources. More...
#include <smartIShutdownObserver.h>
Public Member Functions | |
IShutdownObserver (ShutdownSubject *subject=nullptr) | |
The default constructor. More... | |
virtual | ~IShutdownObserver () |
The default destructor. More... | |
virtual void | on_shutdown ()=0 |
This is the main update method that will be automatically called from the given subject each time the subject undergoes a notable change. More... | |
Protected Member Functions | |
void | attach_self_to (ShutdownSubject *subject) |
call this method from within the constructor of derived classes More... | |
void | detach_self_from (ShutdownSubject *subject) |
this method is called within the destructor More... | |
This class implements the Observer part of the Observer design pattern for implementing a uniform shutdown procedure for all component's resources.
An IComponent implements the counter-part IShutdownSubject interface that will trigger all attached IShutdownObserver instances just before the IComponent finally shuts down. Each communication pattern (clients and servers) attached to an IComponent should implement IShutdownObserver interface (i.e. the on_shutdown() method) thus providing individual cleanup strategies.
|
inline |
The default constructor.
This constructor will call subject->attach(this) to start observing the given subject.
subject | the subject (also called model) that this Observer is going to observe |
|
inlinevirtual |
The default destructor.
This destructor will call subject->detach(this) to stop observing the given subject.
|
inlineprotected |
call this method from within the constructor of derived classes
The IShutdownObserver interface can be derived pure virtual which means that in these cases the default empty constructor will be called. For the pure virtual derivation, the constructor of the derived class should call this method manually to ensure proper registration of the IShutdownObserver.
subject | the subject (i.e. model) of the Observer design pattern |
|
inlineprotected |
this method is called within the destructor
This method is called from within the destructor of this class if the internal subject pointer has been set-up before using the attach_self_to() method.
subject | the subject (i.e. model) of the Observer design pattern |
|
pure virtual |
This is the main update method that will be automatically called from the given subject each time the subject undergoes a notable change.
This method should be implemented in derived classes to provide an individual shutdown (i.e. cleanup) strategy/procedure.
Implemented in Smart::IClientPattern, Smart::IServerPattern, Smart::ITask, and Smart::IManagedTask.