#include <source/Observing.h>
Inherits Observing::GaObserver.
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. | |
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.
typedef list<GaObserver*> Observing::GaObserversList::GaObserversListType [protected] |
Alias for STL list class which contains pointers to GaObserver objects.
| 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.
| 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.
| 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.
| 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.
| observer | observer which will be subscribed. |
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.
| observer | observer which will be unsubscribed. |
this object.| int Observing::GaObserversList::GetObserverCount | ( | ) | const |
This method is thread-safe.
List of subscribed observers.