#include <BUProxy.h>
List of all members.
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
Definition at line 12 of file BUProxy.h.
Constructor & Destructor Documentation
BUProxy::BUProxy |
( |
xdaq::ApplicationDescriptor * |
fuAppDesc, |
|
|
xdaq::ApplicationDescriptor * |
buAppDesc, |
|
|
xdaq::ApplicationContext * |
fuAppContext, |
|
|
toolbox::mem::Pool * |
i2oPool |
|
) |
| |
BUProxy::~BUProxy |
( |
| ) |
[virtual] |
Member Function Documentation
Definition at line 60 of file BUProxy.cc.
References Exception, i, funct::log(), and MatrixRunner::msg.
{
Logger log=fuAppContext_->getLogger();
try {
size_t msgSize=
sizeof(I2O_BU_ALLOCATE_MESSAGE_FRAME)+
sizeof(BU_ALLOCATE)*(fuResourceIds.size()-1);
toolbox::mem::Reference *bufRef=
toolbox::mem::getMemoryPoolFactory()->getFrame(i2oPool_,msgSize);
I2O_MESSAGE_FRAME *stdMsg;
I2O_PRIVATE_MESSAGE_FRAME *pvtMsg;
I2O_BU_ALLOCATE_MESSAGE_FRAME *msg;
stdMsg=(I2O_MESSAGE_FRAME*)bufRef->getDataLocation();
pvtMsg=(I2O_PRIVATE_MESSAGE_FRAME*)stdMsg;
msg =(I2O_BU_ALLOCATE_MESSAGE_FRAME*)stdMsg;
stdMsg->MessageSize =msgSize >> 2;
stdMsg->InitiatorAddress=i2o::utils::getAddressMap()->getTid(fuAppDesc_);
stdMsg->TargetAddress =i2o::utils::getAddressMap()->getTid(buAppDesc_);
stdMsg->Function =I2O_PRIVATE_MESSAGE;
stdMsg->VersionOffset =0;
stdMsg->MsgFlags =0;
pvtMsg->XFunctionCode =I2O_BU_ALLOCATE;
pvtMsg->OrganizationID =XDAQ_ORGANIZATION_ID;
msg->n =fuResourceIds.size();
for(UInt_t i=0;i<fuResourceIds.size();i++) {
msg->allocate[i].fuTransactionId=fuResourceIds[i];
msg->allocate[i].fset =1;
}
bufRef->setDataSize(msgSize);
fuAppContext_->postFrame(bufRef,fuAppDesc_,buAppDesc_);
}
catch(toolbox::mem::exception::Exception& e) {
string errmsg="Failed to allocate buffer reference.";
LOG4CPLUS_ERROR(log,errmsg);
XCEPT_RETHROW(evf::Exception,errmsg,e);
}
catch(xdaq::exception::ApplicationDescriptorNotFound& e) {
string errmsg="Failed to get tid.";
LOG4CPLUS_ERROR(log,errmsg);
XCEPT_RETHROW(evf::Exception,errmsg,e);
}
catch(xdaq::exception::Exception& e) {
string errmsg="Failed to post 'Allocate' message.";
LOG4CPLUS_ERROR(log,errmsg);
XCEPT_RETHROW(evf::Exception,errmsg,e);
}
}
Definition at line 121 of file BUProxy.cc.
References Exception, funct::log(), and MatrixRunner::msg.
{
Logger log=fuAppContext_->getLogger();
try {
size_t msgSize=sizeof(I2O_BU_DISCARD_MESSAGE_FRAME);
toolbox::mem::Reference *bufRef=
toolbox::mem::getMemoryPoolFactory()->getFrame(i2oPool_,msgSize);
I2O_MESSAGE_FRAME *stdMsg=(I2O_MESSAGE_FRAME*)bufRef->getDataLocation();
I2O_PRIVATE_MESSAGE_FRAME *pvtMsg=(I2O_PRIVATE_MESSAGE_FRAME*)stdMsg;
I2O_BU_DISCARD_MESSAGE_FRAME *msg=(I2O_BU_DISCARD_MESSAGE_FRAME*)stdMsg;
stdMsg->MessageSize =msgSize >> 2;
stdMsg->InitiatorAddress=i2o::utils::getAddressMap()->getTid(fuAppDesc_);
stdMsg->TargetAddress =i2o::utils::getAddressMap()->getTid(buAppDesc_);
stdMsg->Function =I2O_PRIVATE_MESSAGE;
stdMsg->VersionOffset =0;
stdMsg->MsgFlags =0;
pvtMsg->XFunctionCode =I2O_BU_DISCARD;
pvtMsg->OrganizationID =XDAQ_ORGANIZATION_ID;
msg->n =1;
msg->buResourceId[0] =buResourceId;
bufRef->setDataSize(msgSize);
fuAppContext_->postFrame(bufRef,fuAppDesc_,buAppDesc_);
}
catch (toolbox::mem::exception::Exception& e) {
string errmsg="Failed to allocate buffer reference.";
LOG4CPLUS_ERROR(log,errmsg);
XCEPT_RETHROW(evf::Exception,errmsg,e);
}
catch (xdaq::exception::ApplicationDescriptorNotFound& e) {
string errmsg="Failed to get tid.";
LOG4CPLUS_ERROR(log,errmsg);
XCEPT_RETHROW(evf::Exception,errmsg,e);
}
catch (xdaq::exception::Exception &e) {
string errmsg="Failed to post 'Discard' message.";
LOG4CPLUS_ERROR(log,errmsg);
XCEPT_RETHROW(evf::Exception,errmsg,e);
}
}
Member Data Documentation