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 CSCDDUEventData *dduData)
 uses someone else's data, so doesn't delete More...
 
 CSCDDUDataItr (const CSCDDUDataItr &)
 if I own the data, I need to do special copy & assign 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::CSCDDUDataItr ( )

default constructor

Definition at line 7 of file CSCDDUDataItr.cc.

const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38
CSCDDUDataItr::CSCDDUDataItr ( const char *  buf)

construct from data buffer. so makes a new DDUEventData

Definition at line 9 of file CSCDDUDataItr.cc.

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

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 }
bool check() const
Definition: CSCDDUHeader.cc:43
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
const std::vector< CSCEventData > & cscData() const
accessor to data
#define LogTrace(id)
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38
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) {}
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
const std::vector< CSCEventData > & cscData() const
accessor to data
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38
CSCDDUDataItr::~CSCDDUDataItr ( )

Definition at line 27 of file CSCDDUDataItr.cc.

References theDataIsOwnedByMe, and theDDUData.

27  {
29  delete theDDUData;
30 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38
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.

References theDataIsOwnedByMe, and theDDUData.

34  if (theDataIsOwnedByMe) {
35  if (i.theDDUData != nullptr) {
37  }
38  } else {
40  }
41 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38

Member Function Documentation

bool CSCDDUDataItr::next ( void  )

Definition at line 59 of file CSCDDUDataItr.cc.

References theCurrentCSC, and theNumberOfCSCs.

Referenced by CSCChamberDataItr::next().

59 { return (++theCurrentCSC < theNumberOfCSCs); }
const CSCEventData & CSCDDUDataItr::operator* ( void  )

Definition at line 61 of file CSCDDUDataItr.cc.

References CSCDDUEventData::cscData(), theCurrentCSC, theDDUData, and theNumberOfCSCs.

61  {
63  return theDDUData->cscData()[theCurrentCSC];
64 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
const std::vector< CSCEventData > & cscData() const
accessor to data
void CSCDDUDataItr::operator= ( const CSCDDUDataItr i)

Definition at line 43 of file CSCDDUDataItr.cc.

References theCurrentCSC, theDataIsOwnedByMe, theDDUData, and theNumberOfCSCs.

43  {
45  delete theDDUData;
46  if (i.theDDUData != nullptr) {
48  }
49  } else {
51  }
52 
57 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:35
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:38

Member Data Documentation

int CSCDDUDataItr::theCurrentCSC
private

Definition at line 36 of file CSCDDUDataItr.h.

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

bool CSCDDUDataItr::theDataIsOwnedByMe
private

Definition at line 38 of file CSCDDUDataItr.h.

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

const CSCDDUEventData* CSCDDUDataItr::theDDUData
private

Definition at line 35 of file CSCDDUDataItr.h.

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

int CSCDDUDataItr::theNumberOfCSCs
private

Definition at line 37 of file CSCDDUDataItr.h.

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