Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:00:32

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations *
0003 *                                                                                   *
0004 * This software is distributed under the terms of the Apache version 2 licence,     *
0005 * copied verbatim in the file "LICENSE".                                            *
0006 *                                                                                   *
0007 * In applying this licence, CERN does not waive the privileges and immunities       *
0008 * granted to it by virtue of its status as an Intergovernmental Organization        *
0009 * or submit itself to any jurisdiction.                                             *
0010 \***********************************************************************************/
0011 #ifndef GAUDIKERNEL_IRNDMGENSVC_H
0012 #define GAUDIKERNEL_IRNDMGENSVC_H
0013 
0014 // STL include files
0015 #include <string>
0016 #include <vector>
0017 
0018 // Framework include files
0019 #include "GaudiKernel/IRndmGen.h"
0020 #include "GaudiKernel/IService.h"
0021 #include "GaudiKernel/SmartIF.h"
0022 
0023 // Forward declarations
0024 class IRndmGen;
0025 class StreamBuffer;
0026 class IRndmEngine;
0027 class IRndmGenFactory;
0028 
0029 /** @class IRndmGenSvc IRndmGenSvc.h GaudiKernel/IRndmGenSvc.h
0030 
0031     Random Generator service interface definition
0032     Definition of a interface for a service to access
0033     random generators according to predefined distributions:
0034 
0035     The Random Generator creates proper instances of requested
0036     random generators and delivers them to the user.
0037 
0038     On request the service dumps the type and state of the random
0039     number engine to a StreamBuffer object allowing to save and to restore
0040     the exact state of the random number generator.
0041 
0042     @author  M.Frank
0043     @version 1.0
0044 */
0045 class GAUDI_API IRndmGenSvc : virtual public IService {
0046 public:
0047   /// InterfaceID
0048   DeclareInterfaceID( IRndmGenSvc, 2, 1 );
0049   /** Retrieve engine.
0050       @return pointer to random number engine
0051   */
0052   virtual IRndmEngine* engine() = 0;
0053 
0054   /** Add a Generator factory.
0055       @param fac Pointer to factory to be added
0056       @return StatusCode indicating success or failure.
0057   */
0058   virtual StatusCode generator( const IRndmGen::Param& par, IRndmGen*& refpGen ) = 0;
0059 
0060   SmartIF<IRndmGen> generator( const IRndmGen::Param& par ) {
0061     IRndmGen* gen = nullptr;
0062     ;
0063     generator( par, gen ).ignore();
0064     auto r = SmartIF<IRndmGen>{ gen };
0065     if ( gen ) { gen->release(); }
0066     return r;
0067   }
0068 };
0069 
0070 #endif // GAUDIKERNEL_IRNDMGENSVC_H