File indexing completed on 2025-08-05 08:15:11
0001 #ifndef __PRDFOSTREAM_H
0002 #define __PRDFOSTREAM_H
0003
0004 #include <EventTypes.h>
0005 #include <Event.h>
0006 #include <BufferConstants.h>
0007
0008
0009 class prdfoStream {
0010
0011 public:
0012
0013
0014
0015 prdfoStream(const char *filename, const int bufferlength = 4*1024*1024);
0016
0017 virtual ~prdfoStream();
0018
0019 int addEvent( Event *);
0020
0021 int is_defunct() const { return defunct; };
0022
0023
0024 protected:
0025
0026
0027 int addEoB();
0028
0029
0030 unsigned int writeout ();
0031
0032 int prepare_next( const int iseq, const int irun=0);
0033
0034 static unsigned int writen (int fd, char *ptr, const unsigned int nbytes);
0035
0036 std::string _filename;
0037
0038 typedef struct
0039 {
0040 int Length;
0041 int ID;
0042 int Bufseq;
0043 int Runnr;
0044 int data[1];
0045 } *buffer_ptr;
0046
0047 int has_buffer;
0048 int buffer_sequence;
0049
0050 buffer_ptr bptr;
0051 int *data_ptr;
0052 int current_index;
0053 int max_length;
0054 int max_size;
0055 int left;
0056 int has_end;
0057
0058 int fd;
0059 int defunct;
0060 };
0061
0062 #endif
0063