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 8 of file CSCDDUDataItr.cc.

8  :
9  theDDUData(nullptr),
10  theCurrentCSC(-1),
11  theNumberOfCSCs(0),
12  theDataIsOwnedByMe(true)
13 {}
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39
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.

16  :
17  theDDUData(nullptr),
18  theCurrentCSC(-1),
19  theNumberOfCSCs(0),
20  theDataIsOwnedByMe(true)
21 {
22  // check if it's OK first
23  const CSCDDUHeader * dduHeader
24  = reinterpret_cast<const CSCDDUHeader *>(buf);
25  if(dduHeader->check()){
26  theDDUData = new CSCDDUEventData((const uint16_t *)buf);
28  } else {
29  LogTrace ("CSCDDUDataItr|CSCRawToDigi") << "Failed DDU header check.";
30  }
31 }
bool check() const
Definition: CSCDDUHeader.cc:54
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
const std::vector< CSCEventData > & cscData() const
accessor to data
#define LogTrace(id)
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39
CSCDDUDataItr::CSCDDUDataItr ( const CSCDDUEventData dduData)

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

Definition at line 34 of file CSCDDUDataItr.cc.

34  :
35  theDDUData(dduData),
36  theCurrentCSC(-1),
38  theDataIsOwnedByMe(false)
39 {
40 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
const std::vector< CSCEventData > & cscData() const
accessor to data
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39
CSCDDUDataItr::~CSCDDUDataItr ( )

Definition at line 43 of file CSCDDUDataItr.cc.

References theDataIsOwnedByMe, and theDDUData.

44 {
45  if(theDataIsOwnedByMe) delete theDDUData;
46 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39
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.

49  :
53 {
55  {
56  if(i.theDDUData != nullptr)
57  {
59  }
60  }
61  else
62  {
64  }
65 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39

Member Function Documentation

bool CSCDDUDataItr::next ( void  )

Definition at line 90 of file CSCDDUDataItr.cc.

References theCurrentCSC, and theNumberOfCSCs.

Referenced by CSCChamberDataItr::next().

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

Definition at line 96 of file CSCDDUDataItr.cc.

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

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

Definition at line 68 of file CSCDDUDataItr.cc.

References theCurrentCSC, theDataIsOwnedByMe, theDDUData, and theNumberOfCSCs.

69 {
71  {
72  delete theDDUData;
73  if(i.theDDUData != nullptr)
74  {
76  }
77  }
78  else
79  {
81  }
82 
87 }
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39

Member Data Documentation

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=().