CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
evf::BUProxy Class Reference

#include <BUProxy.h>

Public Member Functions

 BUProxy (xdaq::ApplicationDescriptor *fuAppDesc, xdaq::ApplicationDescriptor *buAppDesc, xdaq::ApplicationContext *fuAppContext, toolbox::mem::Pool *i2oPool)
 
void sendAllocate (const UIntVec_t &fuResourceIds) throw (evf::Exception)
 
void sendDiscard (UInt_t buResourceId) throw (evf::Exception)
 
virtual ~BUProxy ()
 

Private Attributes

xdaq::ApplicationDescriptor * buAppDesc_
 
xdaq::ApplicationContext * fuAppContext_
 
xdaq::ApplicationDescriptor * fuAppDesc_
 
toolbox::mem::Pool * i2oPool_
 

Detailed Description

Proxy for BuilderUnit

Definition at line 21 of file BUProxy.h.

Constructor & Destructor Documentation

BUProxy::BUProxy ( xdaq::ApplicationDescriptor *  fuAppDesc,
xdaq::ApplicationDescriptor *  buAppDesc,
xdaq::ApplicationContext *  fuAppContext,
toolbox::mem::Pool *  i2oPool 
)

Definition at line 33 of file BUProxy.cc.

35  :
36  fuAppDesc_(fuAppDesc), buAppDesc_(buAppDesc), fuAppContext_(fuAppContext),
37  i2oPool_(i2oPool) {
38 
39 }
xdaq::ApplicationDescriptor * buAppDesc_
Definition: BUProxy.h:51
xdaq::ApplicationDescriptor * fuAppDesc_
Definition: BUProxy.h:50
xdaq::ApplicationContext * fuAppContext_
Definition: BUProxy.h:52
toolbox::mem::Pool * i2oPool_
Definition: BUProxy.h:53
BUProxy::~BUProxy ( )
virtual

Definition at line 42 of file BUProxy.cc.

42  {
43 
44 }

Member Function Documentation

void BUProxy::sendAllocate ( const UIntVec_t fuResourceIds)
throw (evf::Exception
)

Send allocate message to BU

Definition at line 51 of file BUProxy.cc.

References alignCSCRings::e, edm::hlt::Exception, i, create_public_lumi_plots::log, and lumiQueryAPI::msg.

Referenced by evf::IPCMethod::sendAllocate().

52  {
53  Logger log = fuAppContext_->getLogger();
54 
55  try {
56  size_t msgSize = sizeof(I2O_BU_ALLOCATE_MESSAGE_FRAME)
57  + sizeof(BU_ALLOCATE) * (fuResourceIds.size() - 1);
58 
59  toolbox::mem::Reference *bufRef =
60  toolbox::mem::getMemoryPoolFactory()->getFrame(i2oPool_,
61  msgSize);
62 
63  I2O_MESSAGE_FRAME *stdMsg;
64  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg;
65  I2O_BU_ALLOCATE_MESSAGE_FRAME *msg;
66 
67  stdMsg = (I2O_MESSAGE_FRAME*) bufRef->getDataLocation();
68  pvtMsg = (I2O_PRIVATE_MESSAGE_FRAME*) stdMsg;
69  msg = (I2O_BU_ALLOCATE_MESSAGE_FRAME*) stdMsg;
70 
71  stdMsg->MessageSize = msgSize >> 2;
72  stdMsg->InitiatorAddress = i2o::utils::getAddressMap()->getTid(
73  fuAppDesc_);
74  stdMsg->TargetAddress = i2o::utils::getAddressMap()->getTid(buAppDesc_);
75  stdMsg->Function = I2O_PRIVATE_MESSAGE;
76  stdMsg->VersionOffset = 0;
77  stdMsg->MsgFlags = 0; // Point-to-point
78 
79  pvtMsg->XFunctionCode = I2O_BU_ALLOCATE;
80  pvtMsg->OrganizationID = XDAQ_ORGANIZATION_ID;
81 
82  msg->n = fuResourceIds.size();
83 
84  for (UInt_t i = 0; i < fuResourceIds.size(); i++) {
85  msg->allocate[i].fuTransactionId = fuResourceIds[i];
86  msg->allocate[i].fset = 1; // IGNORED!!!
87  }
88 
89  bufRef->setDataSize(msgSize);
90 
91  fuAppContext_->postFrame(bufRef, fuAppDesc_, buAppDesc_);
93  string errmsg = "Failed to allocate buffer reference.";
94  LOG4CPLUS_ERROR(log, errmsg);
95  XCEPT_RETHROW(evf::Exception, errmsg, e);
96  } catch (xdaq::exception::ApplicationDescriptorNotFound& e) {
97  string errmsg = "Failed to get tid.";
98  LOG4CPLUS_ERROR(log, errmsg);
99  XCEPT_RETHROW(evf::Exception, errmsg, e);
100  } catch (xdaq::exception::Exception& e) {
101  string errmsg = "Failed to post 'Allocate' message.";
102  LOG4CPLUS_ERROR(log, errmsg);
103  XCEPT_RETHROW(evf::Exception, errmsg, e);
104  }
105 }
xdaq::ApplicationDescriptor * buAppDesc_
Definition: BUProxy.h:51
int i
Definition: DBlmapReader.cc:9
xdaq::ApplicationDescriptor * fuAppDesc_
Definition: BUProxy.h:50
xdaq::ApplicationContext * fuAppContext_
Definition: BUProxy.h:52
toolbox::mem::Pool * i2oPool_
Definition: BUProxy.h:53
unsigned int UInt_t
Definition: FUTypes.h:12
void BUProxy::sendDiscard ( UInt_t  buResourceId)
throw (evf::Exception
)

Send discard message to BU

Definition at line 108 of file BUProxy.cc.

References alignCSCRings::e, edm::hlt::Exception, create_public_lumi_plots::log, and lumiQueryAPI::msg.

Referenced by evf::FUResourceQueue::buildResource(), and evf::IPCMethod::sendDiscard().

108  {
109  Logger log = fuAppContext_->getLogger();
110 
111  try {
112  size_t msgSize = sizeof(I2O_BU_DISCARD_MESSAGE_FRAME);
113 
114  toolbox::mem::Reference *bufRef =
115  toolbox::mem::getMemoryPoolFactory()->getFrame(i2oPool_,
116  msgSize);
117 
118  I2O_MESSAGE_FRAME *stdMsg =
119  (I2O_MESSAGE_FRAME*) bufRef->getDataLocation();
120  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg = (I2O_PRIVATE_MESSAGE_FRAME*) stdMsg;
121  I2O_BU_DISCARD_MESSAGE_FRAME *msg =
122  (I2O_BU_DISCARD_MESSAGE_FRAME*) stdMsg;
123 
124  stdMsg->MessageSize = msgSize >> 2;
125  stdMsg->InitiatorAddress = i2o::utils::getAddressMap()->getTid(
126  fuAppDesc_);
127  stdMsg->TargetAddress = i2o::utils::getAddressMap()->getTid(buAppDesc_);
128  stdMsg->Function = I2O_PRIVATE_MESSAGE;
129  stdMsg->VersionOffset = 0;
130  stdMsg->MsgFlags = 0; // Point-to-point
131 
132  pvtMsg->XFunctionCode = I2O_BU_DISCARD;
133  pvtMsg->OrganizationID = XDAQ_ORGANIZATION_ID;
134 
135  msg->n = 1;
136  msg->buResourceId[0] = buResourceId;
137 
138  bufRef->setDataSize(msgSize);
139 
140  fuAppContext_->postFrame(bufRef, fuAppDesc_, buAppDesc_);
142  string errmsg = "Failed to allocate buffer reference.";
143  LOG4CPLUS_ERROR(log, errmsg);
144  XCEPT_RETHROW(evf::Exception, errmsg, e);
145  } catch (xdaq::exception::ApplicationDescriptorNotFound& e) {
146  string errmsg = "Failed to get tid.";
147  LOG4CPLUS_ERROR(log, errmsg);
148  XCEPT_RETHROW(evf::Exception, errmsg, e);
149  } catch (xdaq::exception::Exception &e) {
150  string errmsg = "Failed to post 'Discard' message.";
151  LOG4CPLUS_ERROR(log, errmsg);
152  XCEPT_RETHROW(evf::Exception, errmsg, e);
153  }
154 
155 }
xdaq::ApplicationDescriptor * buAppDesc_
Definition: BUProxy.h:51
xdaq::ApplicationDescriptor * fuAppDesc_
Definition: BUProxy.h:50
xdaq::ApplicationContext * fuAppContext_
Definition: BUProxy.h:52
toolbox::mem::Pool * i2oPool_
Definition: BUProxy.h:53

Member Data Documentation

xdaq::ApplicationDescriptor* evf::BUProxy::buAppDesc_
private

Definition at line 51 of file BUProxy.h.

xdaq::ApplicationContext* evf::BUProxy::fuAppContext_
private

Definition at line 52 of file BUProxy.h.

xdaq::ApplicationDescriptor* evf::BUProxy::fuAppDesc_
private

Definition at line 50 of file BUProxy.h.

toolbox::mem::Pool* evf::BUProxy::i2oPool_
private

Definition at line 53 of file BUProxy.h.