CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
CSCDDUDataItr.cc
Go to the documentation of this file.
4 
5 // theCurrentCSC starts at -1, since user is expected to next() before he dereferences
6 // for the first time
7 CSCDDUDataItr::CSCDDUDataItr() : theDDUData(nullptr), theCurrentCSC(-1), theNumberOfCSCs(0), theDataIsOwnedByMe(true) {}
8 
10  : theDDUData(nullptr), theCurrentCSC(-1), theNumberOfCSCs(0), theDataIsOwnedByMe(true) {
11  // check if it's OK first
12  const CSCDDUHeader *dduHeader = reinterpret_cast<const CSCDDUHeader *>(buf);
13  if (dduHeader->check()) {
14  theDDUData = new CSCDDUEventData((const uint16_t *)buf);
16  } else {
17  LogTrace("CSCDDUDataItr|CSCRawToDigi") << "Failed DDU header check.";
18  }
19 }
20 
22  : theDDUData(dduData),
23  theCurrentCSC(-1),
24  theNumberOfCSCs(theDDUData->cscData().size()),
25  theDataIsOwnedByMe(false) {}
26 
29  delete theDDUData;
30 }
31 
33  : theCurrentCSC(i.theCurrentCSC), theNumberOfCSCs(i.theNumberOfCSCs), theDataIsOwnedByMe(i.theDataIsOwnedByMe) {
34  if (theDataIsOwnedByMe) {
35  if (i.theDDUData != nullptr) {
36  theDDUData = new CSCDDUEventData(*(i.theDDUData));
37  }
38  } else {
39  theDDUData = i.theDDUData;
40  }
41 }
42 
44  if (theDataIsOwnedByMe && theDDUData != i.theDDUData) {
45  delete theDDUData;
46  if (i.theDDUData != nullptr) {
47  theDDUData = new CSCDDUEventData(*(i.theDDUData));
48  }
49  } else {
50  theDDUData = i.theDDUData;
51  }
52 
53  theDDUData = i.theDDUData;
54  theCurrentCSC = i.theCurrentCSC;
55  theNumberOfCSCs = i.theNumberOfCSCs;
56  theDataIsOwnedByMe = i.theDataIsOwnedByMe;
57 }
58 
60 
63  return theDDUData->cscData()[theCurrentCSC];
64 }
size
Write out results.
void operator=(const CSCDDUDataItr &)
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
assert(be >=bs)
#define LogTrace(id)
CSCDDUDataItr()
default constructor
Definition: CSCDDUDataItr.cc:7
const std::vector< CSCEventData > & cscData() const
accessor to data
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38
const CSCEventData & operator*()
bool check() const
Definition: CSCDDUHeader.cc:43