Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4PersistencyManagerT
0027 //
0028 // Class Description:
0029 //
0030 // Template class of G4PersistencyManager for late binding.
0031 
0032 // Author: Youhei Morita, 10.08.2001
0033 // --------------------------------------------------------------------
0034 #ifndef G4PERSISTENCYMANAGERT_HH
0035 #define G4PERSISTENCYMANAGERT_HH 1
0036 
0037 #include "G4PersistencyCenter.hh"
0038 #include "G4PersistencyManager.hh"
0039 
0040 template <class T>
0041 class G4PersistencyManagerT : public G4PersistencyManager
0042 {
0043   public:
0044 
0045     G4PersistencyManagerT(G4PersistencyCenter* pc, const G4String& n)
0046       : G4PersistencyManager(pc, n)
0047     {
0048       if(m_verbose > 2)
0049       {
0050         G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
0051                << n << "\"" << G4endl;
0052       }
0053       G4PersistencyCenter::GetPersistencyCenter()
0054         ->RegisterPersistencyManager(this);
0055     }
0056       // Constructor
0057 
0058     ~G4PersistencyManagerT() {}
0059       // Destructor
0060 
0061     G4PersistencyManager* Create()
0062     {
0063       pm = new T(f_pc, GetName());
0064       return pm;
0065     }
0066       // Create a new persistency manager
0067 
0068     void Delete()
0069     {
0070       if(pm != nullptr) delete pm;
0071     }
0072       // Delete a persistency mamanger
0073 
0074     G4VPEventIO* EventIO()
0075     {
0076       if(pm != nullptr)
0077         return pm->EventIO();
0078       else
0079         return nullptr;
0080     }
0081       // Returns the current event I/O handling manager
0082 
0083     G4VPHitIO* HitIO()
0084     {
0085       if(pm != nullptr)
0086         return pm->HitIO();
0087       else
0088         return nullptr;
0089     }
0090       // Returns the current hit I/O handling manager
0091 
0092     G4VPDigitIO* DigitIO()
0093     {
0094       if(pm != nullptr)
0095         return pm->DigitIO();
0096       else
0097         return nullptr;
0098     }
0099       // Returns the current digit I/O handling manager
0100 
0101     G4VHepMCIO* HepMCIO()
0102     {
0103       if(pm != nullptr)
0104         return pm->HepMCIO();
0105       else
0106         return nullptr;
0107     }
0108       // Returns the current digit I/O handling manager
0109 
0110     G4VMCTruthIO* MCTruthIO()
0111     {
0112       if(pm != nullptr)
0113         return pm->MCTruthIO();
0114       else
0115         return nullptr;
0116     }
0117       // Returns the current digit I/O handling manager
0118 
0119     G4VTransactionManager* TransactionManager()
0120     {
0121       if(pm != nullptr)
0122         return pm->TransactionManager();
0123       else
0124         return nullptr;
0125     }
0126       // Returns the current transaction manager
0127 
0128     void Initialize() {}
0129       // Initialize the persistency package.
0130 
0131     void SetVerboseLevel(G4int v)
0132     {
0133       if(pm != nullptr)
0134         return pm->SetVerboseLevel();
0135       else
0136         return nullptr;
0137     }
0138       // Sets the verbose level to the persistency manager
0139 
0140   private:
0141 
0142     G4PersistencyManager* pm = nullptr;
0143 };
0144 
0145 #endif