Bayeux  3.4.1
Core Foundation library for SuperNEMO
Classes | Public Types | Public Member Functions | Static Public Attributes | List of all members
mygsl::prng_state_manager Class Reference

A manager that can store the internal states associated to a set of PRNGs addressed with some labels. More...

#include <bayeux/mygsl/prng_state_manager.h>

Classes

class  record
 Internal record that store the internal state of a PRNG. More...
 

Public Types

typedef std::map< std::string, recorddict_type
 An alias for the embedded dictionary container class. More...
 

Public Member Functions

const std::string & default_filename ()
 
bool has_filename () const
 Check if a backup filename is associated to the manager. More...
 
const std::string & get_filename () const
 Get the backup filename associated to the manager. More...
 
void set_filename (const std::string &="")
 Set the backup filename associated to the manager. More...
 
void reset_filename ()
 Reset the backup filename associated to the manager. More...
 
bool has_counter () const
 Check if the manager has a running counter value. More...
 
int get_counter () const
 Get the manager's running counter value. More...
 
void set_counter (int)
 Set the manager's running counter value. More...
 
void reset_counter ()
 Reset the manager's running counter value. More...
 
void increment_counter (unsigned int a_increment=1)
 Increment the manager's running counter value by a given value. More...
 
 prng_state_manager ()
 Default constructor. More...
 
 prng_state_manager (const std::string &)
 Constructor with a filename. More...
 
virtual ~prng_state_manager ()
 Destructor: More...
 
void invalidate ()
 Invalidate : More...
 
void get_labels (std::vector< std::string > &labels_) const
 Build an array with all PRNGs' labels stored in the manager. More...
 
bool has_state (const std::string &label_) const
 Check if the manager stores the internal state of a PRNG with a given label. More...
 
void add_state (const std::string &label_, size_t sz_)
 Add storage for the internal state of given size for a PRNG with a given label. More...
 
const recordget_state (const std::string &label_) const
 Get a record that hosts the internal state of a PRNG with a given label (non mutable) More...
 
recordget_state (const std::string &label_)
 Get a record that hosts the internal state of a PRNG with a given label (mutable) More...
 
void clear ()
 Clear the content of the manager. More...
 
void reset ()
 Reset the manager. More...
 
size_t size () const
 Return the number of internal state records. More...
 
bool empty () const
 Check if the manager has no stored internal state records. More...
 
void store (const std::string &filename_="") const
 Store the content of the manager in a file with given filename. More...
 
void load (const std::string &filename_="")
 Load the content of the manager from a file with given filename. More...
 
void dump (std::ostream &out_=std::clog) const
 Basic print. More...
 
bool error () const
 Check error status. More...
 
void reset_error ()
 Reset error. More...
 

Static Public Attributes

static const int INVALID_COUNTER_VALUE = -1
 Constant that represents an invalid value for a counter. More...
 

Detailed Description

A manager that can store the internal states associated to a set of PRNGs addressed with some labels.

Member Typedef Documentation

◆ dict_type

typedef std::map<std::string, record> mygsl::prng_state_manager::dict_type

An alias for the embedded dictionary container class.

Constructor & Destructor Documentation

◆ prng_state_manager() [1/2]

mygsl::prng_state_manager::prng_state_manager ( )

Default constructor.

◆ prng_state_manager() [2/2]

mygsl::prng_state_manager::prng_state_manager ( const std::string &  )

Constructor with a filename.

◆ ~prng_state_manager()

virtual mygsl::prng_state_manager::~prng_state_manager ( )
virtual

Destructor:

Member Function Documentation

◆ add_state()

void mygsl::prng_state_manager::add_state ( const std::string &  label_,
size_t  sz_ 
)

Add storage for the internal state of given size for a PRNG with a given label.

◆ clear()

void mygsl::prng_state_manager::clear ( )

Clear the content of the manager.

◆ default_filename()

const std::string& mygsl::prng_state_manager::default_filename ( )

◆ dump()

void mygsl::prng_state_manager::dump ( std::ostream &  out_ = std::clog) const

Basic print.

◆ empty()

bool mygsl::prng_state_manager::empty ( ) const

Check if the manager has no stored internal state records.

◆ error()

bool mygsl::prng_state_manager::error ( ) const

Check error status.

◆ get_counter()

int mygsl::prng_state_manager::get_counter ( ) const

Get the manager's running counter value.

◆ get_filename()

const std::string& mygsl::prng_state_manager::get_filename ( ) const

Get the backup filename associated to the manager.

◆ get_labels()

void mygsl::prng_state_manager::get_labels ( std::vector< std::string > &  labels_) const

Build an array with all PRNGs' labels stored in the manager.

◆ get_state() [1/2]

const record& mygsl::prng_state_manager::get_state ( const std::string &  label_) const

Get a record that hosts the internal state of a PRNG with a given label (non mutable)

◆ get_state() [2/2]

record& mygsl::prng_state_manager::get_state ( const std::string &  label_)

Get a record that hosts the internal state of a PRNG with a given label (mutable)

◆ has_counter()

bool mygsl::prng_state_manager::has_counter ( ) const

Check if the manager has a running counter value.

◆ has_filename()

bool mygsl::prng_state_manager::has_filename ( ) const

Check if a backup filename is associated to the manager.

◆ has_state()

bool mygsl::prng_state_manager::has_state ( const std::string &  label_) const

Check if the manager stores the internal state of a PRNG with a given label.

◆ increment_counter()

void mygsl::prng_state_manager::increment_counter ( unsigned int  a_increment = 1)

Increment the manager's running counter value by a given value.

◆ invalidate()

void mygsl::prng_state_manager::invalidate ( )

Invalidate :

◆ load()

void mygsl::prng_state_manager::load ( const std::string &  filename_ = "")

Load the content of the manager from a file with given filename.

◆ reset()

void mygsl::prng_state_manager::reset ( )

Reset the manager.

◆ reset_counter()

void mygsl::prng_state_manager::reset_counter ( )

Reset the manager's running counter value.

◆ reset_error()

void mygsl::prng_state_manager::reset_error ( )

Reset error.

◆ reset_filename()

void mygsl::prng_state_manager::reset_filename ( )

Reset the backup filename associated to the manager.

◆ set_counter()

void mygsl::prng_state_manager::set_counter ( int  )

Set the manager's running counter value.

◆ set_filename()

void mygsl::prng_state_manager::set_filename ( const std::string &  = "")

Set the backup filename associated to the manager.

◆ size()

size_t mygsl::prng_state_manager::size ( ) const

Return the number of internal state records.

◆ store()

void mygsl::prng_state_manager::store ( const std::string &  filename_ = "") const

Store the content of the manager in a file with given filename.

Member Data Documentation

◆ INVALID_COUNTER_VALUE

const int mygsl::prng_state_manager::INVALID_COUNTER_VALUE = -1
static

Constant that represents an invalid value for a counter.


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