CMS 3D CMS Logo

edm::FUShmOutputModule Class Reference

#include <EventFilter/Modules/src/FUShmOutputModule.h>

List of all members.

Public Member Functions

void doOutputEvent (EventMsgBuilder const &eventMessage)
void doOutputHeader (InitMsgBuilder const &initMessage)
 FUShmOutputModule (edm::ParameterSet const &ps)
void start ()
void stop ()
 ~FUShmOutputModule ()

Private Attributes

evf::FUShmBuffershmBuffer_

Static Private Attributes

static uint32 fuGuidValue_ = 0
static bool fuIdsInitialized_ = false
 Initialize the static variables for the filter unit identifiers.
static uint32 fuProcId_ = 0


Detailed Description

Definition at line 48 of file FUShmOutputModule.h.


Constructor & Destructor Documentation

edm::FUShmOutputModule::FUShmOutputModule ( edm::ParameterSet const &  ps  ) 

Definition at line 44 of file FUShmOutputModule.cc.

References lat::endl(), FDEBUG, fuGuidValue_, fuIdsInitialized_, fuProcId_, L, and edm::Guid::toString().

00044                                                                :
00045     shmBuffer_(0)
00046   {
00047     FDEBUG(9) << "FUShmOutputModule: constructor" << endl;
00048 
00049     if (! fuIdsInitialized_) {
00050       fuIdsInitialized_ = true;
00051 
00052       edm::Guid guidObj(true);
00053       std::string guidString = guidObj.toString();
00054       //std::cout << "EventOutput GUID string = " << guidString << std::endl;
00055 
00056       uLong crc = crc32(0L, Z_NULL, 0);
00057       Bytef* buf = (Bytef*)guidString.data();
00058       crc = crc32(crc, buf, guidString.length());
00059       fuGuidValue_ = crc;
00060 
00061       fuProcId_ = getpid();
00062       //std::cout << "EventOutput GUID value = 0x" << std::hex << fuGuidValue_ << std::dec
00063       //          << " for PID = " << fuProcId_ << std::endl;
00064     }
00065   }
  

edm::FUShmOutputModule::~FUShmOutputModule (  ) 

Definition at line 67 of file FUShmOutputModule.cc.

References SM_SharedMemoryHandle::detachShmBuffer(), lat::endl(), and FDEBUG.

00068   {
00069     FDEBUG(9) << "FUShmOutputModule: FUShmOutputModule destructor" << endl;
00070     sm_sharedmemory.detachShmBuffer();
00071     //shmdt(shmBuffer_);
00072   }


Member Function Documentation

void edm::FUShmOutputModule::doOutputEvent ( EventMsgBuilder const &  eventMessage  ) 

Definition at line 97 of file FUShmOutputModule.cc.

References lat::endl(), FDEBUG, fuGuidValue_, fuProcId_, SM_SharedMemoryHandle::getShmBuffer(), shmBuffer_, size, EventMsgBuilder::size(), EventMsgBuilder::startAddress(), and evf::FUShmBuffer::writeRecoEventData().

00098   {
00099     if(!shmBuffer_) edm::LogError("FUShmOutputModule") 
00100       << " Invalid shared memory buffer at first event"
00101       << " Make sure you configure the ResourceBroker before the FUEventProcessor! "
00102       << " No event is sent - this is fatal! Should throw here";
00103     else
00104     {
00105       unsigned char* buffer = (unsigned char*) eventMessage.startAddress();
00106       unsigned int size = eventMessage.size();
00107       EventMsgView eventView(eventMessage.startAddress());
00108       unsigned int runid = eventView.run();
00109       unsigned int eventid = eventView.event();
00110       unsigned int outModId = eventView.outModId();
00111       FDEBUG(10) << "FUShmOutputModule: event size = " << size << std::endl;
00112       //bool ret = shmBuffer_->writeRecoEventData(runid, eventid, outModId, buffer, size);
00113       bool ret = sm_sharedmemory.getShmBuffer()->writeRecoEventData(runid, eventid, outModId, fuProcId_, fuGuidValue_, buffer, size);
00114       if(!ret) edm::LogError("FUShmOutputModule") << " Error with writing data to ShmBuffer";
00115     }
00116   }

void edm::FUShmOutputModule::doOutputHeader ( InitMsgBuilder const &  initMessage  ) 

Definition at line 74 of file FUShmOutputModule.cc.

References lat::endl(), FDEBUG, fuGuidValue_, fuProcId_, SM_SharedMemoryHandle::getShmBuffer(), InitMsgView::outputModuleId(), shmBuffer_, InitMsgBuilder::size(), size, InitMsgBuilder::startAddress(), and evf::FUShmBuffer::writeRecoInitMsg().

00075   {
00076     //if(!shmBuffer_) shmBuffer_ = evf::FUShmBuffer::getShmBuffer();
00077     if(!shmBuffer_) shmBuffer_ = sm_sharedmemory.getShmBuffer();
00078     if(!shmBuffer_) edm::LogError("FUShmOutputModule") 
00079       << " Error getting shared memory buffer for INIT. " 
00080       << " Make sure you configure the ResourceBroker before the FUEventProcessor! "
00081       << " No INIT is sent - this is probably fatal!";
00082     if(shmBuffer_)
00083     {
00084       unsigned char* buffer = (unsigned char*) initMessage.startAddress();
00085       unsigned int size = initMessage.size();
00086       FDEBUG(10) << "writing out INIT message with size = " << size << std::endl;
00087       // no method in InitMsgBuilder to get the output module id, recast
00088       InitMsgView dummymsg(buffer);
00089       uint32 dmoduleId = dummymsg.outputModuleId();
00090 
00091       //bool ret = shmBuffer_->writeRecoInitMsg(dmoduleId, buffer, size);
00092       bool ret = sm_sharedmemory.getShmBuffer()->writeRecoInitMsg(dmoduleId, fuProcId_, fuGuidValue_, buffer, size);
00093       if(!ret) edm::LogError("FUShmOutputModule") << " Error writing preamble to ShmBuffer";
00094     }
00095   }

void edm::FUShmOutputModule::start ( void   ) 

Definition at line 118 of file FUShmOutputModule.cc.

References SM_SharedMemoryHandle::getShmBuffer(), and shmBuffer_.

00119   {
00120     //shmBuffer_ = evf::FUShmBuffer::getShmBuffer();
00121     shmBuffer_ = sm_sharedmemory.getShmBuffer();
00122     if(0==shmBuffer_) 
00123       edm::LogError("FUShmOutputModule")<<"Failed to attach to shared memory";
00124   }

void edm::FUShmOutputModule::stop (  ) 

Definition at line 126 of file FUShmOutputModule.cc.

References SM_SharedMemoryHandle::detachShmBuffer(), lat::endl(), FDEBUG, and shmBuffer_.

00127   {
00128     FDEBUG(9) << "FUShmOutputModule: sending terminate run" << std::endl;
00129     if(0!=shmBuffer_){
00130       sm_sharedmemory.detachShmBuffer();
00131       //shmdt(shmBuffer_);
00132       shmBuffer_ = 0;
00133     }
00134   }


Member Data Documentation

uint32 edm::FUShmOutputModule::fuGuidValue_ = 0 [static, private]

Definition at line 66 of file FUShmOutputModule.h.

Referenced by doOutputEvent(), doOutputHeader(), and FUShmOutputModule().

bool edm::FUShmOutputModule::fuIdsInitialized_ = false [static, private]

Initialize the static variables for the filter unit identifiers.

Definition at line 64 of file FUShmOutputModule.h.

Referenced by FUShmOutputModule().

uint32 edm::FUShmOutputModule::fuProcId_ = 0 [static, private]

Definition at line 65 of file FUShmOutputModule.h.

Referenced by doOutputEvent(), doOutputHeader(), and FUShmOutputModule().

evf::FUShmBuffer* edm::FUShmOutputModule::shmBuffer_ [private]

Definition at line 62 of file FUShmOutputModule.h.

Referenced by doOutputEvent(), doOutputHeader(), start(), and stop().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:41:02 2009 for CMSSW by  doxygen 1.5.4