Class to hold bit-width and unsigned type. More...
#include <RandomLib/RandomType.hpp>
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 |
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.
typedef UIntType RandomLib::RandomType< bits, UIntType >::type |
The unsigned C++ type
Definition at line 34 of file RandomType.hpp.
static type RandomLib::RandomType< bits, UIntType >::cast | ( | IntType | x | ) | throw () [inline, static] |
A combined masking and casting operation
Definition at line 55 of file RandomType.hpp.
References RandomLib::RandomType< bits, UIntType >::mask.
Referenced by RandomLib::RandomEngine< Algorithm, Mixer >::Ran32(), RandomLib::RandomEngine< Algorithm, Mixer >::Ran64(), RandomLib::RandomSeed::Reseed(), RandomLib::RandomSeed::SeedVector(), RandomLib::RandomSeed::SeedWord(), and RandomLib::RandomSeed::VectorToString().
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)
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)
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().
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().
const type RandomLib::RandomType< bits, UIntType >::mask [static] |
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().
const type RandomLib::RandomType< bits, UIntType >::min = type(0) [static] |
The minimum representable value
Definition at line 47 of file RandomType.hpp.
const type RandomLib::RandomType< bits, UIntType >::max = mask [static] |
The maximum representable value
Definition at line 51 of file RandomType.hpp.