00001 // $Header: /cvs/lcd/slic/include/Module.hh,v 1.8 2007/04/27 01:54:32 jeremy Exp $ 00002 00003 #ifndef SLIC_MODULE_HH 00004 #define SLIC_MODULE_HH 1 00005 00006 // slic 00007 #include "LogStream.hh" 00008 00009 // std 00010 #include <string> 00011 00012 // geant4 00013 #include "G4ClassificationOfNewTrack.hh" 00014 00015 class G4Event; 00016 class G4Run; 00017 class G4Step; 00018 class G4Track; 00019 00020 namespace slic 00021 { 00026 class Module 00027 { 00028 public: 00029 enum ModuleStatus { 00030 eOkay = 0, 00031 eNotInitialized = 1, 00032 eBadState = 2, 00033 eFatalError = 3 00034 }; 00035 00036 protected: 00037 00041 Module(const std::string& name, bool deleteOnExit=true, bool autoRegister=true); 00042 00043 public: 00044 virtual ~Module(); 00045 00046 public: 00047 00048 const std::string& getName() const { 00049 return m_name; 00050 } 00051 00052 const ModuleStatus getStatus() const { 00053 return m_status; 00054 } 00055 00056 virtual void initialize() 00057 {;} 00058 00059 virtual void reset() 00060 {;} 00061 00062 virtual void cleanup() 00063 {;} 00064 00065 bool deleteOnExit() 00066 { 00067 return m_deleteOnExit; 00068 } 00069 00070 LogStream& log() 00071 { 00072 return m_log; 00073 } 00074 00075 virtual void beginEvent( const G4Event* ) 00076 {;} 00077 00078 virtual void endEvent( const G4Event* ) 00079 {;} 00080 00081 virtual void beginRun( const G4Run* ) 00082 {;} 00083 00084 virtual void endRun( const G4Run* ) 00085 {;} 00086 00087 virtual void preTracking( const G4Track* ) 00088 {;} 00089 00090 virtual void postTracking( const G4Track* ) 00091 {;} 00092 00093 virtual void stepping( const G4Step* ) 00094 {;} 00095 00096 G4ClassificationOfNewTrack stackingClassifyNewTrack( const G4Track* ) 00097 { 00098 G4Exception("This method should never be called. Please override it."); 00099 // Arbitrary return value. Will never reach here. 00100 return fWaiting; 00101 } 00102 00103 void stackingNewStage() 00104 {;} 00105 00106 void stackingPrepareNewEvent() 00107 {;} 00108 00109 public: 00110 ModuleStatus m_status; 00111 std::string m_name; 00112 LogStream m_log; 00113 bool m_deleteOnExit; 00114 }; 00115 } 00116 00117 #endif
1.5.4