DABC (Data Acquisition Backbone Core)  2.9.9
Worker.cxx
Go to the documentation of this file.
1 /********************************************************************
2  * The Data Acquisition Backbone Core (DABC)
3  ********************************************************************
4  * Copyright (C) 2009-
5  * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
6  * Planckstr. 1
7  * 64291 Darmstadt
8  * Germany
9  * Contact: http://dabc.gsi.de
10  ********************************************************************
11  * This software can be used under the GPL license agreements as stated
12  * in LICENSE.txt file which is part of the distribution.
13  ********************************************************************/
14 
15 #include "verbs/Worker.h"
16 
17 #include "dabc/Command.h"
18 #include "dabc/ConnectionManager.h"
19 
20 #include "verbs/Device.h"
21 #include "verbs/QueuePair.h"
22 #include "verbs/ComplQueue.h"
23 #include "verbs/MemoryPool.h"
24 #include "verbs/Thread.h"
25 
27  0xFF, 0x12, 0xA0, 0x1C,
28  0xFE, 0x80, 0x00, 0x00,
29  0x00, 0x00, 0x00, 0x00,
30  0x33, 0x44, 0x55, 0x66
31  } };
32 
33 
35  dabc::WorkerAddon("verbs"),
36  fQP(qp)
37 {
38 }
39 
41 {
42  CloseQP();
43 }
44 
46 {
47  return verbs::typeThread;
48 }
49 
50 void verbs::WorkerAddon::SetQP(QueuePair* qp)
51 {
52  CloseQP();
53  fQP = qp;
54 }
55 
57 {
58  if (fQP!=0) {
59  delete fQP;
60  fQP = 0;
61  }
62 }
63 
65 {
66  QueuePair* qp = fQP;
67  fQP = 0;
68  return qp;
69 }
70 
71 
73 {
74  switch (evnt.GetCode()) {
75 
76  case evntVerbsSendCompl:
77  VerbsProcessSendCompl(evnt.GetArg());
78  break;
79 
80  case evntVerbsRecvCompl:
81  VerbsProcessRecvCompl(evnt.GetArg());
82  break;
83 
84  case evntVerbsError:
85  VerbsProcessOperError(evnt.GetArg());
86  break;
87 
88  default:
90  }
91 }
92 
virtual void ProcessEvent(const EventId &)
Definition: Worker.h:60
Represent VERBS queue pair functionality.
Definition: QueuePair.h:37
Addon for VERBS thread
Definition: Worker.h:39
void SetQP(QueuePair *qp)
Definition: Worker.cxx:50
QueuePair * TakeQP()
Definition: Worker.cxx:64
virtual ~WorkerAddon()
Definition: Worker.cxx:40
virtual std::string RequiredThrdClass() const
Definition: Worker.cxx:45
WorkerAddon(QueuePair *qp)
Definition: Worker.cxx:34
virtual void ProcessEvent(const dabc::EventId &)
Definition: Worker.cxx:72
Event manipulation API.
Definition: api.h:23
const char * typeThread
Definition: Context.cxx:36
ibv_gid VerbsConnThrd_Multi_Gid
Definition: Worker.cxx:26
Event structure, exchanged between DABC threads.
Definition: Thread.h:70
uint32_t GetArg() const
Definition: Thread.h:94
uint16_t GetCode() const
Definition: Thread.h:92