#include <EventFilter/ResourceBroker/interface/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_ |
Definition at line 12 of file BUProxy.h.
BUProxy::BUProxy | ( | xdaq::ApplicationDescriptor * | fuAppDesc, | |
xdaq::ApplicationDescriptor * | buAppDesc, | |||
xdaq::ApplicationContext * | fuAppContext, | |||
toolbox::mem::Pool * | i2oPool | |||
) |
Definition at line 35 of file BUProxy.cc.
00039 : fuAppDesc_(fuAppDesc) 00040 , buAppDesc_(buAppDesc) 00041 , fuAppContext_(fuAppContext) 00042 , i2oPool_(i2oPool) 00043 { 00044 00045 }
BUProxy::~BUProxy | ( | ) | [virtual] |
void BUProxy::sendAllocate | ( | const UIntVec_t & | fuResourceIds | ) | throw (evf::Exception) |
Definition at line 60 of file BUProxy.cc.
References buAppDesc_, e, cond::errmsg(), Exception, fuAppContext_, fuAppDesc_, i, i2oPool_, funct::log(), and alivecheck_mergeAndRegister::msg.
Referenced by evf::FUResourceTable::sendAllocate().
00062 { 00063 Logger log=fuAppContext_->getLogger(); 00064 00065 try { 00066 size_t msgSize= 00067 sizeof(I2O_BU_ALLOCATE_MESSAGE_FRAME)+ 00068 sizeof(BU_ALLOCATE)*(fuResourceIds.size()-1); 00069 00070 toolbox::mem::Reference *bufRef= 00071 toolbox::mem::getMemoryPoolFactory()->getFrame(i2oPool_,msgSize); 00072 00073 I2O_MESSAGE_FRAME *stdMsg; 00074 I2O_PRIVATE_MESSAGE_FRAME *pvtMsg; 00075 I2O_BU_ALLOCATE_MESSAGE_FRAME *msg; 00076 00077 stdMsg=(I2O_MESSAGE_FRAME*)bufRef->getDataLocation(); 00078 pvtMsg=(I2O_PRIVATE_MESSAGE_FRAME*)stdMsg; 00079 msg =(I2O_BU_ALLOCATE_MESSAGE_FRAME*)stdMsg; 00080 00081 stdMsg->MessageSize =msgSize >> 2; 00082 stdMsg->InitiatorAddress=i2o::utils::getAddressMap()->getTid(fuAppDesc_); 00083 stdMsg->TargetAddress =i2o::utils::getAddressMap()->getTid(buAppDesc_); 00084 stdMsg->Function =I2O_PRIVATE_MESSAGE; 00085 stdMsg->VersionOffset =0; 00086 stdMsg->MsgFlags =0; // Point-to-point 00087 00088 pvtMsg->XFunctionCode =I2O_BU_ALLOCATE; 00089 pvtMsg->OrganizationID =XDAQ_ORGANIZATION_ID; 00090 00091 msg->n =fuResourceIds.size(); 00092 00093 for(UInt_t i=0;i<fuResourceIds.size();i++) { 00094 msg->allocate[i].fuTransactionId=fuResourceIds[i]; 00095 msg->allocate[i].fset =1; // IGNORED!!! 00096 } 00097 00098 bufRef->setDataSize(msgSize); 00099 00100 fuAppContext_->postFrame(bufRef,fuAppDesc_,buAppDesc_); 00101 } 00102 catch(toolbox::mem::exception::Exception& e) { 00103 string errmsg="Failed to allocate buffer reference."; 00104 LOG4CPLUS_ERROR(log,errmsg); 00105 XCEPT_RETHROW(evf::Exception,errmsg,e); 00106 } 00107 catch(xdaq::exception::ApplicationDescriptorNotFound& e) { 00108 string errmsg="Failed to get tid."; 00109 LOG4CPLUS_ERROR(log,errmsg); 00110 XCEPT_RETHROW(evf::Exception,errmsg,e); 00111 } 00112 catch(xdaq::exception::Exception& e) { 00113 string errmsg="Failed to post 'Allocate' message."; 00114 LOG4CPLUS_ERROR(log,errmsg); 00115 XCEPT_RETHROW(evf::Exception,errmsg,e); 00116 } 00117 }
void BUProxy::sendDiscard | ( | UInt_t | buResourceId | ) | throw (evf::Exception) |
Definition at line 121 of file BUProxy.cc.
References buAppDesc_, e, cond::errmsg(), Exception, fuAppContext_, fuAppDesc_, i2oPool_, funct::log(), and alivecheck_mergeAndRegister::msg.
Referenced by evf::FUResourceTable::buildResource(), and evf::FUResourceTable::sendDiscard().
00123 { 00124 Logger log=fuAppContext_->getLogger(); 00125 00126 try { 00127 size_t msgSize=sizeof(I2O_BU_DISCARD_MESSAGE_FRAME); 00128 00129 toolbox::mem::Reference *bufRef= 00130 toolbox::mem::getMemoryPoolFactory()->getFrame(i2oPool_,msgSize); 00131 00132 I2O_MESSAGE_FRAME *stdMsg=(I2O_MESSAGE_FRAME*)bufRef->getDataLocation(); 00133 I2O_PRIVATE_MESSAGE_FRAME *pvtMsg=(I2O_PRIVATE_MESSAGE_FRAME*)stdMsg; 00134 I2O_BU_DISCARD_MESSAGE_FRAME *msg=(I2O_BU_DISCARD_MESSAGE_FRAME*)stdMsg; 00135 00136 stdMsg->MessageSize =msgSize >> 2; 00137 stdMsg->InitiatorAddress=i2o::utils::getAddressMap()->getTid(fuAppDesc_); 00138 stdMsg->TargetAddress =i2o::utils::getAddressMap()->getTid(buAppDesc_); 00139 stdMsg->Function =I2O_PRIVATE_MESSAGE; 00140 stdMsg->VersionOffset =0; 00141 stdMsg->MsgFlags =0; // Point-to-point 00142 00143 pvtMsg->XFunctionCode =I2O_BU_DISCARD; 00144 pvtMsg->OrganizationID =XDAQ_ORGANIZATION_ID; 00145 00146 msg->n =1; 00147 msg->buResourceId[0] =buResourceId; 00148 00149 bufRef->setDataSize(msgSize); 00150 00151 fuAppContext_->postFrame(bufRef,fuAppDesc_,buAppDesc_); 00152 } 00153 catch (toolbox::mem::exception::Exception& e) { 00154 string errmsg="Failed to allocate buffer reference."; 00155 LOG4CPLUS_ERROR(log,errmsg); 00156 XCEPT_RETHROW(evf::Exception,errmsg,e); 00157 } 00158 catch (xdaq::exception::ApplicationDescriptorNotFound& e) { 00159 string errmsg="Failed to get tid."; 00160 LOG4CPLUS_ERROR(log,errmsg); 00161 XCEPT_RETHROW(evf::Exception,errmsg,e); 00162 } 00163 catch (xdaq::exception::Exception &e) { 00164 string errmsg="Failed to post 'Discard' message."; 00165 LOG4CPLUS_ERROR(log,errmsg); 00166 XCEPT_RETHROW(evf::Exception,errmsg,e); 00167 } 00168 00169 }
xdaq::ApplicationDescriptor* evf::BUProxy::buAppDesc_ [private] |
xdaq::ApplicationContext* evf::BUProxy::fuAppContext_ [private] |
xdaq::ApplicationDescriptor* evf::BUProxy::fuAppDesc_ [private] |
toolbox::mem::Pool* evf::BUProxy::i2oPool_ [private] |