Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4CascadeChannelTables.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 // $Id: G4CascadeChannelTables.hh 69336 2013-04-30 20:20:23Z mkelsey $
27 //
28 // Factory class to return pointer to Bertini cross-section table based on
29 // collision initial state (hadron type codes).
30 //
31 // Author: Michael Kelsey (SLAC)
32 //
33 // 20110728 M. Kelsey -- Use static instance() function to work around
34 // "disappearance" bug on Linux (GCC 4.1.2).
35 // 20110915 M. Kelsey -- Move static implementations (won't work on Windows);
36 // Add local table instantiating function (to replace self-reg)
37 // 20110923 M. Kelsey -- Add optional stream& argument to printTable().
38 // 20130129 M. Kelsey -- Drop load-on-demand interfaces, fill in ctor
39 // 20130306 M. Kelsey -- Add inclusive printing of all tables here
40 // 20130429 M. Kelsey -- Change instance to thread-local pointer.
41 // 20141121 M. Kelsey -- Dtor must be public for end-of-job cleanup.
42 
43 #ifndef G4_CASCADE_CHANNEL_TABLES_HH
44 #define G4_CASCADE_CHANNEL_TABLES_HH
45 
46 #include "globals.hh"
47 #include <iosfwd>
48 #include <map>
49 
50 class G4CascadeChannel;
51 
52 
54 public:
55  // Argument is interaction code, product of G4InuclEP types
56  static const G4CascadeChannel* GetTable(G4int initialState);
57 
58  // Arguments are individual G4InuclElementaryParticle types
59  static const G4CascadeChannel* GetTable(G4int had1, G4int had2);
60 
61  // Convenience functions for diagnostic output
62  static void Print(std::ostream& os=G4cout);
63  static void PrintTable(G4int initialState, std::ostream& os=G4cout);
64 
65 public:
67 
68 private:
69  static const G4CascadeChannelTables& instance(); // Singleton
70  static G4ThreadLocal G4CascadeChannelTables* theInstance; // per thread
71 
73 
74  // Fetch table from map if already registered, or return null
75  const G4CascadeChannel* FindTable(G4int initialState) const;
76 
77  typedef std::map<G4int, G4CascadeChannel*> TableMap;
78  TableMap tables;
79 };
80 
81 #endif /* G4_CASCADE_CHANNEL_TABLES_HH */
static const G4CascadeChannel * GetTable(G4int initialState)
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
static void Print(std::ostream &os=G4cout)
static void PrintTable(G4int initialState, std::ostream &os=G4cout)