00001 #ifndef _FUShmOutputModule_h 00002 #define _FUShmOutputModule_h 00003 00004 /* 00005 Description: 00006 Header file shared memory to be used with FUShmOutputModule. 00007 See CMS EvF Storage Manager wiki page for further notes. 00008 00009 $Id: FUShmOutputModule.h,v 1.4 2008/10/14 13:19:50 biery Exp $ 00010 */ 00011 00012 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00013 00014 #include "IOPool/Streamer/interface/InitMsgBuilder.h" 00015 #include "IOPool/Streamer/interface/EventMsgBuilder.h" 00016 00017 #include "EventFilter/ShmBuffer/interface/FUShmBuffer.h" 00018 00019 // Data structure to be shared by all output modules for event serialization 00020 struct SM_SharedMemoryHandle 00021 { 00022 SM_SharedMemoryHandle(): 00023 shmBuffer_(0) 00024 { } 00025 00026 evf::FUShmBuffer* getShmBuffer() { 00027 if(!shmBuffer_) { 00028 shmBuffer_ = evf::FUShmBuffer::getShmBuffer(); 00029 return shmBuffer_; 00030 } else { 00031 return shmBuffer_; 00032 } 00033 } 00034 void detachShmBuffer() { 00035 if(!shmBuffer_) { 00036 // no shared memory was attached to! 00037 } else { 00038 shmdt(shmBuffer_); 00039 shmBuffer_ = 0; 00040 } 00041 } 00042 00043 evf::FUShmBuffer* shmBuffer_; 00044 }; 00045 00046 namespace edm 00047 { 00048 class FUShmOutputModule 00049 { 00050 public: 00051 00052 FUShmOutputModule(edm::ParameterSet const& ps); 00053 ~FUShmOutputModule(); 00054 00055 void doOutputHeader(InitMsgBuilder const& initMessage); 00056 void doOutputEvent(EventMsgBuilder const& eventMessage); 00057 void start(); 00058 void stop(); 00059 00060 private: 00061 00062 evf::FUShmBuffer* shmBuffer_; 00063 00064 static bool fuIdsInitialized_; 00065 static uint32 fuProcId_; 00066 static uint32 fuGuidValue_; 00067 00068 }; 00069 } 00070 00071 #endif