G4PersistencyManagerT.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // File: G4PersistencyManagerT.hh
00027 //
00028 // History:
00029 //   '01.08.10  Youhei Morita  Initial creation (with "fadsclass3")
00030 
00031 #ifndef PERSISTENCY_MANAGER_T_HH
00032 #define PERSISTENCY_MANAGER_T_HH 1
00033 
00034 #include "G4PersistencyCenter.hh"
00035 
00036 // Class inherited:
00037 #include "G4PersistencyManager.hh"
00038 
00039 // Class Description:
00040 //   Template class of G4PersistencyManager for late binding
00041 
00042 template <class T> class G4PersistencyManagerT
00043  : public G4PersistencyManager
00044 {
00045     public: // With description
00046       G4PersistencyManagerT(G4PersistencyCenter* pc, std::string n)
00047        : G4PersistencyManager(pc, n), pm(0)
00048       {
00049          if ( m_verbose > 2 ) {
00050            G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
00051                   << n << "\"" << G4endl;
00052          }
00053          G4PersistencyCenter::GetPersistencyCenter()->
00054                        RegisterPersistencyManager(this);
00055       }
00056       // Constructor
00057 
00058       ~G4PersistencyManagerT() {};
00059       // Destructor
00060 
00061     public: // With description
00062       G4PersistencyManager* Create()
00063       {
00064         pm = new T(f_pc, GetName());
00065         return pm;
00066       }
00067       // Create a new persistency manager
00068 
00069       void Delete() { if (pm!=0) delete pm; };
00070       // Delete a persistency mamanger
00071 
00072       G4VPEventIO* EventIO()
00073       {
00074         if (pm) return pm->EventIO();
00075         else    return 0;
00076       };
00077       // Returns the current event I/O handling manager
00078 
00079       G4VPHitIO* HitIO()
00080       {
00081         if (pm) return pm->HitIO();
00082         else    return 0;
00083       };
00084       // Returns the current hit I/O handling manager
00085 
00086       G4VPDigitIO* DigitIO()
00087       {
00088         if (pm) return pm->DigitIO();
00089         else    return 0;
00090       };
00091       // Returns the current digit I/O handling manager
00092 
00093       G4VHepMCIO* HepMCIO()
00094       {
00095         if (pm) return pm->HepMCIO();
00096         else    return 0;
00097       };
00098       // Returns the current digit I/O handling manager
00099 
00100       G4VMCTruthIO* MCTruthIO()
00101       {
00102         if (pm) return pm->MCTruthIO();
00103         else    return 0;
00104       };
00105       // Returns the current digit I/O handling manager
00106 
00107       G4VTransactionManager* TransactionManager()
00108       {
00109         if (pm) return pm->TransactionManager();
00110         else    return 0;
00111       };
00112       // Returns the current transaction manager
00113 
00114       void Initialize() {};
00115       // Initialize the persistency package.
00116 
00117       void SetVerboseLevel(int v)
00118       {
00119         if (pm) return pm->SetVerboseLevel();
00120         else    return 0;
00121       };
00122       // Sets the verbose level to the persistency manager
00123 
00124     private:
00125       G4PersistencyManager* pm;
00126 
00127 }; // End of class G4PersistencyManagerT
00128 
00129 #endif
00130 

Generated on Mon May 27 17:49:18 2013 for Geant4 by  doxygen 1.4.7