CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/IOPool/Streamer/interface/InitMessage.h

Go to the documentation of this file.
00001 
00026 #ifndef IOPool_Streamer_InitMessage_h
00027 #define IOPool_Streamer_InitMessage_h
00028 
00029 #include "IOPool/Streamer/interface/MsgTools.h"
00030 #include "IOPool/Streamer/interface/MsgHeader.h"
00031 
00032 struct Version
00033 {
00034   Version(uint32 proto, const uint8* pset):protocol_(proto)
00035   { std::copy(pset,pset+sizeof(pset_id_),&pset_id_[0]); }
00036 
00037   uint8 protocol_; // version of the protocol
00038   unsigned char pset_id_[16]; // parameter set ID
00039 };
00040 
00041 struct InitHeader
00042 {
00043   InitHeader(const Header& h, uint32 run, const Version& v,
00044            uint32 init_header_size=0, uint32 event_header_size=0):
00045     header_(h),version_(v)
00046   {
00047    convert(run,run_); 
00048    convert(init_header_size, init_header_size_);
00049    convert(event_header_size, event_header_size_);
00050   }
00051 
00052   Header header_;
00053   Version version_;
00054   char_uint32 run_;
00055   char_uint32 init_header_size_;
00056   char_uint32 event_header_size_;
00057 };
00058 
00059 class InitMsgView
00060 {
00061 public:
00062 
00063   InitMsgView(void* buf);
00064 
00065   uint32 code() const { return head_.code(); }
00066   uint32 size() const { return head_.size(); }
00067   uint8* startAddress() const { return buf_; }
00068 
00069   uint32 run() const;
00070   uint32 protocolVersion() const;
00071   void pset(uint8* put_here) const;
00072   std::string releaseTag() const;
00073   std::string processName() const;
00074   std::string outputModuleLabel() const;
00075   uint32 outputModuleId() const { return outputModuleId_; }
00076 
00077   void hltTriggerNames(Strings& save_here) const;
00078   void hltTriggerSelections(Strings& save_here) const;
00079   void l1TriggerNames(Strings& save_here) const;
00080 
00081   uint32 get_hlt_bit_cnt() const { return hlt_trig_count_; }
00082   uint32 get_l1_bit_cnt() const { return l1_trig_count_; }
00083 
00084   // needed for streamer file
00085   uint32 descLength() const { return desc_len_; }
00086   const uint8* descData() const { return desc_start_; }
00087   uint32 headerSize() const {return desc_start_-buf_;}
00088   uint32 eventHeaderSize() const;
00089   uint32 adler32_chksum() const {return adler32_chksum_;}
00090   std::string hostName() const;
00091   uint32 hostName_len() const {return host_name_len_;}
00092 
00093 private:
00094   uint8* buf_;
00095   HeaderView head_;
00096 
00097   uint8* release_start_; // points to the string
00098   uint32 release_len_;
00099 
00100   uint8* processName_start_; // points to the string
00101   uint32 processName_len_;
00102 
00103   uint8* outputModuleLabel_start_; // points to the string
00104   uint32 outputModuleLabel_len_;
00105   uint32 outputModuleId_;
00106 
00107   uint8* hlt_trig_start_; // points to the string
00108   uint32 hlt_trig_count_; // number of strings
00109   uint32 hlt_trig_len_; // length of strings character array only
00110   uint8* hlt_select_start_; // points to the string
00111   uint32 hlt_select_count_; // number of strings
00112   uint32 hlt_select_len_; // length of strings character array only
00113   uint8* l1_trig_start_; // points to the string
00114   uint32 l1_trig_count_; // number of strings
00115   uint32 l1_trig_len_; // length of strings character array only
00116   uint32 adler32_chksum_;
00117   uint8* host_name_start_;
00118   uint32 host_name_len_;
00119 
00120   // does not need to be present in the message sent over the network,
00121   // but is needed for the index file
00122   uint8* desc_start_; // point to the bytes
00123   uint32 desc_len_;
00124 };
00125 
00126 #endif
00127