//////////////////////////////////////////////////////////////////////// /// \class RAT::PDFs::PDFFactory /// /// \brief Factory for Just In Time creation of PDFs /// /// \author name Phil G Jones /// \author Matt Mottram < m.mottram@qmul.ac.uk> -- contact person /// /// REVISION HISTORY:\n /// 26/04/2011 : P G Jones - New file \n /// 2014-07-17 : P G Jones - Add register method.\n /// /// \details Allows PDFs to be newed by string name, PDF is created once /// then stored. This is a singleton class. /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_PDF_PDFFactory_ #define __RAT_PDF_PDFFactory_ #include #include #include #include namespace RAT { namespace DS { class Run; } namespace PDFs { class PDFFactory { public: /// Returns the only instance of the class inline static PDFFactory* Get(); /// Register a pdf in the factory /// /// An example call is Register( MyPDF::GetName(), new Alloc()) /// /// @param[in] name of the pdf /// @param[in] allocator instance of an Alloc with the correct pdf type void Register( std::string name, AllocBase* allocator ); /// Returns the PDF, requires DS aspects for initialising PDFs PDF* GetPDF( const std::string& name ); private: /// Private constructor to prevent instantiation PDFFactory(); Factory fFactory; ///< PDF factory, contains allocators for PDFs }; inline PDFFactory* PDFFactory::Get() { static PDFFactory pdfFactory; return &pdfFactory; } } //::PDF } //::RAT #endif