1 #ifndef GAUDIHIVE_HIVENUMBERS_H 2 #define GAUDIHIVE_HIVENUMBERS_H 12 #include "tbb/spin_rw_mutex.h" 52 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR ) 61 operator bool()
const {
return m_generator != 0; }
65 double pop() {
return this->shoot(); }
69 if ( 0 != m_generator ) {
70 if ( m_buffer_index == 0 ) {
71 this->shootArray( m_buffer, m_buffer_size );
72 m_buffer_index = m_buffer_size - 1;
74 const double number = m_buffer[m_buffer_index];
83 if ( 0 != m_generator ) {
86 HiveNumbersMutex::scoped_lock lock( m_genMutex );
97 #endif // GAUDIHIVE_HIVENumbers_H const unsigned int m_buffer_size
constexpr static const auto FAILURE
tbb::spin_rw_mutex_v3 HiveNumbersMutex
Definition of a interface for a generic random number generators.
std::vector< double > m_buffer
IRndmGen * m_generator
Pointer to random number generator.
Random Generator service interface definition Definition of a interface for a service to access rando...
This class is used for returning status codes from appropriate routines.
double operator()()
Operator () for the use within STL.
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
StatusCode shootArray(std::vector< double > &array, long num, long start=0)
Pop a new number from the buffer.
unsigned int m_buffer_index
virtual StatusCode shootArray(std::vector< double > &array, long howmany, long start=0) const =0
Multiple shots returning vector with random number according to specified distribution.
double pop()
Pop a new number from the buffer.
static HiveNumbersMutex m_genMutex
double shoot()
Pop a new number from the buffer.