Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Static Private Member Functions | List of all members
rndm::details::ValidSeed< SEED > Class Template Reference

Class storing a seed in the valid range. More...

#include <RandomSeedPolicyBase.h>

Public Types

using seed_t = SEED
 type of random seed More...
 

Public Member Functions

template<typename T >
 ValidSeed (T s)
 Constructor: converts from a value. More...
 
 ValidSeed (const ValidSeed &)=delete
 
 ValidSeed (ValidSeed &&)=default
 
ValidSeedoperator= (const ValidSeed &)=delete
 
ValidSeedoperator= (ValidSeed &&)=default
 
 operator seed_t () const
 Return the converted seeda. More...
 

Static Public Member Functions

template<typename T >
static constexpr seed_t MakeValid (T s)
 Forces the specified value into the allowed seed range. More...
 
template<typename T >
static constexpr bool isValid (T s)
 Returns whether the specified seed is valid. More...
 

Static Public Attributes

static constexpr seed_t Min = 1
 Smallest allowed seed. More...
 
static constexpr seed_t Max = 900000000
 Largest allowed seed. More...
 

Protected Attributes

seed_t seed
 the converted seed More...
 

Static Private Member Functions

template<typename T >
static constexpr seed_t BounceUp (T s, T min, T max)
 May be merged into MakeValid() with C++14. More...
 

Detailed Description

template<typename SEED>
class rndm::details::ValidSeed< SEED >

Class storing a seed in the valid range.

Definition at line 45 of file RandomSeedPolicyBase.h.

Member Typedef Documentation

template<typename SEED>
using rndm::details::ValidSeed< SEED >::seed_t = SEED

type of random seed

Definition at line 47 of file RandomSeedPolicyBase.h.

Constructor & Destructor Documentation

template<typename SEED>
template<typename T >
rndm::details::ValidSeed< SEED >::ValidSeed ( s)
inline

Constructor: converts from a value.

Definition at line 64 of file RandomSeedPolicyBase.h.

64 : seed(MakeValid(s)) {}
seed_t seed
the converted seed
static constexpr seed_t MakeValid(T s)
Forces the specified value into the allowed seed range.
static QCString * s
Definition: config.cpp:1042
template<typename SEED>
rndm::details::ValidSeed< SEED >::ValidSeed ( const ValidSeed< SEED > &  )
delete
template<typename SEED>
rndm::details::ValidSeed< SEED >::ValidSeed ( ValidSeed< SEED > &&  )
default

Member Function Documentation

template<typename SEED>
template<typename T >
static constexpr seed_t rndm::details::ValidSeed< SEED >::BounceUp ( s,
min,
max 
)
inlinestaticprivate

May be merged into MakeValid() with C++14.

Definition at line 80 of file RandomSeedPolicyBase.h.

81  { return (s < min)? s + (max - min + 1): s; }
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
static QCString * s
Definition: config.cpp:1042
template<typename SEED>
template<typename T >
static constexpr bool rndm::details::ValidSeed< SEED >::isValid ( s)
inlinestatic

Returns whether the specified seed is valid.

Definition at line 59 of file RandomSeedPolicyBase.h.

59 { return (s >= Min) && (s <= Max); }
static constexpr seed_t Max
Largest allowed seed.
static constexpr seed_t Min
Smallest allowed seed.
static QCString * s
Definition: config.cpp:1042
template<typename SEED>
template<typename T >
static constexpr seed_t rndm::details::ValidSeed< SEED >::MakeValid ( s)
inlinestatic

Forces the specified value into the allowed seed range.

Definition at line 54 of file RandomSeedPolicyBase.h.

55  { return BounceUp(Min + seed_t(s) % (Max - Min + 1), Min, Max); }
SEED seed_t
type of random seed
static constexpr seed_t Max
Largest allowed seed.
static constexpr seed_t Min
Smallest allowed seed.
static constexpr seed_t BounceUp(T s, T min, T max)
May be merged into MakeValid() with C++14.
static QCString * s
Definition: config.cpp:1042
template<typename SEED>
rndm::details::ValidSeed< SEED >::operator seed_t ( ) const
inline

Return the converted seeda.

Definition at line 72 of file RandomSeedPolicyBase.h.

72 { return seed; }
seed_t seed
the converted seed
template<typename SEED>
ValidSeed& rndm::details::ValidSeed< SEED >::operator= ( const ValidSeed< SEED > &  )
delete
template<typename SEED>
ValidSeed& rndm::details::ValidSeed< SEED >::operator= ( ValidSeed< SEED > &&  )
default

Member Data Documentation

template<typename SEED>
constexpr seed_t rndm::details::ValidSeed< SEED >::Max = 900000000
static

Largest allowed seed.

Definition at line 50 of file RandomSeedPolicyBase.h.

template<typename SEED>
constexpr seed_t rndm::details::ValidSeed< SEED >::Min = 1
static

Smallest allowed seed.

Definition at line 49 of file RandomSeedPolicyBase.h.

template<typename SEED>
seed_t rndm::details::ValidSeed< SEED >::seed
protected

the converted seed

Definition at line 75 of file RandomSeedPolicyBase.h.


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