RandomLib::RandomType< bits, UIntType > Class Template Reference

Class to hold bit-width and unsigned type. More...

#include <RandomLib/RandomType.hpp>

List of all members.

Public Types

typedef UIntType type

Static Public Member Functions

template<typename IntType >
static type cast (IntType x) throw ()
static void Read32 (std::istream &is, bool bin, type &x) throw (std::ios::failure)
static void Write32 (std::ostream &os, bool bin, int &cnt, type x) throw (std::ios::failure)
static void CheckSum (type n, uint32_t &check) throw ()

Static Public Attributes

static const unsigned width = bits
static const type mask
static const type min = type(0)
static const type max = mask

Detailed Description

template<int bits, typename UIntType>
class RandomLib::RandomType< bits, UIntType >

Class to hold bit-width and unsigned type.

This provides a simple class to couple a bit-width and an unsigned type capable of holding all the bits. In addition is offers static methods for I/O and checksumming.

Definition at line 29 of file RandomType.hpp.


Member Typedef Documentation

template<int bits, typename UIntType >
typedef UIntType RandomLib::RandomType< bits, UIntType >::type

The unsigned C++ type

Definition at line 34 of file RandomType.hpp.


Member Function Documentation

template<int bits, typename UIntType >
template<typename IntType >
static type RandomLib::RandomType< bits, UIntType >::cast ( IntType  x  )  throw () [inline, static]
template<int bits, typename UIntType >
static void RandomLib::RandomType< bits, UIntType >::Read32 ( std::istream &  is,
bool  bin,
type x 
) throw (std::ios::failure) [static]

Read a data value from a stream of 32-bit quantities (binary or text)

template<int bits, typename UIntType >
static void RandomLib::RandomType< bits, UIntType >::Write32 ( std::ostream &  os,
bool  bin,
int &  cnt,
type  x 
) throw (std::ios::failure) [static]

Read the data value to a stream of 32-bit quantities (binary or text)

template<int bits, typename UIntType >
static void RandomLib::RandomType< bits, UIntType >::CheckSum ( type  n,
uint32_t &  check 
) throw () [static]

Accumulate a checksum of a integer into a 32-bit check. This implements a very simple checksum and is intended to avoid accidental corruption only.

Referenced by RandomLib::RandomSeed::SeedWord().


Member Data Documentation

template<int bits, typename UIntType >
const unsigned RandomLib::RandomType< bits, UIntType >::width = bits [static]

The number of significant bits

Definition at line 38 of file RandomType.hpp.

Referenced by RandomLib::MixerMT1< RandomType >::Name(), and RandomLib::MixerMT0< RandomType >::Name().

template<int bits, typename UIntType >
const type RandomLib::RandomType< bits, UIntType >::mask [static]
Initial value:
      ~type(0) >> (std::numeric_limits<type>::digits - width)

A mask for the significant bits.

Definition at line 42 of file RandomType.hpp.

Referenced by RandomLib::RandomType< bits, UIntType >::cast(), and RandomLib::RandomCanonical< Generator >::Integer().

template<int bits, typename UIntType >
const type RandomLib::RandomType< bits, UIntType >::min = type(0) [static]

The minimum representable value

Definition at line 47 of file RandomType.hpp.

template<int bits, typename UIntType >
const type RandomLib::RandomType< bits, UIntType >::max = mask [static]

The maximum representable value

Definition at line 51 of file RandomType.hpp.


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

Generated on Thu Dec 31 15:24:30 2009 by  doxygen 1.6.1