Nemo  2.2.0
Public Member Functions | Private Attributes
Service Class Reference

Interface for the simulation services (files and stats). More...

#include <service.h>

+ Inheritance diagram for Service:

List of all members.

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.

Detailed Description

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.

Definition at line 43 of file service.h.


Constructor & Destructor Documentation

Service::Service ( ) [inline]

Definition at line 49 of file service.h.

{ }
virtual Service::~Service ( ) [inline, virtual]

Definition at line 51 of file service.h.

{ }

Member Function Documentation

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();}

Member Data Documentation

std::list<Handler*> Service::_observers [private]

The list of observers.

Definition at line 45 of file service.h.

Referenced by attach(), notify(), and reset().


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

Generated for Nemo v2.2.0 by  doxygen 1.7.5.1 -- Nemo is hosted by  SourceForge.net Logo