Public Types | Static Public Member Functions | Static Public Attributes
RandomLib::RandomType Class Reference

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

#include <RandomLib-2010-01/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

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.


Member Typedef Documentation

typedef UIntType RandomLib::RandomType::type

The unsigned C++ type

Definition at line 33 of file RandomType.hpp.


Member Function Documentation

template<typename IntType >
static type RandomLib::RandomType::cast ( IntType  x) throw () [inline, static]

A combined masking and casting operation

Definition at line 54 of file RandomType.hpp.

References mask.

Referenced by RandomLib::RandomEngine::Ran32(), RandomLib::RandomEngine::Ran64(), RandomLib::RandomSeed::Reseed(), and RandomLib::RandomSeed::VectorToString().

void RandomLib::Random_u64::Read32 ( std::istream &  is,
bool  bin,
Random_u32::type x 
) throw (std::ios::failure) [static]

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

Definition at line 118 of file Random.cpp.

void RandomLib::Random_u64::Write32 ( std::ostream &  os,
bool  bin,
int &  cnt,
Random_u32::type  x 
) throw (std::ios::failure) [static]

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

Definition at line 91 of file Random.cpp.

static void RandomLib::RandomType::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.


Member Data Documentation

const unsigned RandomLib::RandomType::width = bits [static]

The number of significant bits

Definition at line 37 of file RandomType.hpp.

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

Initial value:
      ~type(0) >> (std::numeric_limits<type>::digits - width)

A mask for the significant bits.

Definition at line 41 of file RandomType.hpp.

Referenced by RandomLib::RandomCanonical::Integer(), RandomLib::RandomCanonical::Unsigned(), RandomLib::RandomCanonical::IntegerC(), and cast().

const type RandomLib::RandomType::min = type(0) [static]

The minimum representable value

Definition at line 46 of file RandomType.hpp.

The maximum representable value

Definition at line 50 of file RandomType.hpp.


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