Common::GaStatValue< T > Class Template Reference

GaStatValue template class stores single statistical value and keeps track of changes of that value between generations. More...

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

List of all members.

Public Member Functions

 GaStatValue (T current, T previous)
 Initialize statistical values with user defined values for current and previous generations.
 GaStatValue ()
 Initializes statistical values with zero values.
T GACALL GetCurrent () const
 This method is not thread-safe.
void GACALL SetCurrent (T value)
 SetCurrent method sets value for the current generation.
T GACALL GetPrevious () const
 This method is not thread-safe.
void GACALL SetPrevious (T value)
 SetPrevious method sets value for the previous generation.
bool GACALL Changed () const
 Changed method checks for changes of value between generations.
GaStatValue< T > GACALL operator+ (const GaStatValue< T > &rhs)
 operator + makes new object by summing corresponding values of this object and rhs object.
GaStatValue< T > &GACALL operator+= (const GaStatValue< T > &rhs)
 operator += adds corresponding values of rhs object and this object.

Private Attributes

_current
 Stores statistical value of current generation.
_previous
 Stores statistical value from previous generation.


Detailed Description

template<typename T>
class Common::GaStatValue< T >

GaStatValue template class stores single statistical value and keeps track of changes of that value between generations.

This class has no built-in synchronizator, so LOCK_OBJECT and LOCK_THIS_OBJECT macros cannot be used with instances of this class. No public or private methods are thread-safe.

Parameters:
T type of statistical value.

Constructor & Destructor Documentation

template<typename T>
Common::GaStatValue< T >::GaStatValue ( current,
previous 
) [inline]

Initialize statistical values with user defined values for current and previous generations.

Parameters:
current value for the current generation.
previous value for the previous generation.

template<typename T>
Common::GaStatValue< T >::GaStatValue (  )  [inline]

Initializes statistical values with zero values.


Member Function Documentation

template<typename T>
T GACALL Common::GaStatValue< T >::GetCurrent (  )  const [inline]

This method is not thread-safe.

Returns:
Returns statistical value for the current generation.

template<typename T>
void GACALL Common::GaStatValue< T >::SetCurrent ( value  )  [inline]

SetCurrent method sets value for the current generation.

This method is not thread safe.

Parameters:
value new value for the current generation.

template<typename T>
T GACALL Common::GaStatValue< T >::GetPrevious (  )  const [inline]

This method is not thread-safe.

Returns:
Returns value for the previous generation.

template<typename T>
void GACALL Common::GaStatValue< T >::SetPrevious ( value  )  [inline]

SetPrevious method sets value for the previous generation.

This method is not thread safe.

Parameters:
value new value for the previous generation.

template<typename T>
bool GACALL Common::GaStatValue< T >::Changed (  )  const [inline]

Changed method checks for changes of value between generations.

This method is not thread-safe.

Returns:
Method returns true if value from previous generation has changed, otherwise it returns false.

template<typename T>
GaStatValue<T> GACALL Common::GaStatValue< T >::operator+ ( const GaStatValue< T > &  rhs  )  [inline]

operator + makes new object by summing corresponding values of this object and rhs object.

This method is not thread-safe.

Parameters:
rhs reference to the second object which is used for summing, the first object is this object.
Returns:
Operator returns new object with summed values.

template<typename T>
GaStatValue<T>& GACALL Common::GaStatValue< T >::operator+= ( const GaStatValue< T > &  rhs  )  [inline]

operator += adds corresponding values of rhs object and this object.

This operator is not thread-safe.

Parameters:
rhs reference to the second object which is used for summing, the first object is this object.
Returns:
Operator returns reference to this object.


Member Data Documentation

template<typename T>
T Common::GaStatValue< T >::_current [private]

Stores statistical value of current generation.

template<typename T>
T Common::GaStatValue< T >::_previous [private]

Stores statistical value from previous generation.


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

Genetic Algorithm Library
Coolsoft Software Development