CMS 3D CMS Logo

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

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