CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

evf::BUFUInterface Class Reference

#include <BUFUInterface.h>

List of all members.

Public Member Functions

void allocate (const UIntVec_t &fuResourceIds, xdaq::ApplicationDescriptor *fuAppDesc)
void discard (UInt_t buResourceId)
 FU->BU DISCARD.
bool registerBU (BaseBU *bu, Logger log)
 register the BU to the interface
bool registerFU (BaseFU *fu, Logger log)
 register the FU to the interface
void take (xdaq::ApplicationDescriptor *fuAppDesc, toolbox::mem::Reference *bufRef)
 BU->FU TAKE.
 ~BUFUInterface ()

Static Public Member Functions

static BUFUInterfaceforceNewInstance ()
static BUFUInterfaceinstance ()
 returns a pointer to a singleton instance of the interface

Private Member Functions

 BUFUInterface ()
 private constructor
bool directConnection () const
 checks if both BU and FU are connected to the interface

Private Attributes

BaseBUbu_
 pointer to connected BU, using BaseBU interface
bool buConn_
 flags for BU, FU connection
Logger buLogger_
 loggers
BaseFUfu_
 pointer to connected ResourceBroker(FU), using BaseFU interface
bool fuConn_
Logger fuLogger_

Static Private Attributes

static BUFUInterfaceinstance_ = 0
 pointer to unique instance

Detailed Description

Definition at line 19 of file BUFUInterface.h.


Constructor & Destructor Documentation

BUFUInterface::~BUFUInterface ( )

Definition at line 19 of file BUFUInterface.cc.

References instance_.

                              {
        // delete instance_;
        instance_ = 0;
}
BUFUInterface::BUFUInterface ( ) [private]

private constructor

Definition at line 155 of file BUFUInterface.cc.

Referenced by forceNewInstance(), and instance().

                             :
        bu_(0), fu_(0), /*buLogger_(0), fuLogger_(0),*/ buConn_(false), fuConn_(false) {

}

Member Function Documentation

void BUFUInterface::allocate ( const UIntVec_t fuResourceIds,
xdaq::ApplicationDescriptor *  fuAppDesc 
)

FU->BU ALLOCATE the FU application description is required by the BU when registering the requesting FU

Definition at line 79 of file BUFUInterface.cc.

References bu_, evf::BaseFU::buildAndSendAllocate(), gather_cfg::cout, evf::BaseBU::DIRECT_BU_ALLOCATE(), directConnection(), and fu_.

                                                      {

        // direct connection -> method call
        if (directConnection()) {

                bu_->DIRECT_BU_ALLOCATE(fuResourceIds, fuAppDesc);

#ifdef BUFU_DEBUG
                std::cout << "ALLOCATE FU->BU message sent directly!" << std::endl;
#endif
        }

        // no connection -> line protocol
        else {
                // call FU to build I2O allocate message and send it
                fu_->buildAndSendAllocate(fuResourceIds);

#ifdef BUFU_DEBUG
                std::cout << "ALLOCATE FU->BU message sent through I2O!" << std::endl;
#endif
        }

}
bool evf::BUFUInterface::directConnection ( ) const [inline, private]

checks if both BU and FU are connected to the interface

Definition at line 60 of file BUFUInterface.h.

Referenced by allocate(), discard(), registerBU(), registerFU(), and take().

void BUFUInterface::discard ( UInt_t  buResourceId)

FU->BU DISCARD.

Definition at line 105 of file BUFUInterface.cc.

References bu_, evf::BaseFU::buildAndSendDiscard(), gather_cfg::cout, evf::BaseBU::DIRECT_BU_DISCARD(), directConnection(), and fu_.

                                               {

        // direct connection -> method call
        if (directConnection()) {

                bu_->DIRECT_BU_DISCARD(buResourceId);

#ifdef BUFU_DEBUG
                std::cout << "DISCARD FU->BU message sent directly!" << std::endl;
#endif
        }

        // no connection -> line protocol
        else {
                // call FU to build I2O discard and send it
                fu_->buildAndSendDiscard(buResourceId);

#ifdef BUFU_DEBUG
                std::cout << "DISCARD FU->BU message sent through I2O!" << std::endl;
#endif
        }

}
BUFUInterface * BUFUInterface::forceNewInstance ( ) [static]

always returns a new instance. used to force I2O communication between BU and FU in the same process

Definition at line 34 of file BUFUInterface.cc.

References BUFUInterface().

                                               {
        return new BUFUInterface();
}
BUFUInterface * BUFUInterface::instance ( ) [static]

returns a pointer to a singleton instance of the interface

Definition at line 25 of file BUFUInterface.cc.

References BUFUInterface(), and instance_.

                                       {
        if (instance_ == 0) {
                instance_ = new BUFUInterface();
        }
        return instance_;

}
bool BUFUInterface::registerBU ( BaseBU bu,
Logger  log 
)

register the BU to the interface

Definition at line 39 of file BUFUInterface.cc.

References bu_, buConn_, buLogger_, directConnection(), create_public_lumi_plots::log, and summarizeEdmComparisonLogfiles::succeeded.

                                                     {
        bool succeeded = false;
        if (bu != 0) {
                bu_ = bu;
                buLogger_ = log;
                buConn_ = true;
                succeeded = true;

#ifdef BUFU_VERBOSE
                LOG4CPLUS_INFO(buLogger_, "BU registered to BUFU interface!");
                if (directConnection()) {
                        LOG4CPLUS_INFO(buLogger_, "BU and FU : DIRECTLY CONNECTED!");
                }
#endif

        }
        return succeeded;
}
bool BUFUInterface::registerFU ( BaseFU fu,
Logger  log 
)

register the FU to the interface

Definition at line 59 of file BUFUInterface.cc.

References buLogger_, directConnection(), fu_, fuConn_, fuLogger_, create_public_lumi_plots::log, and summarizeEdmComparisonLogfiles::succeeded.

                                                     {
        bool succeeded = false;
        if (fu != 0) {
                fu_ = fu;
                fuLogger_ = log;
                fuConn_ = true;
                succeeded = true;

#ifdef BUFU_VERBOSE
                LOG4CPLUS_INFO(fuLogger_, "FU registered to BUFU interface!");
                if (directConnection()) {
                        LOG4CPLUS_INFO(buLogger_, "BU and FU : DIRECTLY CONNECTED!");
                }
#endif

        }
        return succeeded;
}
void BUFUInterface::take ( xdaq::ApplicationDescriptor *  fuAppDesc,
toolbox::mem::Reference *  bufRef 
)

BU->FU TAKE.

Definition at line 130 of file BUFUInterface.cc.

References bu_, gather_cfg::cout, directConnection(), fu_, evf::BaseFU::I2O_FU_TAKE_Callback(), and evf::BaseBU::postI2OFrame().

                                             {

        // direct connection -> method call
        if (directConnection()) {

                fu_->I2O_FU_TAKE_Callback(bufRef);

#ifdef BUFU_DEBUG
                std::cout << "TAKE BU->FU message sent directly!" << std::endl;
#endif
        }

        // no connection -> line protocol
        else {
                bu_->postI2OFrame(fuAppDesc, bufRef);

#ifdef BUFU_DEBUG
                std::cout << "TAKE BU->FU message sent through I2O!" << std::endl;
#endif
        }

}

Member Data Documentation

pointer to connected BU, using BaseBU interface

Definition at line 68 of file BUFUInterface.h.

Referenced by allocate(), discard(), registerBU(), and take().

flags for BU, FU connection

Definition at line 74 of file BUFUInterface.h.

Referenced by registerBU().

loggers

Definition at line 72 of file BUFUInterface.h.

Referenced by registerBU(), and registerFU().

pointer to connected ResourceBroker(FU), using BaseFU interface

Definition at line 70 of file BUFUInterface.h.

Referenced by allocate(), discard(), registerFU(), and take().

Definition at line 74 of file BUFUInterface.h.

Referenced by registerFU().

Definition at line 72 of file BUFUInterface.h.

Referenced by registerFU().

pointer to unique instance

Definition at line 51 of file BUFUInterface.h.

Referenced by instance(), and ~BUFUInterface().