Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4HCIOcatalog.cc
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: G4HCIOcatalog.cc
27//
28// History:
29// '01.09.12 Youhei Morita Initial creation
30
31#include "G4HCIOcatalog.hh"
32
33// Addtional Include:
34#include "G4VHCIOentry.hh"
35
36G4HCIOcatalog* G4HCIOcatalog::f_thePointer = 0;
37
38// Implementation of Constructor #1
40 : m_verbose(0)
41{}
42
43// Implementation of GetHCIOcatalog
45{
46 if ( f_thePointer == 0 ) f_thePointer = new G4HCIOcatalog;
47 return f_thePointer;
48}
49
50// Implementation of RegisterEntry
52{
53 if ( m_verbose > 0 ) {
54 G4cout << "registering I/O manager entry \"" << d->GetName()
55 << "\" " << d << "." << G4endl;
56 }
57 if ( theCatalog.find(d->GetName()) != theCatalog.end() ) {
58 G4cout << "Redefining I/O Managers list " << d->GetName() << G4endl;
59 } else {
60 theCatalog[d->GetName()] = d;
61 }
62}
63
64// Implementation of RegisterHCIOmanager
66{
67 if ( m_verbose > 0 ) {
68 G4cout << "registering I/O manager \"" << d->SDname()
69 << "\" " << d << "." << G4endl;
70 }
71 if ( theStore.find(d->SDname()) != theStore.end() ) {
72 G4cout << "Redefining I/O Manager " << d->SDname() << G4endl;
73 } else {
74 theStore[d->SDname()] = d;
75 }
76}
77
78// Implementation of GetEntry
80{
81 if ( theCatalog.find(name) == theCatalog.end() ) {
82 G4cout << "Hit Collection I/O manager entry \"" << name
83 << "\" not found!" << std::endl;
84 return 0;
85 } else {
86 G4VHCIOentry* ds = theCatalog[name];
87 return ds;
88 }
89}
90
91// Implementation of GetHCIOmanager
93{
94 if ( theStore.find(name) == theStore.end() ) {
95 G4cout << "Hit Collection I/O manager \"" << name
96 << "\" not found!" << G4endl;
97 return 0;
98 } else {
99 G4VPHitsCollectionIO* ds = theStore[name];
100 return ds;
101 }
102}
103
104// Implementation of PrintEntries
106{
107 G4cout << "I/O manager entries: ";
108 G4cout << theCatalog.size() << G4endl;
109 HCIOmap::const_iterator it;
110 for ( it=theCatalog.begin(); it != theCatalog.end(); it++ ) {
111 G4cout << " --- " << (*it).first << G4endl;
112 }
113}
114
115// Implementation of CurrentHCIOmanager
117{
118 std::string list = "";
119 HCIOstore::const_iterator it;
120 for ( it=theStore.begin(); it != theStore.end(); it++ ) {
121 list += (*it).first + " ";
122 }
123 return list;
124}
125
126// Implementation of PrintHCIOmanager
128{
129 G4cout << "I/O managers: ";
130 G4cout << theStore.size() << G4endl;
131 HCIOstore::const_iterator it;
132 for ( it=theStore.begin(); it != theStore.end(); it++ ) {
133 G4cout << " --- " << (*it).first
134 << ", " << (*it).second << "." << G4endl;
135 }
136}
137
138// Implementation of GetHCIOmanager
140{
141 int i = 0;
142 HCIOstore::const_iterator it;
143 for ( it=theStore.begin(); it != theStore.end(); it++ ) {
144 if (i++ == n) return (*it).second;
145 }
146 return 0;
147}
148
149// End of G4HCIOcatalog.cc
150
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void PrintHCIOmanager()
G4VHCIOentry * GetEntry(std::string name)
std::string CurrentHCIOmanager()
G4VPHitsCollectionIO * GetHCIOmanager(std::string name)
static G4HCIOcatalog * GetHCIOcatalog()
void RegisterHCIOmanager(G4VPHitsCollectionIO *d)
void RegisterEntry(G4VHCIOentry *d)
std::string GetName()
Definition: G4VHCIOentry.hh:54