Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:45

0001 // -*- c++ -*-
0002 #ifndef __FILEEVENTITERATOR_H__
0003 #define __FILEEVENTITERATOR_H__
0004 
0005 #include <stdio.h>
0006 
0007 #include "Eventiterator.h"
0008 #include "Event.h"
0009 
0010 #include "gzbuffer.h"
0011 #include "oncsBuffer.h"
0012 
0013 /**
0014    The fileEventiterator reads the event data from a data file on disk. 
0015    It creates and returns pointers to Event objects. At the end of the file 
0016    it returns 0 when there are no events left.
0017 */
0018 #ifndef __CINT__
0019 class WINDOWSEXPORT fileEventiterator : public Eventiterator {
0020 #else
0021 class  fileEventiterator : public Eventiterator {
0022 #endif
0023 public:
0024 
0025   virtual ~fileEventiterator();
0026 
0027   /// This simple constructor just needs the file name of the data file.
0028   fileEventiterator(const char *filename);
0029 
0030   /**
0031   This constructor gives you a status so you can learn that the creation
0032   of the fileEventiterator object was successful. If the status is not 0,
0033   something went wrong and you should delete the object again.
0034   */
0035   fileEventiterator(const char *filename, int &status);
0036 
0037   const char * getIdTag() const;
0038 
0039   virtual void identify(std::ostream& os = std::cout) const;
0040 
0041   virtual const char * getCurrentFileName() const;
0042 
0043 /**
0044    this member function returns a pointer to the Event object, or
0045    NULL if there are no events left.
0046 */   
0047   Event *getNextEvent();
0048 
0049   int  setVerbosity(const int v) 
0050   { 
0051     verbosity=v;
0052     return 0; 
0053   }; 
0054 
0055   int  getVerbosity() const 
0056   { 
0057     return verbosity; 
0058   };
0059 
0060 
0061 private:
0062   int open_file(const char *filename);
0063   int read_next_buffer();
0064 
0065   char *thefilename;
0066   int fd;
0067   
0068   PHDWORD *bp;
0069   unsigned int allocatedsize;
0070 
0071   int current_index;
0072   int last_read_status;
0073   unsigned int buffer_size;
0074   buffer *bptr;
0075 
0076   int events_so_far;
0077   int verbosity;
0078   int _defunct;
0079 };
0080 
0081 #endif /* __FILEEVENTITERATOR_H__ */
0082