#include <EventFilter/CSCRawToDigi/interface/CSCDDUDataItr.h>
Public Member Functions | |
CSCDDUDataItr (const CSCDDUDataItr &) | |
if I own the data, I need to do special copy & assign | |
CSCDDUDataItr (const CSCDDUEventData *dduData) | |
uses someone else's data, so doesn't delete | |
CSCDDUDataItr (const char *buf) | |
construct from data buffer. so makes a new DDUEventData | |
CSCDDUDataItr () | |
default constructor | |
bool | next () |
const CSCEventData & | operator * () |
void | operator= (const CSCDDUDataItr &) |
~CSCDDUDataItr () | |
Private Attributes | |
int | theCurrentCSC |
bool | theDataIsOwnedByMe |
const CSCDDUEventData * | theDDUData |
int | theNumberOfCSCs |
Definition at line 13 of file CSCDDUDataItr.h.
CSCDDUDataItr::CSCDDUDataItr | ( | ) |
default constructor
Definition at line 8 of file CSCDDUDataItr.cc.
00008 : 00009 theDDUData(0), 00010 theCurrentCSC(-1), 00011 theNumberOfCSCs(0), 00012 theDataIsOwnedByMe(true) 00013 {}
CSCDDUDataItr::CSCDDUDataItr | ( | const char * | buf | ) |
construct from data buffer. so makes a new DDUEventData
Definition at line 16 of file CSCDDUDataItr.cc.
References CSCDDUHeader::check(), CSCDDUEventData::cscData(), LogTrace, theDDUData, and theNumberOfCSCs.
00016 : 00017 theDDUData(0), 00018 theCurrentCSC(-1), 00019 theNumberOfCSCs(0), 00020 theDataIsOwnedByMe(true) 00021 { 00022 // check if it's OK first 00023 const CSCDDUHeader * dduHeader 00024 = reinterpret_cast<const CSCDDUHeader *>(buf); 00025 if(dduHeader->check()){ 00026 theDDUData = new CSCDDUEventData((unsigned short *)buf); 00027 theNumberOfCSCs = theDDUData->cscData().size(); 00028 } else { 00029 LogTrace ("CSCDDUDataItr|CSCRawToDigi") << "Failed DDU header check."; 00030 } 00031 }
CSCDDUDataItr::CSCDDUDataItr | ( | const CSCDDUEventData * | dduData | ) |
uses someone else's data, so doesn't delete
Definition at line 34 of file CSCDDUDataItr.cc.
00034 : 00035 theDDUData(dduData), 00036 theCurrentCSC(-1), 00037 theNumberOfCSCs(theDDUData->cscData().size()), 00038 theDataIsOwnedByMe(false) 00039 { 00040 }
CSCDDUDataItr::~CSCDDUDataItr | ( | ) |
Definition at line 43 of file CSCDDUDataItr.cc.
References theDataIsOwnedByMe, and theDDUData.
00044 { 00045 if(theDataIsOwnedByMe) delete theDDUData; 00046 }
CSCDDUDataItr::CSCDDUDataItr | ( | const CSCDDUDataItr & | i | ) |
if I own the data, I need to do special copy & assign
Definition at line 49 of file CSCDDUDataItr.cc.
References theDataIsOwnedByMe, and theDDUData.
00049 : 00050 theCurrentCSC(i.theCurrentCSC), 00051 theNumberOfCSCs(i.theNumberOfCSCs), 00052 theDataIsOwnedByMe(i.theDataIsOwnedByMe) 00053 { 00054 if(theDataIsOwnedByMe) 00055 { 00056 if(i.theDDUData != 0) 00057 { 00058 theDDUData = new CSCDDUEventData(*(i.theDDUData)); 00059 } 00060 } 00061 else 00062 { 00063 theDDUData = i.theDDUData; 00064 } 00065 }
bool CSCDDUDataItr::next | ( | ) |
Definition at line 90 of file CSCDDUDataItr.cc.
References theCurrentCSC, and theNumberOfCSCs.
Referenced by CSCChamberDataItr::next().
00091 { 00092 return (++theCurrentCSC < theNumberOfCSCs); 00093 }
const CSCEventData & CSCDDUDataItr::operator * | ( | void | ) |
Definition at line 96 of file CSCDDUDataItr.cc.
References CSCDDUEventData::cscData(), theCurrentCSC, theDDUData, and theNumberOfCSCs.
00097 { 00098 assert(theCurrentCSC >= 0 && theCurrentCSC < theNumberOfCSCs); 00099 return theDDUData->cscData()[theCurrentCSC]; 00100 }
void CSCDDUDataItr::operator= | ( | const CSCDDUDataItr & | i | ) |
Definition at line 68 of file CSCDDUDataItr.cc.
References theCurrentCSC, theDataIsOwnedByMe, theDDUData, and theNumberOfCSCs.
00069 { 00070 if(theDataIsOwnedByMe) 00071 { 00072 delete theDDUData; 00073 if(i.theDDUData != 0) 00074 { 00075 theDDUData = new CSCDDUEventData(*(i.theDDUData)); 00076 } 00077 } 00078 else 00079 { 00080 theDDUData = i.theDDUData; 00081 } 00082 00083 theDDUData = i.theDDUData; 00084 theCurrentCSC = i.theCurrentCSC; 00085 theNumberOfCSCs = i.theNumberOfCSCs; 00086 theDataIsOwnedByMe = i.theDataIsOwnedByMe; 00087 }
int CSCDDUDataItr::theCurrentCSC [private] |
bool CSCDDUDataItr::theDataIsOwnedByMe [private] |
Definition at line 39 of file CSCDDUDataItr.h.
Referenced by CSCDDUDataItr(), operator=(), and ~CSCDDUDataItr().
const CSCDDUEventData* CSCDDUDataItr::theDDUData [private] |
Definition at line 36 of file CSCDDUDataItr.h.
Referenced by CSCDDUDataItr(), operator *(), operator=(), and ~CSCDDUDataItr().
int CSCDDUDataItr::theNumberOfCSCs [private] |
Definition at line 38 of file CSCDDUDataItr.h.
Referenced by CSCDDUDataItr(), next(), operator *(), and operator=().