All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RndmGenSvc.h
Go to the documentation of this file.
1 //====================================================================
2 // Random Generator service definition
3 //--------------------------------------------------------------------
4 //
5 // Package : Gaudi/RndmGen ( The LHCb Offline System)
6 // Author : M.Frank
7 //====================================================================
8 #ifndef GAUDI_RANDOMGENSVC_RNDMGENSVC_H
9 #define GAUDI_RANDOMGENSVC_RNDMGENSVC_H 1
10 
11 // STL include files
12 #include <vector>
13 
14 // Framework include files
15 #include "GaudiKernel/Service.h"
16 #include "GaudiKernel/ISerialize.h"
17 #include "GaudiKernel/IRndmGen.h"
20 
21 // Forward declarations
22 class IRndmGenFactory;
23 class IMessageSvc;
24 
49 class RndmGenSvc : public extends3<Service, IRndmGenSvc, IRndmEngine, ISerialize> {
50 private:
56  std::string m_engineName;
57 public:
59  RndmGenSvc(const std::string& name, ISvcLocator* svc);
61  virtual ~RndmGenSvc();
62 public:
64  virtual StatusCode initialize();
66  virtual StatusCode finalize();
68  virtual StreamBuffer& serialize(StreamBuffer& str);
71  virtual StreamBuffer& serialize(StreamBuffer& str) const;
73  virtual IRndmEngine* engine();
75  virtual StatusCode generator(const IRndmGen::Param& par, IRndmGen*& refpGen);
77  virtual double rndm() const;
84  virtual StatusCode rndmArray( std::vector<double>& array, long howmany, long start = 0) const;
86  virtual StatusCode setSeeds(const std::vector<long>& seeds);
88  virtual StatusCode seeds(std::vector<long>& seeds) const;
89 };
90 
91 #endif // GAUDI_RANDOMGENSVC_RNDMGENSVC_H
RndmGenSvc(const std::string &name, ISvcLocator *svc)
Standard Service constructor.
Definition: RndmGenSvc.cpp:36
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:26
virtual StatusCode seeds(std::vector< long > &seeds) const
Allow to get seeds.
Definition: RndmGenSvc.cpp:172
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:40
Definition of a interface for a generic random number generators.
Definition: IRndmGen.h:36
std::string m_engineName
Engine name.
Definition: RndmGenSvc.h:56
virtual double rndm() const
Single shot returning single random number.
Definition: RndmGenSvc.cpp:143
virtual StatusCode initialize()
Service override: initialization.
Definition: RndmGenSvc.cpp:47
virtual StatusCode rndmArray(std::vector< double > &array, long howmany, long start=0) const
Multiple shots returning vector with flat random numbers.
Definition: RndmGenSvc.cpp:156
Base class used to extend a class implementing other interfaces.
Definition: extends.h:140
virtual StatusCode setSeeds(const std::vector< long > &seeds)
Allow to set new seeds.
Definition: RndmGenSvc.cpp:164
Random Generator service definition.
Definition: RndmGenSvc.h:49
virtual StatusCode generator(const IRndmGen::Param &par, IRndmGen *&refpGen)
Retrieve a valid generator from the service.
Definition: RndmGenSvc.cpp:125
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode finalize()
Service override: finalization.
Definition: RndmGenSvc.cpp:85
The IMessage is the interface implemented by the message service.
Definition: IMessageSvc.h:57
virtual IRndmEngine * engine()
Retrieve engine.
Definition: RndmGenSvc.cpp:120
virtual ~RndmGenSvc()
Standard Service destructor.
Definition: RndmGenSvc.cpp:43
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
IRndmEngine * m_engine
Random number engine.
Definition: RndmGenSvc.h:52
virtual StreamBuffer & serialize(StreamBuffer &str)
IRndmGenSvc interface implementation.
Definition: RndmGenSvc.cpp:100
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
Definition of a interface for a generic random number generator giving randomly distributed numbers i...
Definition: IRndmEngine.h:20
virtual StatusCode start()
Start (from INITIALIZED to RUNNING).
Definition: Service.cpp:158
Object serialization interface definition.
Definition: ISerialize.h:18
ISerialize * m_serialize
Serialization interface of random number engine.
Definition: RndmGenSvc.h:54