#ifndef _fwk_RandomEngineRegistry_h_ #define _fwk_RandomEngineRegistry_h_ /** \file Registry for predefined random stream engine \author Matej Horvat \version $Id: RandomEngineRegistry.h 17269 2010-07-08 07:59:10Z dembinski $ \date 13 Nov 2006 */ static const char CVSId_fwk_RandomEngineRegistry[] = "$Id: RandomEngineRegistry.h 17269 2010-07-08 07:59:10Z dembinski $"; #include #include #include #include #include namespace fwk { /** \class RandomEngineRegistry RandomEngineRegistry.h fwk/RandomEngineRegistry.h \brief Collection of pre-defined random engines This class registers the pre-defined random engines and provides symbolic names for them. The class is implemented as a singleton. \author Matej Horvat \date 13 Oct 2006 \ingroup math det_interface */ class RandomEngineRegistry : public utl::Singleton { public: /// Identifiers for all pre-defined random engines enum RandomEngineID { /// Detector engine eDetector = 0, /// Physics engine ePhysics = 1 }; /** \class InvalidRandomEngineException \brief Base class for exceptions in the RandomEngineRegistry \ingroup math det_interface */ class InvalidRandomEngineException : public utl::AugerException { public: /// Construct random engine exception with message InvalidRandomEngineException(std::string message = std::string()) : AugerException(message) { } /// Retrieve verbose exception name virtual std::string GetExceptionName() const { return "Invalid random engine in registry exception"; } }; /// Get a pre-defined random engine utl::RandomEngine& Get(const RandomEngineID id = eDetector); private: ~RandomEngineRegistry(); /// Initialise the registry void Init(); /// Register an engine void RegisterOne(const RandomEngineID id, utl::RandomEngine* const engine); void GenerateSeeds(long* const seed, const int n) const; protected: typedef std::map Registry; Registry* fRegistry; friend class utl::Singleton; }; } #endif // Configure (x)emacs for this file ... // Local Variables: // mode: c++ // compile-command: "make -C .. -k" // End: