Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:04

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4CrossSectionFactoryRegistry class
0027 //
0028 // This class implements a regsitry for cross-section factories
0029 // It can be used to access factories to instantiate cross-section
0030 // datasets on demand. This is intended to be shared among threads
0031 // see G4CrossSectionFactory class: while G4CrossSectionDataSetRegistry
0032 // is per-thread (G4ThreadLocal), this class is shared, so only one instance
0033 // of each factory exists for each application. This is needed because factories
0034 // rely on global variables to register themselves in this registry.
0035 // Note: use of this class is thread-safe.
0036 //
0037 // History:
0038 // 1-Apr-2013: A. Dotti, first implementation
0039 #ifndef G4CROSSSECTIONFACTORYREGISTRY_HH
0040 #define G4CROSSSECTIONFACTORYREGISTRY_HH
0041 
0042 #include <ostream>
0043 #include <G4String.hh>
0044 #include <map>
0045 
0046 class G4VBaseXSFactory;
0047 
0048 class G4CrossSectionFactoryRegistry
0049 {
0050     friend std::ostream& operator<<(std::ostream&, const G4CrossSectionFactoryRegistry&);
0051 private:
0052     std::map<G4String, G4VBaseXSFactory*> factories;
0053     static G4CrossSectionFactoryRegistry* instance; //Note this is shared among threads
0054     G4CrossSectionFactoryRegistry();
0055     G4CrossSectionFactoryRegistry(const G4CrossSectionFactoryRegistry& );
0056     G4CrossSectionFactoryRegistry& operator=(const G4CrossSectionFactoryRegistry&);
0057     //Disable copy-ctr and assignement operator
0058 public:
0059     static G4CrossSectionFactoryRegistry* Instance();
0060     G4VBaseXSFactory* GetFactory( const G4String& name , G4bool abortIfNotFound = true) const;
0061     //Search a cross-section factory by name, by default rise an exception if factory is not found 
0062     void Register( const G4String& name , G4VBaseXSFactory* factory );
0063 };
0064 
0065 std::ostream&  operator<<(std::ostream& msg, const G4CrossSectionFactoryRegistry& rhs);
0066 
0067 #endif // G4CROSSSECTIONFACTORYREGISTRY_HH