![]() |
![]() |
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.7 2011/04/14 15:24:51 mommsen 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 #include <iostream> 00020 00021 // Data structure to be shared by all output modules for event serialization 00022 struct SM_SharedMemoryHandle 00023 { 00024 SM_SharedMemoryHandle(): 00025 shmBuffer_(0) 00026 { } 00027 00028 evf::FUShmBuffer* getShmBuffer() { 00029 if(!shmBuffer_) { 00030 shmBuffer_ = evf::FUShmBuffer::getShmBuffer(); 00031 return shmBuffer_; 00032 } else { 00033 return shmBuffer_; 00034 } 00035 } 00036 void detachShmBuffer() { 00037 if(!shmBuffer_) { 00038 // no shared memory was attached to! 00039 } else { 00040 shmdt(shmBuffer_); 00041 shmBuffer_ = 0; 00042 } 00043 } 00044 00045 evf::FUShmBuffer* shmBuffer_; 00046 }; 00047 00048 namespace edm 00049 { 00050 class ParameterSetDescription; 00051 class FUShmOutputModule 00052 { 00053 public: 00054 00055 FUShmOutputModule(edm::ParameterSet const& ps); 00056 ~FUShmOutputModule(); 00057 00058 void doOutputHeader(InitMsgBuilder const& initMessage); 00059 void doOutputEvent(EventMsgBuilder const& eventMessage); 00060 unsigned int getCounts(){ 00061 return count_; 00062 } 00063 void start(); 00064 void stop(); 00065 // No parameters. 00066 static void fillDescription(ParameterSetDescription&) {} 00067 00068 private: 00069 00070 evf::FUShmBuffer* shmBuffer_; 00071 std::string name_; 00072 unsigned int count_; 00073 00074 static bool fuIdsInitialized_; 00075 static uint32 fuGuidValue_; 00076 00077 }; 00078 } 00079 00080 #endif