00001 #ifndef FUSHMRAWCELL_H 00002 #define FUSHMRAWCELL_H 1 00003 00004 #include <assert.h> 00005 00006 namespace evf { 00007 namespace evt { 00008 enum Type_t { NOP, STOPPER, EOL, DATA}; 00009 } 00010 class FUShmRawCell 00011 { 00012 public: 00013 // 00014 // construction/destruction 00015 // 00016 FUShmRawCell(unsigned int payloadSize); 00017 ~FUShmRawCell(); 00018 00019 00020 // 00021 // member functions 00022 // 00023 void initialize(unsigned int index); 00024 00025 unsigned int index() const { return index_; } 00026 unsigned int fuResourceId() const { return fuResourceId_; } 00027 unsigned int buResourceId() const { return buResourceId_; } 00028 unsigned int evtNumber() const { return evtNumber_; } 00029 00030 unsigned int payloadSize() const { return payloadSize_; } 00031 unsigned char* payloadAddr() const; 00032 00033 unsigned int nFed() const { return nFed_; } 00034 unsigned int fedSize(unsigned int i) const; 00035 unsigned char* fedAddr(unsigned int i) const; 00036 00037 unsigned int nSuperFrag() const { return nSuperFrag_; } 00038 unsigned int superFragSize(unsigned int i) const; 00039 unsigned char* superFragAddr(unsigned int i) const; 00040 00041 unsigned int eventSize() const; 00042 00043 void setFuResourceId(unsigned int id) { fuResourceId_=id; } 00044 void setBuResourceId(unsigned int id) { buResourceId_=id; } 00045 void setEvtNumber(unsigned int evt) { evtNumber_ =evt; } 00046 00047 void clear(); 00048 void dump() const; 00049 00050 unsigned int readFed(unsigned int i,unsigned char*buffer) const; 00051 unsigned char* writeData(unsigned char*data,unsigned int dataSize); 00052 00053 bool markFed(unsigned int i,unsigned int size,unsigned char*addr); 00054 bool markSuperFrag(unsigned int i,unsigned int size,unsigned char*addr); 00055 00056 void setLumiSection(unsigned int); 00057 void setEventTypeData() 00058 {assert(eventType_ == evt::NOP); 00059 eventType_ = evt::DATA; 00060 } 00061 void setEventTypeEol() 00062 {assert(eventType_ == evt::NOP); 00063 eventType_ = evt::EOL; 00064 } 00065 void setEventTypeStopper() 00066 {assert(eventType_ == evt::NOP); 00067 eventType_ = evt::STOPPER; 00068 } 00069 unsigned int getEventType() const {return eventType_;} 00070 unsigned int getLumiSection() const {return lumiSection_;} 00071 // 00072 // static member functions 00073 // 00074 static unsigned int size(unsigned int payloadSize); 00075 00076 00077 private: 00078 // 00079 // member data 00080 // 00081 unsigned int index_; 00082 unsigned int fuResourceId_; 00083 unsigned int buResourceId_; 00084 unsigned int evtNumber_; 00085 unsigned int payloadSize_; 00086 unsigned int nFed_; 00087 unsigned int nSuperFrag_; 00088 unsigned int lumiSection_; 00089 unsigned int eventType_; 00090 unsigned int fedSizeOffset_; 00091 unsigned int fedOffset_; 00092 unsigned int superFragSizeOffset_; 00093 unsigned int superFragOffset_; 00094 unsigned int payloadOffset_; 00095 unsigned int payloadPosition_; 00096 00097 }; 00098 00099 00100 } // namespace evf 00101 00102 00103 #endif