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
G4PersistencyCenter.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: G4PersistencyCenter.hh
27//
28// History:
29// '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
30
31#ifndef PERSISTENCY_CENTER_HH
32#define PERSISTENCY_CENTER_HH 1
33
34#include "G4Types.hh"
35#include <string>
36#include <vector>
37#include <map>
38#include "G4HCIOcatalog.hh"
39#include "G4DCIOcatalog.hh"
40
41#ifndef WIN32
42 #include "G4FileUtilities.hh"
43#endif
44
45// Forward Declaration to avoid circular dependencies.
47
48typedef std::map<std::string, G4PersistencyManager*,std::less<std::string> > PMap;
49typedef std::map<int, std::string, std::less<int> > ObjMap;
50typedef std::map<std::string, std::string, std::less<std::string> > FileMap;
51
53
54typedef std::map<std::string, StoreMode, std::less<std::string> > StoreMap;
55typedef std::map<std::string, G4bool, std::less<std::string> > BoolMap;
56
57// Forward Declarations:
59
60// Class Description:
61// Class to handle loading of the G4PersistencyManager.
62
64{
65 public: // With description
67 // Constructor
68
70 // Destructor
71
72 public: // With description
74 // returns the pointer of singleton G4PersistencyCenter
75
76 void SelectSystem(std::string systemName);
77 // Select the persistency package
78
79 const std::string CurrentSystem() { return f_currentSystemName; };
80 // returns the current persistent package name
81
82 void SetHepMCObjyReaderFile(std::string file);
83 // Sets the name of HepMCObjyReader file name. To be called by generator.
84
85 std::string CurrentHepMCObjyReaderFile();
86 // Sets the name of HepMCObjyReader file name. To be called by generator.
87
88 void SetStoreMode(std::string objName, StoreMode mode);
89 // Sets the object store mode. Modes are kOn, kOff or kRecycle.
90
91 void SetRetrieveMode(std::string objName, G4bool mode);
92 // Sets the object retrieve mode. Modes are true or false.
93
94 StoreMode CurrentStoreMode(std::string objName);
95 // returns the current object store mode.
96
97 G4bool CurrentRetrieveMode(std::string objName);
98 // returns the current object store mode.
99
100 G4bool SetWriteFile(std::string objName, std::string writeFileName);
101 // Sets the output filename.
102
103 G4bool SetReadFile(std::string objName, std::string readFileName);
104 // Sets the input filename.
105
106 std::string CurrentWriteFile(std::string objName);
107 // returns the current output filename.
108
109 std::string CurrentReadFile(std::string objName);
110 // returns the current input filename.
111
112 std::string CurrentObject(std::string file);
113 // returns the current object type
114
115 void AddHCIOmanager(std::string detName, std::string colName);
116 // add a hits colleciton I/O manager to the catalog
117
118 std::string CurrentHCIOmanager();
119 // Returns a list of registered hits colleciton I/O managers
120
121 void AddDCIOmanager(std::string detName);
122 // add a digits colleciton I/O manager to the catalog
123
124 std::string CurrentDCIOmanager();
125 // Returns a list of registered digits colleciton I/O managers
126
127 void PrintAll();
128 // prints the current G4PersistencyCenter settings.
129
130 G4PersistencyManager* CurrentPersistencyManager() { return f_currentManager; };
131 // returns the pointer of the currnet G4PersistencyManager.
132
133 void SetPersistencyManager(G4PersistencyManager* pm, std::string name);
134 // returns the pointer of the currnet G4PersistencyManager.
135
137 // returns the pointer of the currnet G4PersistencyManager with name.
138
140 // registers the persistency manager to the runtime catalog.
141
143 // deletes the current G4PersistencyManager.
144
145 void SetVerboseLevel(int v);
146 // Set verbose level.
147
148 int VerboseLevel() { return m_verbose; };
149 // Return verbose level.
150
151 private:
152 std::string PadString(std::string name, unsigned int width);
153 // truncate or pad a string up to the width.
154
155 private:
156 G4PersistencyCenterMessenger* f_G4PersistencyCenterMessenger;
157
158 private:
159 G4PersistencyCenterMessenger* f_theMessenger;
160 static G4PersistencyCenter* f_thePointer;
161 G4PersistencyManager* f_currentManager;
162 std::string f_currentSystemName;
163 PMap f_theCatalog;
164 ObjMap f_wrObj;
165 ObjMap f_rdObj;
166 FileMap f_writeFileName;
167 FileMap f_readFileName;
168 StoreMap f_writeFileMode;
169 BoolMap f_readFileMode;
170 G4int m_verbose;
171#ifndef WIN32
172 G4FileUtilities f_ut;
173#endif
174}; // End of class G4PersistencyCenter
175
176#endif
177
std::map< std::string, G4PersistencyManager *, std::less< std::string > > PMap
@ kRecycle
std::map< std::string, std::string, std::less< std::string > > FileMap
std::map< std::string, StoreMode, std::less< std::string > > StoreMap
std::map< int, std::string, std::less< int > > ObjMap
std::map< std::string, G4bool, std::less< std::string > > BoolMap
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
std::string CurrentHepMCObjyReaderFile()
void SelectSystem(std::string systemName)
void SetPersistencyManager(G4PersistencyManager *pm, std::string name)
static G4PersistencyCenter * GetPersistencyCenter()
const std::string CurrentSystem()
G4bool SetReadFile(std::string objName, std::string readFileName)
void AddDCIOmanager(std::string detName)
std::string CurrentHCIOmanager()
void SetRetrieveMode(std::string objName, G4bool mode)
std::string CurrentDCIOmanager()
std::string CurrentWriteFile(std::string objName)
G4PersistencyManager * CurrentPersistencyManager()
void RegisterPersistencyManager(G4PersistencyManager *pm)
StoreMode CurrentStoreMode(std::string objName)
void SetStoreMode(std::string objName, StoreMode mode)
void SetHepMCObjyReaderFile(std::string file)
G4bool CurrentRetrieveMode(std::string objName)
void AddHCIOmanager(std::string detName, std::string colName)
G4PersistencyManager * GetPersistencyManager(std::string nam)
G4bool SetWriteFile(std::string objName, std::string writeFileName)
std::string CurrentReadFile(std::string objName)
std::string CurrentObject(std::string file)