#include <CSCDDUDataItr.h>
Public Member Functions | |
CSCDDUDataItr () | |
default constructor | |
CSCDDUDataItr (const char *buf) | |
construct from data buffer. so makes a new DDUEventData | |
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 | |
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.
: theDDUData(0), theCurrentCSC(-1), theNumberOfCSCs(0), theDataIsOwnedByMe(true) {}
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.
: theDDUData(0), theCurrentCSC(-1), theNumberOfCSCs(0), theDataIsOwnedByMe(true) { // check if it's OK first const CSCDDUHeader * dduHeader = reinterpret_cast<const CSCDDUHeader *>(buf); if(dduHeader->check()){ theDDUData = new CSCDDUEventData((unsigned short *)buf); theNumberOfCSCs = theDDUData->cscData().size(); } else { LogTrace ("CSCDDUDataItr|CSCRawToDigi") << "Failed DDU header check."; } }
CSCDDUDataItr::CSCDDUDataItr | ( | const CSCDDUEventData * | dduData | ) |
uses someone else's data, so doesn't delete
Definition at line 34 of file CSCDDUDataItr.cc.
: theDDUData(dduData), theCurrentCSC(-1), theNumberOfCSCs(theDDUData->cscData().size()), theDataIsOwnedByMe(false) { }
CSCDDUDataItr::~CSCDDUDataItr | ( | ) |
Definition at line 43 of file CSCDDUDataItr.cc.
References theDataIsOwnedByMe, and theDDUData.
{ if(theDataIsOwnedByMe) delete theDDUData; }
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.
: theCurrentCSC(i.theCurrentCSC), theNumberOfCSCs(i.theNumberOfCSCs), theDataIsOwnedByMe(i.theDataIsOwnedByMe) { if(theDataIsOwnedByMe) { if(i.theDDUData != 0) { theDDUData = new CSCDDUEventData(*(i.theDDUData)); } } else { theDDUData = i.theDDUData; } }
bool CSCDDUDataItr::next | ( | void | ) |
Definition at line 90 of file CSCDDUDataItr.cc.
References theCurrentCSC, and theNumberOfCSCs.
Referenced by CSCChamberDataItr::next().
{ return (++theCurrentCSC < theNumberOfCSCs); }
const CSCEventData & CSCDDUDataItr::operator* | ( | void | ) |
Definition at line 96 of file CSCDDUDataItr.cc.
References CSCDDUEventData::cscData(), theCurrentCSC, theDDUData, and theNumberOfCSCs.
{ assert(theCurrentCSC >= 0 && theCurrentCSC < theNumberOfCSCs); return theDDUData->cscData()[theCurrentCSC]; }
void CSCDDUDataItr::operator= | ( | const CSCDDUDataItr & | i | ) |
Definition at line 68 of file CSCDDUDataItr.cc.
References theCurrentCSC, theDataIsOwnedByMe, theDDUData, and theNumberOfCSCs.
{ if(theDataIsOwnedByMe) { delete theDDUData; if(i.theDDUData != 0) { theDDUData = new CSCDDUEventData(*(i.theDDUData)); } } else { theDDUData = i.theDDUData; } theDDUData = i.theDDUData; theCurrentCSC = i.theCurrentCSC; theNumberOfCSCs = i.theNumberOfCSCs; theDataIsOwnedByMe = i.theDataIsOwnedByMe; }
int CSCDDUDataItr::theCurrentCSC [private] |
Definition at line 37 of file CSCDDUDataItr.h.
Referenced by next(), operator*(), and operator=().
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=().