The Gaudi Framework  v30r3 (a5ef0a68)
RndmGenerators.cpp
Go to the documentation of this file.
1 #define GAUDI_RNDMGENSVC_RNDMGENGENERATORS_CPP
2 
3 // Framework include files
6 #include "GaudiKernel/IRndmGen.h"
8 #include "GaudiKernel/SmartIF.h"
9 
10 // Construct and initialize the generator
12 {
13  StatusCode status = initialize( svc, par );
14  if ( !status.isSuccess() ) {
15  throw GaudiException( "Initialization failed !", "Rndm::Numbers", status );
16  }
17 }
18 
19 // Standard destructor
21 
22 // Initialize the generator
24 {
25  if ( svc && !m_generator ) m_generator = svc->generator( par );
27 }
28 
29 // Initialize the generator
31 {
32  if ( m_generator ) {
35  }
36  return StatusCode::SUCCESS;
37 }
38 
39 #if !defined( GAUDI_V22_API ) || defined( G22_NEW_SVCLOCATOR )
40 // Construct and initialize the generator
42 {
43  StatusCode status = initialize( svc, par );
44  if ( !status.isSuccess() ) {
45  throw GaudiException( "Initialization failed !", "Rndm::Numbers", status );
46  }
47 }
48 
49 // Initialize the generator
51 {
52  return initialize( SmartIF<IRndmGenSvc>( svc ), par );
53 }
54 #endif
constexpr static const auto FAILURE
Definition: StatusCode.h:88
Define general base for Gaudi exception.
virtual ~Numbers()
Standard destructor.
virtual StatusCode finalize()=0
Finalize the generator.
bool isSuccess() const
Definition: StatusCode.h:287
SmartIF< IRndmGen > m_generator
Pointer to random number generator.
virtual StatusCode generator(const IRndmGen::Param &par, IRndmGen *&refpGen)=0
Add a Generator factory.
virtual StatusCode finalize()
Finalization.
Random Generator service interface definition Definition of a interface for a service to access rando...
Definition: IRndmGenSvc.h:35
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:51
constexpr static const auto SUCCESS
Definition: StatusCode.h:87
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:165
virtual StatusCode initialize(const SmartIF< IRndmGenSvc > &svc, const IRndmGen::Param &par)
Initialization.
void reset(TYPE *ptr=nullptr)
Set the internal pointer to the passed one disposing of the old one.
Definition: SmartIF.h:92
Numbers()=default
Standard constructor.