source: trunk/source/processes/hadronic/cross_sections/src/G4CrossSectionDataSetRegistry.cc@ 1007

Last change on this file since 1007 was 968, checked in by garnier, 17 years ago

fichier ajoutes

File size: 3.1 KB
Line 
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//
27// $Id: G4CrossSectionDataSetRegistry.cc,v 1.3 2009/02/25 16:27:36 vnivanch Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30// -------------------------------------------------------------------
31//
32// GEANT4 Class file
33//
34//
35// File name: G4CrossSectionDataSetRegistry
36//
37// Author V.Ivanchenko 24.01.2009
38//
39// Modifications:
40//
41
42#include "G4CrossSectionDataSetRegistry.hh"
43#include "G4VCrossSectionDataSet.hh"
44
45G4CrossSectionDataSetRegistry* G4CrossSectionDataSetRegistry::theInstance = 0;
46
47G4CrossSectionDataSetRegistry* G4CrossSectionDataSetRegistry::Instance()
48{
49 if(0 == theInstance) {
50 static G4CrossSectionDataSetRegistry manager;
51 theInstance = &manager;
52 }
53 return theInstance;
54}
55
56G4CrossSectionDataSetRegistry::G4CrossSectionDataSetRegistry()
57{
58 nxs = 0;
59}
60
61G4CrossSectionDataSetRegistry::~G4CrossSectionDataSetRegistry()
62{
63 Clean();
64}
65
66void G4CrossSectionDataSetRegistry::Clean()
67{
68 if(0 == nxs) return;
69 for (G4int i=0; i<nxs; i++) {
70 if( xSections[i] ) {
71 delete xSections[i];
72 xSections[i] = 0;
73 }
74 }
75 nxs = 0;
76}
77
78void G4CrossSectionDataSetRegistry::Register(G4VCrossSectionDataSet* p)
79{
80 if(nxs > 0) {
81 for (G4int i=0; i<nxs; i++) {
82 if( p == xSections[i] ) return;
83 }
84 }
85 xSections.push_back(p);
86 nxs++;
87}
88
89void G4CrossSectionDataSetRegistry::DeRegister(G4VCrossSectionDataSet* p)
90{
91 if(nxs > 0) {
92 for (G4int i=0; i<nxs; i++) {
93 if( p == xSections[i] ) {
94 xSections[i] = 0;
95 return;
96 }
97 }
98 }
99}
100
101
Note: See TracBrowser for help on using the repository browser.