BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
ROOT::Math::GSLRngROOTWrapper< Engine > Struct Template Reference

Description

template<class Engine>
struct ROOT::Math::GSLRngROOTWrapper< Engine >

Definition at line 26 of file GSLRngROOTWrapper.h.

Public Member Functions

 GSLRngROOTWrapper ()
 
 ~GSLRngROOTWrapper ()
 

Static Public Member Functions

static void Free (void *p)
 
static unsigned long IntRndm (void *p)
 
static unsigned long Max ()
 
static unsigned long Min ()
 
static std::string Name ()
 
static double Rndm (void *p)
 
static void Seed (void *p, unsigned long seed)
 
static size_t Size ()
 

Public Attributes

Engine * fEngine
 
bool fFirst
 

Constructor & Destructor Documentation

◆ GSLRngROOTWrapper()

template<class Engine >
ROOT::Math::GSLRngROOTWrapper< Engine >::GSLRngROOTWrapper ( )
inline

◆ ~GSLRngROOTWrapper()

template<class Engine >
ROOT::Math::GSLRngROOTWrapper< Engine >::~GSLRngROOTWrapper ( )
inline

Definition at line 37 of file GSLRngROOTWrapper.h.

37  {
38  if (fEngine) delete fEngine;
39  }

References ROOT::Math::GSLRngROOTWrapper< Engine >::fEngine.

Member Function Documentation

◆ Free()

template<class Engine >
static void ROOT::Math::GSLRngROOTWrapper< Engine >::Free ( void *  p)
inlinestatic

Definition at line 61 of file GSLRngROOTWrapper.h.

61  {
62  auto wr = ((GSLRngROOTWrapper *) p);
63  if (wr->fEngine) delete wr->fEngine;
64  wr->fFirst = true;
65  //printf("deleting gsl mixmax\n");
66  }

◆ IntRndm()

template<class Engine >
static unsigned long ROOT::Math::GSLRngROOTWrapper< Engine >::IntRndm ( void *  p)
inlinestatic

Definition at line 44 of file GSLRngROOTWrapper.h.

44  {
45  return ((GSLRngROOTWrapper *) p)->fEngine->IntRndm();
46  }

◆ Max()

template<class Engine >
static unsigned long ROOT::Math::GSLRngROOTWrapper< Engine >::Max ( )
inlinestatic

Definition at line 68 of file GSLRngROOTWrapper.h.

68 { return Engine::MaxInt(); }

◆ Min()

template<class Engine >
static unsigned long ROOT::Math::GSLRngROOTWrapper< Engine >::Min ( )
inlinestatic

Definition at line 69 of file GSLRngROOTWrapper.h.

69 { return Engine::MinInt(); }

◆ Name()

template<class Engine >
static std::string ROOT::Math::GSLRngROOTWrapper< Engine >::Name ( )
inlinestatic

Definition at line 71 of file GSLRngROOTWrapper.h.

71 { return std::string("GSL_")+Engine::Name(); }

◆ Rndm()

template<class Engine >
static double ROOT::Math::GSLRngROOTWrapper< Engine >::Rndm ( void *  p)
inlinestatic

Definition at line 41 of file GSLRngROOTWrapper.h.

41  {
42  return ((GSLRngROOTWrapper *) p)->fEngine->operator()();
43  }

◆ Seed()

template<class Engine >
static void ROOT::Math::GSLRngROOTWrapper< Engine >::Seed ( void *  p,
unsigned long  seed 
)
inlinestatic

Definition at line 47 of file GSLRngROOTWrapper.h.

47  {
48  //if (fFirst) {
49  // this will be a memory leak because I have no way to delete
50  // the engine class
51  auto wr = ((GSLRngROOTWrapper *) p);
52  if (wr->fFirst) {
53  //printf("calling the seed function with %d on %p . Build Engine class \n",seed,p);
54  wr->fEngine = new Engine();
55  wr->fFirst = false;
56  }
57  // the seed cannot be zero (GSL calls at the beginning with seed 0)
58  if (seed == 0) return;
59  ((GSLRngROOTWrapper *) p)->fEngine->SetSeed(seed);
60  }

◆ Size()

template<class Engine >
static size_t ROOT::Math::GSLRngROOTWrapper< Engine >::Size ( )
inlinestatic

Definition at line 70 of file GSLRngROOTWrapper.h.

70 { return sizeof( GSLRngROOTWrapper<Engine>); }

Member Data Documentation

◆ fEngine

◆ fFirst

template<class Engine >
bool ROOT::Math::GSLRngROOTWrapper< Engine >::fFirst

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