CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/EventFilter/ResourceBroker/src/IPCManager.cc

Go to the documentation of this file.
00001 
00002 //
00003 // IPCManager.cc
00004 // -------
00005 //
00006 //  Created on: Oct 26, 2011
00007 //                                                                              Andrei Spataru : aspataru@cern.ch
00009 
00010 #include "EventFilter/ResourceBroker/interface/IPCManager.h"
00011 #include "EventFilter/ResourceBroker/interface/FUResourceTable.h"
00012 #include "EventFilter/ResourceBroker/interface/FUResourceQueue.h"
00013 
00014 using std::cout;
00015 using std::endl;
00016 using namespace evf;
00017 
00018 //______________________________________________________________________________
00019 IPCManager::IPCManager(bool useMQ) :
00020         useMessageQueueIPC_(useMQ) {
00021 }
00022 
00023 //______________________________________________________________________________
00024 IPCManager::~IPCManager() {
00025         delete ipc_;
00026 }
00027 
00028 //______________________________________________________________________________
00029 void IPCManager::initialise(bool segmentationMode, UInt_t nbRawCells,
00030                 UInt_t nbRecoCells, UInt_t nbDqmCells, UInt_t rawCellSize,
00031                 UInt_t recoCellSize, UInt_t dqmCellSize, int freeResReq, BUProxy* bu, SMProxy* sm,
00032                 log4cplus::Logger logger, unsigned int resourceStructureTimeout,
00033                 EvffedFillerRB* frb, xdaq::Application* app) throw (evf::Exception) {
00034 
00035         // XXX: MQ IPC is disabled until it is ready
00036         useMessageQueueIPC_ = false;
00037 
00038         if (!useMessageQueueIPC_) {
00039                 // IPC communication type is SharedMemory
00040                 //improve replace with logging
00041                 cout << "IPCMANAGER:: ----> IPC communication type is Shared Memory!"
00042                                 << endl;
00043 
00044                 ipc_ = new FUResourceTable(segmentationMode, nbRawCells, nbRecoCells,
00045                                 nbDqmCells, rawCellSize, recoCellSize, dqmCellSize, freeResReq, bu, sm,
00046                                 logger, resourceStructureTimeout, frb, app);
00047         } else {
00048                 // IPC communication type is MessageQueue
00049                 cout << "IPCMANAGER:: ----> IPC communication type is Message Queue!"
00050                                 << endl;
00051 
00052                 ipc_ = new FUResourceQueue(segmentationMode, nbRawCells, nbRecoCells,
00053                                 nbDqmCells, rawCellSize, recoCellSize, dqmCellSize, freeResReq, bu, sm,
00054                                 logger, resourceStructureTimeout, frb, app);
00055         }
00056 }
00057 
00058 //______________________________________________________________________________
00059 IPCMethod* const IPCManager::ipc() {
00060         return ipc_;
00061 }