NLMISC::CValueSmootherTemplate< bool > Class Template Reference

#include <value_smoother.h>


Detailed Description

template<>
class NLMISC::CValueSmootherTemplate< bool >

A smoother replacement for boolean.
Author:
Boris Boucher

Nevrax France

Date:
2003

Definition at line 137 of file value_smoother.h.

Public Member Functions

void addValue (bool dt)
 add a new value to be smoothed.

 CValueSmootherTemplate (uint n=1)
 Constructor.

const std::vector< bool > & getLastFrames () const
uint getNumFrame () const
bool getSmoothValue () const
 get the smoothed value.

void init (uint n)
 reset the ValueSmoother, and set the number of frame to smooth.

void reset ()
 reset only the ValueSmoother


Private Attributes

std::vector< bool > _LastFrames
uint _NumFrame


Member Function Documentation

void NLMISC::CValueSmootherTemplate< bool >::addValue bool  dt  )  [inline]
 

add a new value to be smoothed.

Definition at line 167 of file value_smoother.h.

00168         {
00169                 if(_NumFrame>0)
00170                         _LastFrames[0] = dt;
00171         }

NLMISC::CValueSmootherTemplate< bool >::CValueSmootherTemplate uint  n = 1  )  [inline, explicit]
 

Constructor.

Definition at line 142 of file value_smoother.h.

References NLMISC::CValueSmootherTemplate< T >::init(), and uint.

00143         {
00144                 init(n);
00145         }

const std::vector<bool>& NLMISC::CValueSmootherTemplate< bool >::getLastFrames  )  const [inline]
 

Definition at line 187 of file value_smoother.h.

00188         {
00189                 return _LastFrames;
00190         }

uint NLMISC::CValueSmootherTemplate< bool >::getNumFrame  )  const [inline]
 

Definition at line 182 of file value_smoother.h.

References uint.

00183         {
00184                 return _NumFrame;
00185         }

bool NLMISC::CValueSmootherTemplate< bool >::getSmoothValue  )  const [inline]
 

get the smoothed value.

Definition at line 174 of file value_smoother.h.

00175         {
00176                 if(_NumFrame>0)
00177                         return _LastFrames[0];
00178                 else
00179                         return false;
00180         }

void NLMISC::CValueSmootherTemplate< bool >::init uint  n  )  [inline]
 

reset the ValueSmoother, and set the number of frame to smooth.

Definition at line 148 of file value_smoother.h.

References uint.

00149         {
00150                 // reset all the array to 0.
00151                 _LastFrames.clear();
00152 
00153                 if (n>0)
00154                         _LastFrames.resize(n, false);
00155 
00156                 _NumFrame = 0;
00157         }

void NLMISC::CValueSmootherTemplate< bool >::reset void   )  [inline]
 

reset only the ValueSmoother

Definition at line 160 of file value_smoother.h.

00161         {
00162                 std::fill(_LastFrames.begin(), _LastFrames.end(), false);
00163                 _NumFrame = 0;
00164         }


Field Documentation

std::vector<bool> NLMISC::CValueSmootherTemplate< bool >::_LastFrames [private]
 

Definition at line 193 of file value_smoother.h.

uint NLMISC::CValueSmootherTemplate< bool >::_NumFrame [private]
 

Definition at line 194 of file value_smoother.h.


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 13:40:16 2004 for NeL by doxygen 1.3.6