FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MRevBuffer.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
9 // Copyright:
10 // GSI, Gesellschaft fuer Schwerionenforschung mbH
11 // Planckstr. 1
12 // D-64291 Darmstadt
13 // Germany
14 // created 16. 2.1999 by Horst Goeringer
16 // MRevBuffer.h
17 // description of class MRevBuffer
18 // ROOT client package for multithreaded remote event server (MBS)
20 // 20. 8.1999, H.G.: MRevBuffer::RevGetI added
21 // 6. 3.2000, H.G.: new member function RevStatus
23 
24 #ifndef MRevBuffer_H
25 #define MRevBuffer_H
26 
27 #include <Rtypes.h> // for Int_t, ClassDef, etc
28 #include <TObject.h> // for TObject
29 
30 class TSocket;
31 
32 class REvent : public TObject
33 {
34  private:
35  Int_t iSize; // event size (byte)
36  Int_t iNumb; // event number
37  Int_t* piData; // event parameter
38 
39  REvent(const REvent&);
40  REvent& operator=(const REvent&);
41 
42  public:
43  REvent(); // constructor
44  ~REvent(); // destructor
45 
46  void ReFillHead(Int_t* pHead); // unpack and fill event header
47  void ReFillData(Int_t* pData); // unpack and fill event data
48 
49  Int_t ReGetNumb(); // get event number
50  Int_t ReGetSize(); // get event size
51  Int_t ReGetData(Int_t ichan); // get event parameter ichan
52  Int_t* GetData() { return piData; }
53 
54  Int_t nSubEvt;
55  Int_t subEvtSize[100];
56  Short_t subEvtType[100];
57  Short_t subEvtSubType[100];
58  Short_t subEvtProcId[100];
59  Short_t subEvtSubCrate[100];
60  Short_t subEvtControl[100];
61  Int_t* pSubEvt[100];
62 
63  ClassDef(REvent, 0);
64 };
65 
66 class MRevBuffer : public TObject
67 {
68  private:
69  TSocket* pTSocket; // ptr socket of channel to event server
70  Int_t iSocket; // socket id of channel to event server
71  Int_t iBufNo1; // first buffer no. received (test)
72  Int_t iBufNo2; // last buffer no. received (test)
73  Int_t iDebug; // verbosity level (test)
74  Int_t iSwap; // > 0: swap event data
75  Int_t iStatus; // current status of server
76 
77  Int_t iBufSizeAlloc; // allocated buffer size
78  Int_t iBufSize; // size current buffer
79  Int_t iBufNo; // current buffer no.
80  Int_t iFragBegin; // > 0: last buffer ended with fragment
81  Int_t iFragConc; // no. of concatenated fragments
82  Int_t iFragBeginIgn; // no. of ignored fragment begins
83  Int_t iFragEndIgn; // no. of ignored fragment ends
84 
85  Int_t iHeadPar; // no. of (4 byte) parms buffer header
86  Int_t iEvtMax; // no. of events requested
87  Int_t iEvtNo; // last event no. handled
88  Int_t iEvtRel; // rel. event no. in buffer
89  Int_t iEvtBuf; // no. of events in current buffer
90  Int_t iEvtPar; // no. of parameters in event (incl. len)
91  Int_t* piBuf; // ptr event buffer
92  Int_t* piNextEvt; // ptr first element next event
93  REvent* pEvt; // ptr event class
94 
95  MRevBuffer(const MRevBuffer&);
96  MRevBuffer& operator=(const MRevBuffer&);
97 
98  public:
99  MRevBuffer(Int_t iMode); // constructor
100  ~MRevBuffer(); // destructor
101 
102  TSocket* RevOpen(char* pNode, Int_t iPort, Int_t iEvent);
103  // input: node name and port number server, req. no. of events
104  // returns Socket ptr of server connection
105 
106  Int_t* RevGetI(TSocket* pSocket, Int_t iFlush);
107  // get next event (pointer) from buffer, input:
108  // Socket ptr,
109  // iFlush = 1: skip current buffer (not impl)
110 
111  REvent* RevGet(TSocket* pSocket, Int_t iFlush, Int_t iSkip);
112  // get next event (pointer) from buffer, input:
113  // Socket ptr,
114  // iFlush = 1: skip current buffer (not impl)
115  // iSkip > 0: take only each iSkip event (not impl)
116 
117  Int_t RevStatus(Int_t iOut);
118  // get status information (iOut = 1: also message to stdout)
119  // = 0: last event request successfull
120  // = 1: server not yet connected
121  // = 2: server connected, but still no request for events
122  // = 3: server connection okay, but currently no DAQ events
123  // = 4: connection to server closed
124  // = 5: connection to server closed after user break (CTL C)
125  // = 6: connection to server closed after failure
126 
127  void RevBufWait(Int_t iWait);
128  // wait for iWait seconds
129 
130  Int_t RevBufsize();
131  // get size of current buffer (byte)
132 
133  void RevClose(TSocket* pSocket); // input Socket ptr
134 
135  ClassDef(MRevBuffer, 0);
136 };
137 
138 #endif // !MRevBuffer_H
Short_t subEvtSubType[100]
Definition: MRevBuffer.h:57
Int_t * GetData()
Definition: MRevBuffer.h:52
Int_t RevStatus(Int_t iOut)
Definition: MRevBuffer.cxx:817
void ReFillData(Int_t *pData)
Definition: MRevBuffer.cxx:924
Int_t subEvtSize[100]
Definition: MRevBuffer.h:55
Int_t * RevGetI(TSocket *pSocket, Int_t iFlush)
Definition: MRevBuffer.cxx:218
Short_t subEvtProcId[100]
Definition: MRevBuffer.h:58
void RevClose(TSocket *pSocket)
Definition: MRevBuffer.cxx:849
Short_t subEvtSubCrate[100]
Definition: MRevBuffer.h:59
Short_t subEvtType[100]
Definition: MRevBuffer.h:56
Short_t subEvtControl[100]
Definition: MRevBuffer.h:60
REvent * RevGet(TSocket *pSocket, Int_t iFlush, Int_t iSkip)
Definition: MRevBuffer.cxx:233
Int_t nSubEvt
Definition: MRevBuffer.h:54
TSocket * RevOpen(char *pNode, Int_t iPort, Int_t iEvent)
Definition: MRevBuffer.cxx:162
Int_t ReGetData(Int_t ichan)
Definition: MRevBuffer.cxx:930
Int_t RevBufsize()
Definition: MRevBuffer.cxx:808
void RevBufWait(Int_t iWait)
Definition: MRevBuffer.cxx:810
ClassDef(MRevBuffer, 0)
Int_t ReGetSize()
Definition: MRevBuffer.cxx:928
Int_t * pSubEvt[100]
Definition: MRevBuffer.h:61
Int_t ReGetNumb()
Definition: MRevBuffer.cxx:926
ClassDef(REvent, 0)
void ReFillHead(Int_t *pHead)
Definition: MRevBuffer.cxx:918