EventSourceWithInputFile.hh

Go to the documentation of this file.
00001 // $Header: /cvs/lcd/slic/include/EventSourceWithInputFile.hh,v 1.9 2007/04/27 01:54:32 jeremy Exp $
00002 
00003 #ifndef SLIC_EVENTSOURCEWITHINPUTFILE_HH
00004 #define SLIC_EVENTSOURCEWITHINPUTFILE_HH 1
00005 
00006 // slic
00007 #include "EventSource.hh"
00008 #include "FileUtil.hh"
00009 #include "Module.hh"
00010 
00011 namespace slic
00012 {
00017   class EventSourceWithInputFile : public EventSource
00018   {
00019 
00020   protected:
00021 
00022     EventSourceWithInputFile( const std::string& name,
00023                               const std::string& filename = "" )
00024       : EventSource( name ),
00025         m_filename(filename),
00026         m_eof(false),
00027         m_fileIsOpen(false),
00028         m_fileIsNew(false),
00029         m_fileIsSet(false)
00030     {}
00031 
00032   public:
00033     virtual ~EventSourceWithInputFile()
00034     {}
00035 
00036   public:
00037 
00038     void setFilename(const std::string& s);
00039 
00040     const std::string& getFilename();
00041 
00042     // reset current source
00043     virtual void reset();
00044 
00045     // skip n events
00046     virtual unsigned int skipEvents(unsigned int nevents);
00047 
00048     // current status = EOF?
00049     virtual bool isEOF();
00050 
00051     virtual void beginEvent(const G4Event*);
00052 
00053     virtual void beginRun(const G4Run*);
00054 
00055     // Next 4 to be implemented by subclasses...
00056 
00057     // open the current file
00058     virtual void open() = 0;
00059 
00060     // close the current file
00061     virtual void close() = 0;
00062 
00063     // read the next event
00064     virtual void readNextEvent() = 0;
00065     virtual void dumpCurrentEvent() = 0;
00066 
00067   protected:
00068 
00069     // name of input file
00070     std::string m_filename;
00071 
00072     // state vars
00073     bool m_eof;
00074     bool m_fileIsOpen;
00075     bool m_fileIsNew;
00076     bool m_fileIsSet;
00077   };
00078 }
00079 
00080 #endif

Generated on Thu Nov 15 15:24:15 2007 for Simulator for the Linear Collider by  doxygen 1.5.4