Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __OBUFFER_H
0002 #define __OBUFFER_H
0003 
0004 #include "phenixTypes.h"
0005 #include "Event.h"
0006 
0007 
0008 class  oBuffer {
0009 
0010 public:
0011 
0012 
0013   oBuffer();
0014 
0015   /*  oBuffer (int fd, PHDWORD * where, const int length, */
0016   /*        const int irun=1 , const int iseq=0 ); */
0017   
0018 
0019   /* oBuffer (const char *filename, PHDWORD * where, const int length, */
0020   /*       int &status, */
0021   /*       const int irun=1 , const int iseq=0 ); */
0022 
0023 
0024   virtual  ~oBuffer();
0025 
0026   //  this creates a new event on the next address
0027   virtual int nextEvent( const unsigned int evtsize, const int etype =0, const int evtseq =0) = 0;
0028 
0029 
0030   // frame and packet adding
0031 
0032   virtual int addRawEvent(unsigned int *) =0;
0033 
0034   virtual int addEvent(Event *) = 0;
0035 
0036   // we have this here since not all subclasses have this
0037   virtual int addFrame(PHDWORD *) {return 0;}; 
0038 
0039   virtual int  addPacket( const Packet *p) = 0;
0040 
0041   virtual int addUnstructPacketData(PHDWORD * data, 
0042             const int length,
0043             const int id,
0044             const int wordsize,
0045             const int hitformat) = 0;
0046 
0047   virtual int writeout () = 0;
0048 
0049   // now the re-sizing of buffer
0050   virtual int setMaxSize( const int size) = 0;
0051 
0052   virtual int getMaxSize() const =0 ;
0053 
0054   virtual unsigned long long getBytesWritten() const = 0;
0055 
0056   virtual int addEoB() = 0;
0057 
0058 
0059 protected:
0060 
0061   //  virtual int prepare_next();
0062 
0063   typedef struct 
0064   { 
0065     unsigned int Length;
0066     int ID;
0067     int Bufseq;
0068     int Runnr;
0069     PHDWORD data[1];
0070   } *buffer_ptr;
0071 
0072 
0073 };
0074 
0075 #endif
0076