STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
_Swc_base< _Ty, _Sx, _Rx, _Swc_Traits > Class Template Reference
Inheritance diagram for _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >:
_Circ_buf< _Ty, _Rx >

Public Types

typedef _Ty result_type
 
typedef _Swc_Traits _Traits
 
typedef _Circ_buf< _Ty, _Rx > _Mybase
 
typedef _Swc_Traits::_Seed_t _Seed_t
 

Public Member Functions

 _Swc_base ()
 
 _Swc_base (typename _Swc_Traits::_Seed_t _X0)
 
template<class _Gen >
 _Swc_base (_Gen &_Gx)
 
void seed (unsigned long _Value=19780503U)
 
template<class _Gen >
void seed (_Gen &_Gx, bool _Readcy=false)
 
result_type() min () const
 
result_type() max () const
 
result_type operator() ()
 
void discard (unsigned long long _Nskip)
 
bool _Equals (const _Swc_base &_Right) const
 
template<class _Elem , class _Traits >
basic_ostream< _Elem, _Traits > & _Write (basic_ostream< _Elem, _Traits > &_Ostr) const
 
- Public Member Functions inherited from _Circ_buf< _Ty, _Rx >
_Ty _At (int _Ix) const
 
bool _Equals (const _Circ_buf &_Right) const
 
unsigned int _Base (int _Ix=0) const
 

Static Public Attributes

static const size_t short_lag = _Sx
 
static const size_t long_lag = _Rx
 

Protected Member Functions

template<class _Gen >
void _Seed (_Gen &_Gx, bool _Readcy, const true_type &)
 
template<class _Gen >
void _Seed (_Gen &_Gx, bool _Readcy, const false_type &)
 
template<class _Gen >
void _Reset (_Gen &_Gx, bool _Readcy)
 
void _Setx (int _Ix, _Ty _First, _Ty _Second)
 

Protected Attributes

_Swc_Traits::_Cy_t _Carry
 

Additional Inherited Members

- Public Attributes inherited from _Circ_buf< _Ty, _Rx >
unsigned int _Idx
 
_Ty _Ax [2 *_Nw]
 

Member Typedef Documentation

template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
typedef _Circ_buf<_Ty, _Rx> _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Mybase
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
typedef _Swc_Traits::_Seed_t _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Seed_t
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
typedef _Swc_Traits _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Traits
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
typedef _Ty _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::result_type

Constructor & Destructor Documentation

template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
_Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Swc_base ( )
inline
799  { // construct with default seed
800  seed();
801  }
void seed(unsigned long _Value=19780503U)
Definition: random:814
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
_Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Swc_base ( typename _Swc_Traits::_Seed_t  _X0)
inline
804  { // construct with specified seed
805  seed(_X0);
806  }
void seed(unsigned long _Value=19780503U)
Definition: random:814
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
template<class _Gen >
_Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Swc_base ( _Gen &  _Gx)
inline
810  { // construct with seed values from generator
811  seed(_Gx);
812  }
void seed(unsigned long _Value=19780503U)
Definition: random:814

Member Function Documentation

template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
bool _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Equals ( const _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits > &  _Right) const
inline
856  { // return true if *this will generate same sequence as _Right
857  return (_Mybase::_Equals(_Right)
858  && _Carry == _Right._Carry);
859  }
bool _Equals(const _Circ_buf &_Right) const
Definition: random:728
_Swc_Traits::_Cy_t _Carry
Definition: random:904
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
template<class _Gen >
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Reset ( _Gen &  _Gx,
bool  _Readcy 
)
inlineprotected
886  { // reset sequence
887  _Carry = _Swc_Traits::_Reset(_Gx, this->_Ax, _Readcy);
888  this->_Idx = _Rx;
889  }
unsigned int _Idx
Definition: random:777
_Ty _Ax[2 *_Nw]
Definition: random:778
_Swc_Traits::_Cy_t _Carry
Definition: random:904
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
template<class _Gen >
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Seed ( _Gen &  _Gx,
bool  _Readcy,
const true_type  
)
inlineprotected
872  { // reset sequence from numeric value
874  _Gx == 0 ? 19780503U : _Gx);
875  _Reset(_Lc, _Readcy);
876  }
Definition: random:491
void _Reset(_Gen &_Gx, bool _Readcy)
Definition: random:885
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
template<class _Gen >
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Seed ( _Gen &  _Gx,
bool  _Readcy,
const false_type  
)
inlineprotected
880  { // reset sequence from generator
881  _Reset(_Gx, _Readcy);
882  }
void _Reset(_Gen &_Gx, bool _Readcy)
Definition: random:885
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Setx ( int  _Ix,
_Ty  _First,
_Ty  _Second 
)
inlineprotected
892  { // update _Ax[_Ix] and _Carry
893  _Ty _Newx = (_First -= _Carry) - _Second;
894  if (_First < _Second || _Swc_Traits::_Mod <= _Newx)
895  { // underflowed, so add _Mod
896  _Newx += _Swc_Traits::_Mod;
897  _Carry = _Swc_Traits::_Cy;
898  }
899  else
900  _Carry = 0;
901  this->_Ax[_Ix] = _Newx;
902  }
_Ty _Ax[2 *_Nw]
Definition: random:778
_Swc_Traits::_Cy_t _Carry
Definition: random:904
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
template<class _Elem , class _Traits >
basic_ostream<_Elem, _Traits>& _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Write ( basic_ostream< _Elem, _Traits > &  _Ostr) const
inline
864  { // write state to _Ostr
865  _Swc_Traits::_Write(_Ostr, *this, _Carry);
866  return (_Ostr);
867  }
_Swc_Traits::_Cy_t _Carry
Definition: random:904
basic_ostream< _Elem, _Traits > & _Write(basic_ostream< _Elem, _Traits > &_Os, long double _Dx)
Definition: random:111
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::discard ( unsigned long long  _Nskip)
inline
850  { // discard _Nskip elements
851  for (; 0 < _Nskip; --_Nskip)
852  (*this)();
853  }
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
result_type() _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::max ( ) const
inline
831  { // return maximum possible generated value
832  return (_Swc_Traits::_Max);
833  }
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
result_type() _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::min ( ) const
inline
826  { // return minimum possible generated value
827  return (0);
828  }
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
result_type _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::operator() ( )
inline
836  { // return next value
837  int _Ix = 2 * _Rx <= this->_Idx ? 0 : this->_Idx;
838  if (_Ix < _Sx)
839  _Setx(_Ix, this->_Ax[_Ix + 2 * _Rx - _Sx],
840  this->_Ax[_Ix + _Rx]);
841  else if (_Ix < _Rx)
842  _Setx(_Ix, this->_Ax[_Ix - _Sx], this->_Ax[_Ix + _Rx]);
843  else
844  _Setx(_Ix, this->_Ax[_Ix - _Sx], this->_Ax[_Ix - _Rx]);
845  this->_Idx = _Ix + 1;
846  return (this->_Ax[_Ix]);
847  }
unsigned int _Idx
Definition: random:777
_Ty _Ax[2 *_Nw]
Definition: random:778
void _Setx(int _Ix, _Ty _First, _Ty _Second)
Definition: random:891
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::seed ( unsigned long  _Value = 19780503U)
inline
815  { // set initial values from specified seed value
816  _Seed(_Value, false, true_type());
817  }
void _Seed(_Gen &_Gx, bool _Readcy, const true_type &)
Definition: random:871
_CRTIMP _In_ int _Value
Definition: setjmp.h:190
integral_constant< bool, true > true_type
Definition: xtr1common:47
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
template<class _Gen >
void _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::seed ( _Gen &  _Gx,
bool  _Readcy = false 
)
inline
821  { // set initial values from range
822  _Seed(_Gx, _Readcy, _Is_numeric<_Gen>());
823  }
void _Seed(_Gen &_Gx, bool _Readcy, const true_type &)
Definition: random:871
Definition: xtr1common:306

Member Data Documentation

template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
_Swc_Traits::_Cy_t _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::_Carry
protected
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
const size_t _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::long_lag = _Rx
static
template<class _Ty, size_t _Sx, size_t _Rx, class _Swc_Traits>
const size_t _Swc_base< _Ty, _Sx, _Rx, _Swc_Traits >::short_lag = _Sx
static

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