00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GAUDI_RANDOMGENSVC_RNDMGENSVC_H
00009 #define GAUDI_RANDOMGENSVC_RNDMGENSVC_H 1
00010
00011
00012 #include <vector>
00013
00014
00015 #include "GaudiKernel/Service.h"
00016 #include "GaudiKernel/ISerialize.h"
00017 #include "GaudiKernel/IRndmGen.h"
00018 #include "GaudiKernel/IRndmEngine.h"
00019 #include "GaudiKernel/IRndmGenSvc.h"
00020
00021
00022 template <class TYPE> class SvcFactory;
00023 class IRndmGenFactory;
00024 class IMessageSvc;
00025 class IFactory;
00026
00027
00052 class RndmGenSvc : public Service, virtual public IRndmGenSvc, virtual public IRndmEngine, virtual public ISerialize {
00053 private:
00055 friend class SvcFactory<RndmGenSvc>;
00056
00058 typedef std::vector<const IRndmGenFactory*> FactoryContainer;
00060 mutable IRndmEngine* m_engine;
00062 mutable ISerialize* m_serialize;
00064 FactoryContainer m_factories;
00066 std::string m_engineName;
00067 protected:
00069 RndmGenSvc(const std::string& name, ISvcLocator* svc);
00071 virtual ~RndmGenSvc();
00072
00074 StatusCode createGenerator(const IRndmGenFactory* pFactory, const IRndmGen::Param& par, IRndmGen*& refpGen);
00075
00076 const IRndmGenFactory* factory(const IID& type);
00077
00078 StatusCode requestFactory(const IID& type, const IRndmGenFactory*& refpFactory);
00079
00080 public:
00082 StatusCode queryInterface(const IID& riid, void** ppvInterface);
00084 virtual StatusCode initialize();
00086 virtual StatusCode finalize();
00088
00089 virtual StreamBuffer& serialize(StreamBuffer& str);
00091 virtual StreamBuffer& serialize(StreamBuffer& str) const;
00093 virtual IRndmEngine* engine();
00095 virtual StatusCode addFactory(const IRndmGenFactory* fac);
00097 virtual StatusCode removeFactory(const IID& type);
00099 virtual StatusCode generator(const IRndmGen::Param& par, IRndmGen*& refpGen);
00101 virtual double rndm() const;
00108 virtual StatusCode rndmArray( std::vector<double>& array, long howmany, long start = 0) const;
00110 virtual StatusCode setSeeds(const std::vector<long>& seeds);
00112 virtual StatusCode seeds(std::vector<long>& seeds) const;
00113 };
00114
00115 #endif // GAUDI_RANDOMGENSVC_RNDMGENSVC_H