Geant4-11
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// G4PersistencyManagerT
27//
28// Class Description:
29//
30// Template class of G4PersistencyManager for late binding.
31
32// Author: Youhei Morita, 10.08.2001
33// --------------------------------------------------------------------
34#ifndef G4PERSISTENCYMANAGERT_HH
35#define G4PERSISTENCYMANAGERT_HH 1
36
39
40template <class T>
42{
43 public:
44
47 {
48 if(m_verbose > 2)
49 {
50 G4cout << "G4PersistencyManagerT: Registering G4PersistencyManager \""
51 << n << "\"" << G4endl;
52 }
55 }
56 // Constructor
57
59 // Destructor
60
62 {
63 pm = new T(f_pc, GetName());
64 return pm;
65 }
66 // Create a new persistency manager
67
68 void Delete()
69 {
70 if(pm != nullptr) delete pm;
71 }
72 // Delete a persistency mamanger
73
75 {
76 if(pm != nullptr)
77 return pm->EventIO();
78 else
79 return nullptr;
80 }
81 // Returns the current event I/O handling manager
82
84 {
85 if(pm != nullptr)
86 return pm->HitIO();
87 else
88 return nullptr;
89 }
90 // Returns the current hit I/O handling manager
91
93 {
94 if(pm != nullptr)
95 return pm->DigitIO();
96 else
97 return nullptr;
98 }
99 // Returns the current digit I/O handling manager
100
101 G4VHepMCIO* HepMCIO()
102 {
103 if(pm != nullptr)
104 return pm->HepMCIO();
105 else
106 return nullptr;
107 }
108 // Returns the current digit I/O handling manager
109
111 {
112 if(pm != nullptr)
113 return pm->MCTruthIO();
114 else
115 return nullptr;
116 }
117 // Returns the current digit I/O handling manager
118
120 {
121 if(pm != nullptr)
122 return pm->TransactionManager();
123 else
124 return nullptr;
125 }
126 // Returns the current transaction manager
127
128 void Initialize() {}
129 // Initialize the persistency package.
130
132 {
133 if(pm != nullptr)
134 return pm->SetVerboseLevel();
135 else
136 return nullptr;
137 }
138 // Sets the verbose level to the persistency manager
139
140 private:
141
143};
144
145#endif
static constexpr double pc
Definition: G4SIunits.hh:117
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4PersistencyCenter * GetPersistencyCenter()
void RegisterPersistencyManager(G4PersistencyManager *pm)
G4PersistencyManager * pm
G4PersistencyManagerT(G4PersistencyCenter *pc, const G4String &n)
G4VTransactionManager * TransactionManager()
G4PersistencyManager * Create()
G4PersistencyCenter * f_pc
virtual G4VPEventIO * EventIO()
virtual G4VMCTruthIO * MCTruthIO()
virtual G4VPHitIO * HitIO()
virtual G4VPDigitIO * DigitIO()
const G4String & GetName()
virtual G4VTransactionManager * TransactionManager()