Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4PersistencyManagerT.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// File: G4PersistencyManagerT.hh
27//
28// History:
29// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
30
31#ifndef PERSISTENCY_MANAGER_T_HH
32#define PERSISTENCY_MANAGER_T_HH 1
33
35
36// Class inherited:
38
39// Class Description:
40// Template class of G4PersistencyManager for late binding
41
42template <class T> class G4PersistencyManagerT
44{
45 public: // With description
47 : G4PersistencyManager(pc, n), pm(0)
48 {
49 if ( m_verbose > 2 ) {
50 G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
51 << n << "\"" << G4endl;
52 }
54 RegisterPersistencyManager(this);
55 }
56 // Constructor
57
59 // Destructor
60
61 public: // With description
63 {
64 pm = new T(f_pc, GetName());
65 return pm;
66 }
67 // Create a new persistency manager
68
69 void Delete() { if (pm!=0) delete pm; };
70 // Delete a persistency mamanger
71
73 {
74 if (pm) return pm->EventIO();
75 else return 0;
76 };
77 // Returns the current event I/O handling manager
78
80 {
81 if (pm) return pm->HitIO();
82 else return 0;
83 };
84 // Returns the current hit I/O handling manager
85
87 {
88 if (pm) return pm->DigitIO();
89 else return 0;
90 };
91 // Returns the current digit I/O handling manager
92
93 G4VHepMCIO* HepMCIO()
94 {
95 if (pm) return pm->HepMCIO();
96 else return 0;
97 };
98 // Returns the current digit I/O handling manager
99
101 {
102 if (pm) return pm->MCTruthIO();
103 else return 0;
104 };
105 // Returns the current digit I/O handling manager
106
108 {
109 if (pm) return pm->TransactionManager();
110 else return 0;
111 };
112 // Returns the current transaction manager
113
114 void Initialize() {};
115 // Initialize the persistency package.
116
117 void SetVerboseLevel(int v)
118 {
119 if (pm) return pm->SetVerboseLevel();
120 else return 0;
121 };
122 // Sets the verbose level to the persistency manager
123
124 private:
126
127}; // End of class G4PersistencyManagerT
128
129#endif
130
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4PersistencyCenter * GetPersistencyCenter()
G4VTransactionManager * TransactionManager()
G4PersistencyManagerT(G4PersistencyCenter *pc, std::string n)
G4PersistencyManager * Create()
G4PersistencyCenter * f_pc
virtual G4VPEventIO * EventIO()
virtual G4VMCTruthIO * MCTruthIO()
virtual G4VPHitIO * HitIO()
virtual G4VPDigitIO * DigitIO()
virtual G4VTransactionManager * TransactionManager()