Geant4-11
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// G4PersistencyCenter
27//
28// Class Description:
29//
30// Class to handle loading of the G4PersistencyManager.
31
32// Author: Youhei Morita, 10.08.2001
33// --------------------------------------------------------------------
34#ifndef G4PERSISTENCYCENTER_HH
35#define G4PERSISTENCYCENTER_HH 1
36
37#include "G4Types.hh"
38#include <string>
39#include <vector>
40#include <map>
41#include "G4HCIOcatalog.hh"
42#include "G4DCIOcatalog.hh"
43
44#ifndef WIN32
45# include "G4FileUtilities.hh"
46#endif
47
48// Forward Declarations
51
52using PMap = std::map<G4String, G4PersistencyManager*, std::less<G4String>>;
53using ObjMap = std::map<G4int, G4String, std::less<G4int>>;
54using FileMap = std::map<G4String, G4String, std::less<G4String>>;
55
57{
61};
62
63using StoreMap = std::map<G4String, StoreMode, std::less<G4String>>;
64using BoolMap = std::map<G4String, G4bool, std::less<G4String>>;
65
67{
68 public:
69
71 // Returns the pointer of singleton G4PersistencyCenter
72
73 void SelectSystem(const G4String& systemName);
74 // Select the persistency package
75
77 // Returns the current persistent package name
78
80 // Sets the name of HepMCObjyReader file name. To be called by generator
81
83 // Sets the name of HepMCObjyReader file name. To be called by generator
84
85 void SetStoreMode(const G4String& objName, StoreMode mode);
86 // Sets the object store mode. Modes are kOn, kOff or kRecycle
87
88 void SetRetrieveMode(const G4String& objName, G4bool mode);
89 // Sets the object retrieve mode. Modes are true or false
90
91 StoreMode CurrentStoreMode(const G4String& objName);
92 // Returns the current object store mode
93
94 G4bool CurrentRetrieveMode(const G4String& objName);
95 // Returns the current object store mode
96
97 G4bool SetWriteFile(const G4String& objName, const G4String& writeFileName);
98 // Sets the output filename
99
100 G4bool SetReadFile(const G4String& objName, const G4String& readFileName);
101 // Sets the input filename
102
103 G4String CurrentWriteFile(const G4String& objName);
104 // Returns the current output filename
105
106 G4String CurrentReadFile(const G4String& objName);
107 // Returns the current input filename
108
110 // Returns the current object type
111
112 void AddHCIOmanager(const G4String& detName, const G4String& colName);
113 // Adds a hits colleciton I/O manager to the catalog
114
116 // Returns a list of registered hits colleciton I/O managers
117
118 void AddDCIOmanager(const G4String& detName);
119 // Adds a digits colleciton I/O manager to the catalog
120
122 // Returns a list of registered digits collection I/O managers
123
124 void PrintAll();
125 // Prints the current G4PersistencyCenter settings
126
128 {
129 return f_currentManager;
130 }
131 // Returns the pointer of the current G4PersistencyManager
132
134 // Returns the pointer of the current G4PersistencyManager
135
137 // Returns the pointer of the current G4PersistencyManager with name
138
140 // Registers the persistency manager to the runtime catalog
141
143 // Deletes the current G4PersistencyManager
144
145 void SetVerboseLevel(G4int v);
146 // Sets verbose level
147
149 // Returns verbose level
150
151 private:
152
154 // Constructor
155
157 // Destructor
158
159 G4String PadString(const G4String& name, unsigned int width);
160 // Truncates or pad a string up to the width
161
162 private:
163
176#ifndef WIN32
178#endif
179};
180
181#endif
std::map< G4int, G4String, std::less< G4int > > ObjMap
std::map< G4String, G4bool, std::less< G4String > > BoolMap
@ kRecycle
std::map< G4String, G4String, std::less< G4String > > FileMap
std::map< G4String, StoreMode, std::less< G4String > > StoreMap
std::map< G4String, G4PersistencyManager *, std::less< G4String > > PMap
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4String CurrentObject(const G4String &file)
G4bool SetWriteFile(const G4String &objName, const G4String &writeFileName)
G4bool CurrentRetrieveMode(const G4String &objName)
void SetRetrieveMode(const G4String &objName, G4bool mode)
G4PersistencyCenterMessenger * f_theMessenger
void AddDCIOmanager(const G4String &detName)
static G4PersistencyCenter * GetPersistencyCenter()
G4bool SetReadFile(const G4String &objName, const G4String &readFileName)
static G4ThreadLocal G4PersistencyCenter * f_thePointer
void SetStoreMode(const G4String &objName, StoreMode mode)
void SetPersistencyManager(G4PersistencyManager *pm, const G4String &name)
G4String CurrentReadFile(const G4String &objName)
G4PersistencyManager * GetPersistencyManager(const G4String &nam)
void AddHCIOmanager(const G4String &detName, const G4String &colName)
G4PersistencyManager * CurrentPersistencyManager()
StoreMode CurrentStoreMode(const G4String &objName)
G4PersistencyManager * f_currentManager
G4String CurrentHepMCObjyReaderFile()
G4String PadString(const G4String &name, unsigned int width)
void RegisterPersistencyManager(G4PersistencyManager *pm)
void SetHepMCObjyReaderFile(const G4String &file)
const G4String & CurrentSystem()
G4String CurrentWriteFile(const G4String &objName)
void SelectSystem(const G4String &systemName)
const char * name(G4int ptype)
#define G4ThreadLocal
Definition: tls.hh:77