Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Gsl_Compatible_Rng_Owner Class Reference

A Gsl_Compatible_Rng in dynamic memory, so that what holds it grows only by a pointer, as with the gsl_rng of before. More...

#include <ah-random.H>

Collaboration diagram for Aleph::Gsl_Compatible_Rng_Owner:
[legend]

Classes

struct  Block
 
struct  Free_Block
 

Public Member Functions

 Gsl_Compatible_Rng_Owner () noexcept=default
 An owner without a generator, as after a move; it can take one by a move or a swap.
 
 Gsl_Compatible_Rng_Owner (const unsigned long s)
 Makes a generator seeded with s, as Gsl_Compatible_Rng(s).
 
 Gsl_Compatible_Rng_Owner (const Gsl_Compatible_Rng_Owner &)=delete
 
Gsl_Compatible_Rng_Owner & operator= (const Gsl_Compatible_Rng_Owner &)=delete
 
 Gsl_Compatible_Rng_Owner (Gsl_Compatible_Rng_Owner &&o) noexcept=default
 Takes the generator of o, which keeps none.
 
Gsl_Compatible_Rng_Owner & operator= (Gsl_Compatible_Rng_Owner &&o) noexcept=default
 Frees the generator, and takes that of o, which keeps none.
 
void swap (Gsl_Compatible_Rng_Owner &o) noexcept
 Swaps the generators, with their gsl_rng.
 
Gsl_Compatible_Rng & operator* () const noexcept
 The generator.
 
Gsl_Compatible_Rng * operator-> () const noexcept
 The generator.
 
Gsl_Compatible_Rng * get () const noexcept
 The generator, or nullptr after a move.
 

Private Attributes

std::unique_ptr< Block, Free_Block > block
 

Detailed Description

A Gsl_Compatible_Rng in dynamic memory, so that what holds it grows only by a pointer, as with the gsl_rng of before.

It is the generator of the classes that draw always from the Mersenne Twister, as those that make random graphs, and the one that a Random_Source makes when it is asked for it.

It moves and swaps with its holder; it is not copied, since each holder makes its own generator. While ALEPH_WITH_GSL is 1, gsl() gives a gsl_rng whose state is the generator, for the deprecated gsl_rng_object() of the structures: the functions of GSL on it act on the generator of the structure.

Definition at line 493 of file ah-random.H.

Constructor & Destructor Documentation

◆ Gsl_Compatible_Rng_Owner() [1/4]

Aleph::Gsl_Compatible_Rng_Owner::Gsl_Compatible_Rng_Owner ( )
defaultnoexcept

An owner without a generator, as after a move; it can take one by a move or a swap.

◆ Gsl_Compatible_Rng_Owner() [2/4]

Aleph::Gsl_Compatible_Rng_Owner::Gsl_Compatible_Rng_Owner ( const unsigned long  s)
inlineexplicit

Makes a generator seeded with s, as Gsl_Compatible_Rng(s).

Parameters
[in]sThe seed.
Exceptions
std::bad_allocIf there is not enough memory: the generator is in memory of malloc(), as the gsl_rng of GSL was.

Definition at line 543 of file ah-random.H.

References block.

◆ Gsl_Compatible_Rng_Owner() [3/4]

Aleph::Gsl_Compatible_Rng_Owner::Gsl_Compatible_Rng_Owner ( const Gsl_Compatible_Rng_Owner &  )
delete

◆ Gsl_Compatible_Rng_Owner() [4/4]

Aleph::Gsl_Compatible_Rng_Owner::Gsl_Compatible_Rng_Owner ( Gsl_Compatible_Rng_Owner &&  o)
defaultnoexcept

Takes the generator of o, which keeps none.

Member Function Documentation

◆ get()

◆ operator*()

Gsl_Compatible_Rng & Aleph::Gsl_Compatible_Rng_Owner::operator* ( ) const
inlinenoexcept

The generator.

Definition at line 572 of file ah-random.H.

References block.

◆ operator->()

Gsl_Compatible_Rng * Aleph::Gsl_Compatible_Rng_Owner::operator-> ( ) const
inlinenoexcept

The generator.

Definition at line 575 of file ah-random.H.

References block.

◆ operator=() [1/2]

Gsl_Compatible_Rng_Owner & Aleph::Gsl_Compatible_Rng_Owner::operator= ( const Gsl_Compatible_Rng_Owner &  )
delete

◆ operator=() [2/2]

Gsl_Compatible_Rng_Owner & Aleph::Gsl_Compatible_Rng_Owner::operator= ( Gsl_Compatible_Rng_Owner &&  o)
defaultnoexcept

Frees the generator, and takes that of o, which keeps none.

Parameters
[in]oThe other one.
Returns
*this.

◆ swap()

void Aleph::Gsl_Compatible_Rng_Owner::swap ( Gsl_Compatible_Rng_Owner &  o)
inlinenoexcept

Swaps the generators, with their gsl_rng.

Parameters
[in]oThe other one.

Definition at line 569 of file ah-random.H.

References block.

Referenced by Aleph::Karger_Min_Cut< GT, SA >::Karger_Min_Cut(), and Aleph::Random_Source::swap().

Member Data Documentation

◆ block

std::unique_ptr<Block, Free_Block> Aleph::Gsl_Compatible_Rng_Owner::block
private

Definition at line 530 of file ah-random.H.

Referenced by Gsl_Compatible_Rng_Owner(), get(), operator*(), operator->(), and swap().


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