Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
prdfoStream.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file prdfoStream.h
1 #ifndef __PRDFOSTREAM_H
2 #define __PRDFOSTREAM_H
3 
4 #include <EventTypes.h>
5 #include <Event.h>
6 #include <BufferConstants.h>
7 
8 
9 class prdfoStream {
10 
11 public:
12 
13  //** Constructors
14 
15  prdfoStream(const char *filename, const int bufferlength = 4*1024*1024);
16 
17  virtual ~prdfoStream();
18 
19  int addEvent( Event *);
20 
21  int is_defunct() const { return defunct; };
22 
23 
24  protected:
25 
26  // add an end-of-buffer
27  int addEoB();
28 
29  // now the write routine
30  unsigned int writeout ();
31 
32  int prepare_next( const int iseq, const int irun=0);
33 
34  static unsigned int writen (int fd, char *ptr, const unsigned int nbytes);
35 
37 
38  typedef struct
39  {
40  int Length;
41  int ID;
42  int Bufseq;
43  int Runnr;
44  int data[1];
45  } *buffer_ptr;
46 
49 
51  int *data_ptr;
54  int max_size;
55  int left;
56  int has_end;
57 
58  int fd;
59  int defunct;
60 };
61 
62 #endif
63