31 #ifndef MYGSL_PRNG_STATE_MANAGER_H 32 #define MYGSL_PRNG_STATE_MANAGER_H 1 41 #include <boost/cstdint.hpp> 125 void get_labels (std::vector<std::string> & labels_)
const;
128 bool has_state (
const std::string & label_)
const;
131 void add_state (
const std::string & label_,
size_t sz_);
148 size_t size ()
const;
154 void store (
const std::string & filename_ =
"")
const;
157 void load (
const std::string & filename_ =
"");
160 void dump (std::ostream & out_ = std::clog)
const;
170 void _force_error(
int e)
const;
175 std::string _filename_;
183 #endif // MYGSL_PRNG_STATE_MANAGER_H virtual ~record()
Destructor.
void increment_counter(unsigned int a_increment=1)
Increment the manager's running counter value by a given value.
std::map< std::string, record > dict_type
An alias for the embedded dictionary container class.
Definition: prng_state_manager.h:77
void invalidate()
Invalidate :
record()
Default constructor.
const std::string & default_filename()
prng_state_manager()
Default constructor.
Internal record that store the internal state of a PRNG.
Definition: prng_state_manager.h:56
static const int INVALID_COUNTER_VALUE
Constant that represents an invalid value for a counter.
Definition: prng_state_manager.h:81
bool has_state(const std::string &label_) const
Check if the manager stores the internal state of a PRNG with a given label.
void reset_error()
Reset error.
size_t size() const
Return the number of internal state records.
A manager that can store the internal states associated to a set of PRNGs addressed with some labels.
Definition: prng_state_manager.h:50
void clear()
Clear the content of the manager.
void set_counter(int)
Set the manager's running counter value.
std::vector< unsigned char > state_buffer_type
Definition: rng.h:60
mygsl::rng::state_buffer_type state_buffer
Buffer to store a PRNG internal state.
Definition: prng_state_manager.h:72
virtual ~prng_state_manager()
Destructor:
bool has_counter() const
Check if the manager has a running counter value.
void set_filename(const std::string &="")
Set the backup filename associated to the manager.
const record & get_state(const std::string &label_) const
Get a record that hosts the internal state of a PRNG with a given label (non mutable)
void load(const std::string &filename_="")
Load the content of the manager from a file with given filename.
Top-level namespace of the Bayeux/mygsl module library.
Definition: base_decay_driver.h:47
void reset_counter()
Reset the manager's running counter value.
static const size_t DEFAULT_BUFFER_SIZE
Default size of a buffer used to store PRNG's internal state.
Definition: prng_state_manager.h:61
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.
const std::string & get_filename() const
Get the backup filename associated to the manager.
bool has_filename() const
Check if a backup filename is associated to the manager.
int get_counter() const
Get the manager's running counter value.
bool empty() const
Check if the manager has no stored internal state records.
void dump(std::ostream &out_=std::clog) const
Basic print.
void get_labels(std::vector< std::string > &labels_) const
Build an array with all PRNGs' labels stored in the manager.
void reset_filename()
Reset the backup filename associated to the manager.
void reset()
Reset the manager.
void store(const std::string &filename_="") const
Store the content of the manager in a file with given filename.
bool error() const
Check error status.