Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef __OPHBUFFER_H
0002 #define __OPHBUFFER_H
0003 
0004 #include "event_io.h"
0005 
0006 #include "phenixTypes.h"
0007 #include "oBuffer.h"
0008 #include "oEvent.h"
0009 #include "Event.h"
0010 
0011 
0012 class  ophBuffer : public oBuffer {
0013 
0014 public:
0015 
0016   //** Constructors
0017 
0018   //  ophBuffer( FILE *fpp, PHDWORD * , const int length
0019   //     , const int iseq = 1, const int irun=1);
0020 
0021   ophBuffer() {};
0022 
0023   ophBuffer (int fd, PHDWORD * where, const int length,
0024         const int irun=1 , const int iseq=0 );
0025   
0026   ophBuffer (const char *filename, PHDWORD * where, const int length,
0027        int &status,
0028        const int irun=1 , const int iseq=0 );
0029 
0030 
0031   ~ophBuffer();
0032 
0033   //  this creates a new event on the next address
0034   int nextEvent( const unsigned int evtsize, const int etype =0, const int evtseq =0);
0035 
0036 
0037   // frame and packet adding
0038 
0039   int addRawEvent(unsigned int *);
0040 
0041   int addEvent(Event *);
0042 
0043   int addFrame(PHDWORD *);
0044 
0045   int  addPacket( const Packet *p);
0046 
0047   int addUnstructPacketData(PHDWORD * data, 
0048             const int length,
0049             const int id,
0050             const int wordsize,
0051             const int hitformat);
0052 
0053   int writeout ();
0054 
0055   // now the re-sizing of buffer
0056   int setMaxSize( const int size);
0057 
0058   // and the query
0059   int getMaxSize() const;
0060 
0061   // and the query`
0062   unsigned long long getBytesWritten() const;
0063 
0064   int addEoB();
0065 
0066 
0067 protected:
0068 
0069   int prepare_next();
0070 
0071 
0072   buffer_ptr bptr;
0073   buffer_ptr bptr_being_written;
0074 
0075   buffer_ptr bptr0;
0076   buffer_ptr bptr1;
0077   PHDWORD *data_ptr;
0078   int current_index;
0079   int max_length;
0080   int max_size;
0081   unsigned int left;
0082   int sequence;
0083   int runnumber;
0084   unsigned long long byteswritten;
0085   oEvent *current_event;
0086   int eventsequence;
0087   int current_etype;
0088   int has_end;
0089   int dirty;
0090   int fd;
0091   int our_fd;
0092   int good_object;
0093 
0094 
0095 };
0096 
0097 #endif
0098