Bayeux
3.4.1
Core Foundation library for SuperNEMO
|
#include <bayeux/mygsl/seed_manager.h>
Public Types | |
enum | init_seed_from_type { INIT_SEED_FROM_UNDEFINED = 0, INIT_SEED_FROM_CURRENT_TIME = datatools::bit_mask::bit00, INIT_SEED_FROM_CURRENT_PID = datatools::bit_mask::bit01, INIT_SEED_FROM_URANDOM = datatools::bit_mask::bit02, INIT_SEED_FROM_RANDOM_DEVICE = datatools::bit_mask::bit03, INIT_SEED_FROM_USER = datatools::bit_mask::bit04, INIT_SEED_FROM_CURRENT_TIME_AND_PID = INIT_SEED_FROM_CURRENT_TIME | INIT_SEED_FROM_CURRENT_PID, INIT_SEED_FROM_DEFAULT = INIT_SEED_FROM_RANDOM_DEVICE } |
The entropy strategy used to choose a seed for randomization of seeds. More... | |
Public Member Functions | |
seed_manager () | |
Default constructor: More... | |
virtual | ~seed_manager () |
Destructor: More... | |
void | get_labels (std::vector< std::string > &labels_) const |
Build an array of all the PRNGs' labels stored in the manager. More... | |
bool | has_seed (const std::string &label_) const |
Check is a PRNG with a given label has an associated seed. More... | |
void | add_seed (const std::string &label_, int32_t seed_) |
Install the seed value associated to a PRNG with a given label. More... | |
int32_t | get_seed (const std::string &label_) const |
Get the seed value associated to a PRNG with a given label. More... | |
void | update_seed (const std::string &label_, int32_t seed_) |
Change the seed value associated to a PRNG with a given label. More... | |
void | invalidate_seed (const std::string &label_) |
Invalidate the seed value associated to a PRNG with a given label. More... | |
void | clear () |
Clear the list of stored seeds. More... | |
void | invalidate () |
Make all seeds associated to all PRNGs invalid. More... | |
void | all_time_seeds () |
Make all seeds associated to all PRNGs set by the current time. More... | |
void | all_auto_seeds () |
Make all seeds associated to all PRNGs set automatically. More... | |
void | transform_time_seeds (bool allow_duplication_=false) |
Compute the effective seeds' values from the current time. More... | |
void | ensure_different_seeds () |
Compute the effective seeds' values to be all different from each others. More... | |
bool | all_different_seeds () const |
Check if all valid seeds are differents : More... | |
bool | has_auto_seeds () const |
Check if some valid seeds are 'auto' : More... | |
bool | has_time_seeds () const |
Check if some valid seeds are 'time' : More... | |
bool | has_invalid_seeds () const |
Check if some seeds are 'invalid' : More... | |
size_t | size () const |
Returns the number of PRNG's seed values storedin the manager. More... | |
bool | empty () const |
Check if the manager is empty. More... | |
void | set_init_seed_flags (uint32_t) |
Set the entropy strategy flags. More... | |
uint32_t | get_init_seed_flags () const |
Return the entropy strategy flags. More... | |
void | dump (std::ostream &) const |
Basic print. More... | |
Static Public Member Functions | |
static bool | seed_is_valid (int32_t seed) |
Return true if supplied integer can be treated as a seed. More... | |
Protected Member Functions | |
void | _ensure_different_seeds (mygsl::rng *random_=0) |
int32_t | _set_seed_for_seeds () |
void | _set_seed (const std::string &label_, int32_t seed_) |
Friends | |
std::ostream & | operator<< (std::ostream &, const seed_manager &) |
Store the seeds informations in a stream. More... | |
std::istream & | operator>> (std::istream &, seed_manager &) |
Load the seeds informations froma stream. More... | |
A seed manager instance is responsible to save a collection of seeds used to initialize a set of pseudo-random number generators (PRNG). As the PRNGs are all labelled with a unique name. The seed manager uses an internal dictionary to store the seeds. It is possible to force a seed value for a given PRNG as well as to use a seed determined by some specific PRNG initialized with the current time. I/O operations on streams enable to store and load the content of the seed manager.
mygsl::seed_manager::seed_manager | ( | ) |
Default constructor:
|
virtual |
Destructor:
|
protected |
|
protected |
|
protected |
void mygsl::seed_manager::add_seed | ( | const std::string & | label_, |
int32_t | seed_ | ||
) |
Install the seed value associated to a PRNG with a given label.
void mygsl::seed_manager::all_auto_seeds | ( | ) |
Make all seeds associated to all PRNGs set automatically.
bool mygsl::seed_manager::all_different_seeds | ( | ) | const |
Check if all valid seeds are differents :
void mygsl::seed_manager::all_time_seeds | ( | ) |
Make all seeds associated to all PRNGs set by the current time.
void mygsl::seed_manager::clear | ( | ) |
Clear the list of stored seeds.
void mygsl::seed_manager::dump | ( | std::ostream & | ) | const |
Basic print.
bool mygsl::seed_manager::empty | ( | ) | const |
Check if the manager is empty.
void mygsl::seed_manager::ensure_different_seeds | ( | ) |
Compute the effective seeds' values to be all different from each others.
uint32_t mygsl::seed_manager::get_init_seed_flags | ( | ) | const |
Return the entropy strategy flags.
void mygsl::seed_manager::get_labels | ( | std::vector< std::string > & | labels_ | ) | const |
Build an array of all the PRNGs' labels stored in the manager.
int32_t mygsl::seed_manager::get_seed | ( | const std::string & | label_ | ) | const |
Get the seed value associated to a PRNG with a given label.
bool mygsl::seed_manager::has_auto_seeds | ( | ) | const |
Check if some valid seeds are 'auto' :
bool mygsl::seed_manager::has_invalid_seeds | ( | ) | const |
Check if some seeds are 'invalid' :
bool mygsl::seed_manager::has_seed | ( | const std::string & | label_ | ) | const |
Check is a PRNG with a given label has an associated seed.
bool mygsl::seed_manager::has_time_seeds | ( | ) | const |
Check if some valid seeds are 'time' :
void mygsl::seed_manager::invalidate | ( | ) |
Make all seeds associated to all PRNGs invalid.
void mygsl::seed_manager::invalidate_seed | ( | const std::string & | label_ | ) |
Invalidate the seed value associated to a PRNG with a given label.
|
static |
Return true if supplied integer can be treated as a seed.
void mygsl::seed_manager::set_init_seed_flags | ( | uint32_t | ) |
Set the entropy strategy flags.
size_t mygsl::seed_manager::size | ( | ) | const |
Returns the number of PRNG's seed values storedin the manager.
void mygsl::seed_manager::transform_time_seeds | ( | bool | allow_duplication_ = false | ) |
Compute the effective seeds' values from the current time.
void mygsl::seed_manager::update_seed | ( | const std::string & | label_, |
int32_t | seed_ | ||
) |
Change the seed value associated to a PRNG with a given label.
|
friend |
Store the seeds informations in a stream.
|
friend |
Load the seeds informations froma stream.