Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4TWorkspacePool< T > Class Template Reference

#include <G4TWorkspacePool.hh>

Public Member Functions

T * CreateWorkspace ()
 
void CreateAndUseWorkspace ()
 
T * FindOrCreateWorkspace ()
 
T * GetWorkspace ()
 
 G4TWorkspacePool ()
 
 ~G4TWorkspacePool ()
 

Detailed Description

template<class T>
class G4TWorkspacePool< T >

Definition at line 48 of file G4TWorkspacePool.hh.

Constructor & Destructor Documentation

template<class T >
G4TWorkspacePool< T >::G4TWorkspacePool ( )
inline

Definition at line 75 of file G4TWorkspacePool.hh.

75 {}
template<class T >
G4TWorkspacePool< T >::~G4TWorkspacePool ( )
inline

Definition at line 76 of file G4TWorkspacePool.hh.

76 {}

Member Function Documentation

template<class T >
void G4TWorkspacePool< T >::CreateAndUseWorkspace ( )

Definition at line 108 of file G4TWorkspacePool.hh.

109 {
110  (this->CreateWorkspace())->UseWorkspace();
111 }

Here is the caller graph for this function:

template<class T >
T * G4TWorkspacePool< T >::CreateWorkspace ( )

Definition at line 87 of file G4TWorkspacePool.hh.

88 {
89  T* wrk = 0;
90  if ( !fMyWorkspace ) {
91  wrk = new T;
92  if ( !wrk ) {
93  G4Exception("G4TWorspacePool<someType>::CreateWorkspace", "Workspace01",
94  FatalException, "Failed to create workspace.");
95  } else {
96  fMyWorkspace = wrk;
97  }
98  } else {
99  G4Exception("ParticlesWorspacePool::CreateWorkspace", "Workspace02",
101  "Cannot create workspace twice for the same thread.");
102  wrk = fMyWorkspace;
103  }
104  return wrk;
105 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

template<class T >
T * G4TWorkspacePool< T >::FindOrCreateWorkspace ( )

Definition at line 114 of file G4TWorkspacePool.hh.

115 {
116  T* wrk= fMyWorkspace;
117  if( !wrk ){
118  wrk= this->CreateWorkspace();
119  }
120  wrk->UseWorkspace();
121 
122  fMyWorkspace= wrk; // assign it for use by this thread.
123  return wrk;
124 }
template<class T >
T* G4TWorkspacePool< T >::GetWorkspace ( )
inline

Definition at line 61 of file G4TWorkspacePool.hh.

61 { return fMyWorkspace; }

Here is the caller graph for this function:


The documentation for this class was generated from the following file: