CMS 3D CMS Logo

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

#include <BUFUInterface.h>

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

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

Static Private Attributes

static BUFUInterfaceinstance_ = 0
 pointer to unique instance More...
 

Detailed Description

Definition at line 17 of file BUFUInterface.h.

Constructor & Destructor Documentation

BUFUInterface::~BUFUInterface ( )

Definition at line 19 of file BUFUInterface.cc.

References instance_.

19  {
20  // delete instance_;
21  instance_ = 0;
22 }
static BUFUInterface * instance_
pointer to unique instance
Definition: BUFUInterface.h:49
BUFUInterface::BUFUInterface ( )
private

private constructor

Definition at line 155 of file BUFUInterface.cc.

Referenced by forceNewInstance(), and instance().

155  :
156  bu_(0), fu_(0), /*buLogger_(0), fuLogger_(0),*/ buConn_(false), fuConn_(false) {
157 
158 }
bool buConn_
flags for BU, FU connection
Definition: BUFUInterface.h:72
BaseFU * fu_
pointer to connected ResourceBroker(FU), using BaseFU interface
Definition: BUFUInterface.h:68
BaseBU * bu_
pointer to connected BU, using BaseBU interface
Definition: BUFUInterface.h:66

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_.

80  {
81 
82  // direct connection -> method call
83  if (directConnection()) {
84 
85  bu_->DIRECT_BU_ALLOCATE(fuResourceIds, fuAppDesc);
86 
87 #ifdef BUFU_DEBUG
88  std::cout << "ALLOCATE FU->BU message sent directly!" << std::endl;
89 #endif
90  }
91 
92  // no connection -> line protocol
93  else {
94  // call FU to build I2O allocate message and send it
95  fu_->buildAndSendAllocate(fuResourceIds);
96 
97 #ifdef BUFU_DEBUG
98  std::cout << "ALLOCATE FU->BU message sent through I2O!" << std::endl;
99 #endif
100  }
101 
102 }
virtual void buildAndSendAllocate(const UIntVec_t &fuResourceIds)=0
called by the BUFU Interface to trigger an I2O ALLOCATE message being built and sent ...
BaseFU * fu_
pointer to connected ResourceBroker(FU), using BaseFU interface
Definition: BUFUInterface.h:68
BaseBU * bu_
pointer to connected BU, using BaseBU interface
Definition: BUFUInterface.h:66
bool directConnection() const
checks if both BU and FU are connected to the interface
Definition: BUFUInterface.h:58
tuple cout
Definition: gather_cfg.py:121
virtual void DIRECT_BU_ALLOCATE(const UIntVec_t &fuResourceIds, xdaq::ApplicationDescriptor *fuAppDesc)=0
ALLOCATE called by the BUFU Interface when BU and FU are in the same process.
bool evf::BUFUInterface::directConnection ( ) const
inlineprivate

checks if both BU and FU are connected to the interface

Definition at line 58 of file BUFUInterface.h.

References buConn_, and fuConn_.

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

58  {
59  return buConn_ && fuConn_;
60  }
bool buConn_
flags for BU, FU connection
Definition: BUFUInterface.h:72
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_.

105  {
106 
107  // direct connection -> method call
108  if (directConnection()) {
109 
110  bu_->DIRECT_BU_DISCARD(buResourceId);
111 
112 #ifdef BUFU_DEBUG
113  std::cout << "DISCARD FU->BU message sent directly!" << std::endl;
114 #endif
115  }
116 
117  // no connection -> line protocol
118  else {
119  // call FU to build I2O discard and send it
120  fu_->buildAndSendDiscard(buResourceId);
121 
122 #ifdef BUFU_DEBUG
123  std::cout << "DISCARD FU->BU message sent through I2O!" << std::endl;
124 #endif
125  }
126 
127 }
virtual void DIRECT_BU_DISCARD(UInt_t buResourceId)=0
DISCARD called by the BUFU Interface when BU and FU are in the same process.
BaseFU * fu_
pointer to connected ResourceBroker(FU), using BaseFU interface
Definition: BUFUInterface.h:68
virtual void buildAndSendDiscard(UInt_t buResourceId)=0
called by the BUFU Interface to trigger an I2O DISCARD message being built and sent ...
BaseBU * bu_
pointer to connected BU, using BaseBU interface
Definition: BUFUInterface.h:66
bool directConnection() const
checks if both BU and FU are connected to the interface
Definition: BUFUInterface.h:58
tuple cout
Definition: gather_cfg.py:121
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().

34  {
35  return new BUFUInterface();
36 }
BUFUInterface()
private constructor
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_.

25  {
26  if (instance_ == 0) {
27  instance_ = new BUFUInterface();
28  }
29  return instance_;
30 
31 }
BUFUInterface()
private constructor
static BUFUInterface * instance_
pointer to unique instance
Definition: BUFUInterface.h:49
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.

39  {
40  bool succeeded = false;
41  if (bu != 0) {
42  bu_ = bu;
43  buLogger_ = log;
44  buConn_ = true;
45  succeeded = true;
46 
47 #ifdef BUFU_VERBOSE
48  LOG4CPLUS_INFO(buLogger_, "BU registered to BUFU interface!");
49  if (directConnection()) {
50  LOG4CPLUS_INFO(buLogger_, "BU and FU : DIRECTLY CONNECTED!");
51  }
52 #endif
53 
54  }
55  return succeeded;
56 }
bool buConn_
flags for BU, FU connection
Definition: BUFUInterface.h:72
Logger buLogger_
loggers
Definition: BUFUInterface.h:70
BaseBU * bu_
pointer to connected BU, using BaseBU interface
Definition: BUFUInterface.h:66
bool directConnection() const
checks if both BU and FU are connected to the interface
Definition: BUFUInterface.h:58
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.

59  {
60  bool succeeded = false;
61  if (fu != 0) {
62  fu_ = fu;
63  fuLogger_ = log;
64  fuConn_ = true;
65  succeeded = true;
66 
67 #ifdef BUFU_VERBOSE
68  LOG4CPLUS_INFO(fuLogger_, "FU registered to BUFU interface!");
69  if (directConnection()) {
70  LOG4CPLUS_INFO(buLogger_, "BU and FU : DIRECTLY CONNECTED!");
71  }
72 #endif
73 
74  }
75  return succeeded;
76 }
BaseFU * fu_
pointer to connected ResourceBroker(FU), using BaseFU interface
Definition: BUFUInterface.h:68
Logger buLogger_
loggers
Definition: BUFUInterface.h:70
bool directConnection() const
checks if both BU and FU are connected to the interface
Definition: BUFUInterface.h:58
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().

131  {
132 
133  // direct connection -> method call
134  if (directConnection()) {
135 
136  fu_->I2O_FU_TAKE_Callback(bufRef);
137 
138 #ifdef BUFU_DEBUG
139  std::cout << "TAKE BU->FU message sent directly!" << std::endl;
140 #endif
141  }
142 
143  // no connection -> line protocol
144  else {
145  bu_->postI2OFrame(fuAppDesc, bufRef);
146 
147 #ifdef BUFU_DEBUG
148  std::cout << "TAKE BU->FU message sent through I2O!" << std::endl;
149 #endif
150  }
151 
152 }
virtual void postI2OFrame(xdaq::ApplicationDescriptor *fuAppDesc, toolbox::mem::Reference *bufRef)=0
virtual void I2O_FU_TAKE_Callback(toolbox::mem::Reference *bufRef)=0
function to be performed upon receiving a TAKE from the BU
BaseFU * fu_
pointer to connected ResourceBroker(FU), using BaseFU interface
Definition: BUFUInterface.h:68
BaseBU * bu_
pointer to connected BU, using BaseBU interface
Definition: BUFUInterface.h:66
bool directConnection() const
checks if both BU and FU are connected to the interface
Definition: BUFUInterface.h:58
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

BaseBU* evf::BUFUInterface::bu_
private

pointer to connected BU, using BaseBU interface

Definition at line 66 of file BUFUInterface.h.

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

bool evf::BUFUInterface::buConn_
private

flags for BU, FU connection

Definition at line 72 of file BUFUInterface.h.

Referenced by directConnection(), and registerBU().

Logger evf::BUFUInterface::buLogger_
private

loggers

Definition at line 70 of file BUFUInterface.h.

Referenced by registerBU(), and registerFU().

BaseFU* evf::BUFUInterface::fu_
private

pointer to connected ResourceBroker(FU), using BaseFU interface

Definition at line 68 of file BUFUInterface.h.

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

bool evf::BUFUInterface::fuConn_
private

Definition at line 72 of file BUFUInterface.h.

Referenced by directConnection(), and registerFU().

Logger evf::BUFUInterface::fuLogger_
private

Definition at line 70 of file BUFUInterface.h.

Referenced by registerFU().

BUFUInterface * evf::BUFUInterface::instance_ = 0
staticprivate

pointer to unique instance

Definition at line 49 of file BUFUInterface.h.

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