CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FUProxy.cc
Go to the documentation of this file.
1 // $Id: FUProxy.cc,v 1.7 2011/04/07 08:01:40 mommsen Exp $
3 
7 
8 #include <toolbox/mem/Reference.h>
9 #include <toolbox/mem/MemoryPoolFactory.h>
10 #include <toolbox/mem/exception/Exception.h>
11 
12 #include <i2o/Method.h>
13 #include <i2o/utils/AddressMap.h>
14 
15 #include <xcept/tools.h>
16 
17 #include <iostream>
18 #include <sstream>
19 
20 namespace stor {
21 
23  (
24  xdaq::ApplicationDescriptor *smAppDesc,
25  xdaq::ApplicationDescriptor *fuAppDesc,
26  xdaq::ApplicationContext *smAppContext,
27  toolbox::mem::Pool *msgPool
28  )
29  : smAppDesc_(smAppDesc),
30  fuAppDesc_(fuAppDesc),
31  smAppContext_(smAppContext),
32  msgPool_(msgPool)
33  {}
34 
35  void FUProxy::sendDQMDiscard(const int& rbBufferId)
36  {
38  }
39 
40  void FUProxy::sendDataDiscard(const int& rbBufferId)
41  {
43  }
44 
46  (
47  const int& rbBufferId,
48  const int& msgId,
49  const size_t& msgSize
50  )
51  {
52  try {
53  toolbox::mem::Reference* bufRef=
54  toolbox::mem::getMemoryPoolFactory()->getFrame(msgPool_,msgSize);
55 
56  // message pointer
57  I2O_MESSAGE_FRAME* stdMsg =
58  (I2O_MESSAGE_FRAME*)bufRef->getDataLocation();
59  I2O_PRIVATE_MESSAGE_FRAME* pvtMsg =
60  (I2O_PRIVATE_MESSAGE_FRAME*)stdMsg;
63 
64  // set message frame
65  stdMsg->MessageSize = msgSize >> 2;
66  stdMsg->InitiatorAddress= i2o::utils::getAddressMap()->getTid(smAppDesc_);
67  stdMsg->TargetAddress = i2o::utils::getAddressMap()->getTid(fuAppDesc_);
68  stdMsg->Function = I2O_PRIVATE_MESSAGE;
69  stdMsg->VersionOffset = 0;
70  stdMsg->MsgFlags = 0;
71 
72  // set private message frame
73  pvtMsg->XFunctionCode = msgId;
74  pvtMsg->OrganizationID = XDAQ_ORGANIZATION_ID;
75 
76  // set fu data discard message frame
77  msg->rbBufferID = rbBufferId;
78 
79  // set buffer size
80  bufRef->setDataSize(msgSize);
81 
82  // post frame
83  smAppContext_->postFrame(bufRef,smAppDesc_,fuAppDesc_);
84  }
86  {
87  XCEPT_RETHROW(exception::IgnoredDiscard,
88  "FUProxy failed to allocate buffer reference!", e);
89  }
90  catch (xcept::Exception &e)
91  {
92  XCEPT_RETHROW(exception::IgnoredDiscard,
93  "FUProxy failed to post discard message!", e);
94  }
95  }
96 
97 } // namespace stor
98 
99 
106 
107 
FUProxy(xdaq::ApplicationDescriptor *smAppDesc, xdaq::ApplicationDescriptor *fuAppDesc, xdaq::ApplicationContext *smAppContext, toolbox::mem::Pool *msgPool)
Definition: FUProxy.cc:23
void sendDiscardMsg(const int &rbBufferId, const int &msgId, const size_t &msgSize)
Definition: FUProxy.cc:46
#define I2O_FU_DQM_DISCARD
Definition: i2oEvfMsgs.h:27
void sendDQMDiscard(const int &rbBufferId)
Definition: FUProxy.cc:35
#define I2O_FU_DATA_DISCARD
Definition: i2oEvfMsgs.h:26
void sendDataDiscard(const int &rbBufferId)
Definition: FUProxy.cc:40