Gaudi Framework, version v25r2
Home
Generated: Wed Jun 4 2014
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
.cern.ch
sw
Gaudi
releases
GAUDI
GAUDI_v25r2
GaudiKernel
src
Lib
RndmGenerators.cpp
Go to the documentation of this file.
1
// $Id: RndmGenerators.cpp,v 1.7 2006/09/13 15:25:15 hmd Exp $
2
#define GAUDI_RNDMGENSVC_RNDMGENGENERATORS_CPP
3
4
// Framework include files
5
#include "
GaudiKernel/SmartIF.h
"
6
#include "
GaudiKernel/IRndmGen.h
"
7
#include "
GaudiKernel/IRndmGenSvc.h
"
8
#include "
GaudiKernel/RndmGenerators.h
"
9
#include "
GaudiKernel/GaudiException.h
"
10
11
// Standard constructor
12
Rndm::Numbers::Numbers
()
13
: m_generator(0)
14
{
15
}
16
17
// Copy constructor
18
Rndm::Numbers::Numbers
(
const
Rndm::Numbers
& copy )
19
: m_generator(copy.m_generator) {
20
if
( 0 !=
m_generator
) {
21
m_generator
->
addRef
();
22
}
23
}
24
25
// Construct and initialize the generator
26
Rndm::Numbers::Numbers
(
const
SmartIF<IRndmGenSvc>
& svc,
const
IRndmGen::Param
&
par
)
27
: m_generator(0)
28
{
29
StatusCode
status =
initialize
(svc, par);
30
if
(!status.
isSuccess
()) {
31
throw
GaudiException
(
"Initialization failed !"
,
"Rndm::Numbers"
, status);
32
}
33
}
34
35
// Standard destructor
36
Rndm::Numbers::~Numbers
() {
37
finalize().ignore();
38
}
39
40
// Initialize the generator
41
StatusCode
Rndm::Numbers::initialize
(
const
SmartIF<IRndmGenSvc>
& svc,
42
const
IRndmGen::Param
&
par
) {
43
if
( svc.
isValid
() && 0 == m_generator ) {
46
return
const_cast<
IRndmGenSvc
*
>
(svc.
get
())->generator( par, m_generator );
47
}
48
return
StatusCode::FAILURE
;
49
}
50
51
// Initialize the generator
52
StatusCode
Rndm::Numbers::finalize
() {
53
if
( 0 != m_generator ) {
54
m_generator->finalize().
ignore
();
55
m_generator->release();
56
m_generator = 0;
57
}
58
return
StatusCode::SUCCESS
;
59
}
60
61
#if !defined(GAUDI_V22_API) || defined(G22_NEW_SVCLOCATOR)
62
// Construct and initialize the generator
63
Rndm::Numbers::Numbers
(
IRndmGenSvc
* svc,
const
IRndmGen::Param
&
par
)
64
: m_generator(0)
65
{
66
StatusCode
status =
initialize
(svc, par);
67
if
(!status.
isSuccess
()) {
68
throw
GaudiException
(
"Initialization failed !"
,
"Rndm::Numbers"
, status);
69
}
70
}
71
72
// Initialize the generator
73
StatusCode
Rndm::Numbers::initialize
(
IRndmGenSvc
* svc,
const
IRndmGen::Param
&
par
) {
74
return
initialize
(
SmartIF<IRndmGenSvc>
(svc), par);
75
}
76
#endif
Generated at Wed Jun 4 2014 14:48:57 for Gaudi Framework, version v25r2 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004