CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CSCDDUDataItr Class Reference

#include <CSCDDUDataItr.h>

Public Member Functions

 CSCDDUDataItr ()
 default constructor More...
 
 CSCDDUDataItr (const char *buf)
 construct from data buffer. so makes a new DDUEventData More...
 
 CSCDDUDataItr (const CSCDDUDataItr &)
 if I own the data, I need to do special copy & assign More...
 
 CSCDDUDataItr (const CSCDDUEventData *dduData)
 uses someone else's data, so doesn't delete More...
 
bool next ()
 
const CSCEventDataoperator* ()
 
void operator= (const CSCDDUDataItr &)
 
 ~CSCDDUDataItr ()
 

Private Attributes

int theCurrentCSC
 
bool theDataIsOwnedByMe
 
const CSCDDUEventDatatheDDUData
 
int theNumberOfCSCs
 

Detailed Description

Definition at line 13 of file CSCDDUDataItr.h.

Constructor & Destructor Documentation

◆ CSCDDUDataItr() [1/4]

CSCDDUDataItr::CSCDDUDataItr ( )

default constructor

Definition at line 7 of file CSCDDUDataItr.cc.

◆ CSCDDUDataItr() [2/4]

CSCDDUDataItr::CSCDDUDataItr ( const char *  buf)

construct from data buffer. so makes a new DDUEventData

Definition at line 9 of file CSCDDUDataItr.cc.

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 }

References visDQMUpload::buf, CSCDDUHeader::check(), CSCDDUEventData::cscData(), LogTrace, theDDUData, and theNumberOfCSCs.

◆ CSCDDUDataItr() [3/4]

CSCDDUDataItr::CSCDDUDataItr ( const CSCDDUEventData dduData)

uses someone else's data, so doesn't delete

Definition at line 21 of file CSCDDUDataItr.cc.

22  : theDDUData(dduData),
23  theCurrentCSC(-1),
25  theDataIsOwnedByMe(false) {}

◆ ~CSCDDUDataItr()

CSCDDUDataItr::~CSCDDUDataItr ( )

Definition at line 27 of file CSCDDUDataItr.cc.

27  {
29  delete theDDUData;
30 }

References theDataIsOwnedByMe, and theDDUData.

◆ CSCDDUDataItr() [4/4]

CSCDDUDataItr::CSCDDUDataItr ( const CSCDDUDataItr i)

if I own the data, I need to do special copy & assign

Definition at line 32 of file CSCDDUDataItr.cc.

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 }

References mps_fire::i, theDataIsOwnedByMe, and theDDUData.

Member Function Documentation

◆ next()

bool CSCDDUDataItr::next ( void  )

Definition at line 59 of file CSCDDUDataItr.cc.

59 { return (++theCurrentCSC < theNumberOfCSCs); }

References theCurrentCSC, and theNumberOfCSCs.

Referenced by CSCChamberDataItr::next().

◆ operator*()

const CSCEventData & CSCDDUDataItr::operator* ( void  )

◆ operator=()

void CSCDDUDataItr::operator= ( const CSCDDUDataItr i)

Definition at line 43 of file CSCDDUDataItr.cc.

43  {
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 }

References mps_fire::i, theCurrentCSC, theDataIsOwnedByMe, theDDUData, and theNumberOfCSCs.

Member Data Documentation

◆ theCurrentCSC

int CSCDDUDataItr::theCurrentCSC
private

Definition at line 36 of file CSCDDUDataItr.h.

Referenced by next(), operator*(), and operator=().

◆ theDataIsOwnedByMe

bool CSCDDUDataItr::theDataIsOwnedByMe
private

Definition at line 38 of file CSCDDUDataItr.h.

Referenced by CSCDDUDataItr(), operator=(), and ~CSCDDUDataItr().

◆ theDDUData

const CSCDDUEventData* CSCDDUDataItr::theDDUData
private

Definition at line 35 of file CSCDDUDataItr.h.

Referenced by CSCDDUDataItr(), operator*(), operator=(), and ~CSCDDUDataItr().

◆ theNumberOfCSCs

int CSCDDUDataItr::theNumberOfCSCs
private

Definition at line 37 of file CSCDDUDataItr.h.

Referenced by CSCDDUDataItr(), next(), operator*(), and operator=().

mps_fire.i
i
Definition: mps_fire.py:355
CSCDDUEventData::cscData
const std::vector< CSCEventData > & cscData() const
accessor to data
Definition: CSCDDUEventData.h:33
CSCDDUHeader::check
bool check() const
Definition: CSCDDUHeader.cc:43
CSCDDUDataItr::theDDUData
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
CSCDDUHeader
Definition: CSCDDUHeader.h:11
cms::cuda::assert
assert(be >=bs)
CSCDDUDataItr::theCurrentCSC
int theCurrentCSC
Definition: CSCDDUDataItr.h:36
CSCDDUDataItr::theDataIsOwnedByMe
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38
visDQMUpload.buf
buf
Definition: visDQMUpload.py:154
CSCDDUEventData
Definition: CSCDDUEventData.h:19
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
CSCDDUDataItr::theNumberOfCSCs
int theNumberOfCSCs
Definition: CSCDDUDataItr.h:37