Observing::GaObserversList Class Reference

This class manages subscriptions of observers to algorithm's events. More...

#include <D:/Temp/vs/gal/source/Observing.h>

Inherits Observing::GaObserver.

List of all members.

Public Member Functions

virtual GAL_API void GACALL StatisticUpdate (const GaStatistics &statistics, const GaAlgorithm &algorithm)
 This method notifies all subscribed observer that algorithm has reached end of the current generation.
virtual GAL_API void GACALL NewBestChromosome (const GaChromosome &newChromosome, const GaAlgorithm &algorithm)
 This method notifies all subscribed observer that algorithm found new chromosome which is better then the best chromosome form previous population.
virtual GAL_API void GACALL EvolutionStateChanged (GaAlgorithmState newState, const GaAlgorithm &algorithm)
 This method notifies all subscribed observer that state of algorithm's execution has changed.
GAL_API GaObserversList &GACALL operator+= (GaObserver &observer)
 operator += subscribes new observer. If observer is already subscribed call has no affect.
GAL_API GaObserversList &GACALL operator-= (GaObserver &observer)
 operator -= unsubscribes the observer. If observer is not subscribed call has no affect.
GAL_API int GACALL GetObserverCount () const
 This method is thread-safe.

Protected Types

typedef list< GaObserver * > GaObserversListType
 Alias for STL list class which contains pointers to GaObserver objects.

Protected Attributes

GaObserversListType _observers
 List of subscribed observers.


Detailed Description

This class manages subscriptions of observers to algorithm's events.

This class has built-in synchronizator, so it is allowed to use LOCK_OBJECT and LOCK_THIS_OBJECT macros with instances of this class. All public methods are thread-safe.


Member Typedef Documentation

Alias for STL list class which contains pointers to GaObserver objects.


Member Function Documentation

void Observing::GaObserversList::StatisticUpdate ( const GaStatistics statistics,
const GaAlgorithm algorithm 
) [virtual]

This method notifies all subscribed observer that algorithm has reached end of the current generation.

This method is thread-safe.

Parameters:
statistics reference to object with statistical information.
algorithm reference the algorithm which raised event.

Implements Observing::GaObserver.

void Observing::GaObserversList::NewBestChromosome ( const GaChromosome newChromosome,
const GaAlgorithm algorithm 
) [virtual]

This method notifies all subscribed observer that algorithm found new chromosome which is better then the best chromosome form previous population.

This method is thread-safe.

Parameters:
newChromosome reference to the chromosome.
algorithm reference the algorithm which raised event.

Implements Observing::GaObserver.

void Observing::GaObserversList::EvolutionStateChanged ( GaAlgorithmState  newState,
const GaAlgorithm algorithm 
) [virtual]

This method notifies all subscribed observer that state of algorithm's execution has changed.

This method is thread-safe.

Parameters:
newState new state of algorithm's execution
algorithm reference the algorithm which raised event.

Implements Observing::GaObserver.

GaObserversList & Observing::GaObserversList::operator+= ( GaObserver observer  ) 

operator += subscribes new observer. If observer is already subscribed call has no affect.

This operator is thread-safe.

Parameters:
observer observer which will be subscribed.
Returns:
Method returns reference to this object.

GaObserversList & Observing::GaObserversList::operator-= ( GaObserver observer  ) 

operator -= unsubscribes the observer. If observer is not subscribed call has no affect.

This operator is thread-safe.

Parameters:
observer observer which will be unsubscribed.
Returns:
Method returns reference to this object.

int Observing::GaObserversList::GetObserverCount (  )  const

This method is thread-safe.

Returns:
Method returns number of subscribed observers.


Member Data Documentation

List of subscribed observers.


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

Genetic Algorithm Library
Coolsoft Software Development