|
Nemo
2.2.0
|
Interface for the simulation services (files and stats). More...
#include <service.h>
Inheritance diagram for Service:Public Member Functions | |
| Service () | |
| virtual | ~Service () |
| virtual bool | init ()=0 |
| Inits internals. | |
| virtual void | notify () |
| Notifies all observers to update their state. | |
| virtual void | load (SimComponent *sc)=0 |
| Interface used by a simulation component to load its obervers onto a service provider. | |
| virtual void | attach (Handler *h) |
| Adds an observer to the list. | |
| virtual void | reset () |
| Clears the observers list. | |
Private Attributes | |
| std::list< Handler * > | _observers |
| The list of observers. | |
Interface for the simulation services (files and stats).
Implements the observer pattern. Notify the observers (Handler) to update their state. Contains the observer list. Provides interface to attach the observers to the service.
| virtual void Service::attach | ( | Handler * | h | ) | [inline, virtual] |
Adds an observer to the list.
Definition at line 62 of file service.h.
References _observers.
{_observers.push_back(h);}
| virtual bool Service::init | ( | ) | [pure virtual] |
Inits internals.
Implemented in FileServices, UpdaterServices, and StatServices.
| virtual void Service::load | ( | SimComponent * | sc | ) | [pure virtual] |
Interface used by a simulation component to load its obervers onto a service provider.
Implemented in FileServices, StatServices, and UpdaterServices.
| virtual void Service::notify | ( | ) | [inline, virtual] |
Notifies all observers to update their state.
Reimplemented in StatServices, and UpdaterServices.
Definition at line 55 of file service.h.
References _observers.
Referenced by LCE_FileServicesNotifier::execute(), and SimRunner::Replicate_LOOP().
{
for ( std::list< Handler* >::iterator HIT = _observers.begin(); HIT != _observers.end(); HIT++ )
(*HIT)->update();
}
| virtual void Service::reset | ( | ) | [inline, virtual] |
Clears the observers list.
Reimplemented in FileServices, StatServices, and UpdaterServices.
Definition at line 64 of file service.h.
References _observers.
{_observers.clear();}
std::list<Handler*> Service::_observers [private] |
1.7.5.1 -- Nemo is hosted by