test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCDDUDataItr.cc
Go to the documentation of this file.
4 
5 
6 // theCurrentCSC starts at -1, since user is expected to next() before he dereferences
7 // for the first time
9  theDDUData(0),
10  theCurrentCSC(-1),
11  theNumberOfCSCs(0),
12  theDataIsOwnedByMe(true)
13 {}
14 
15 
16 CSCDDUDataItr::CSCDDUDataItr(const char * buf) :
17  theDDUData(0),
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((unsigned short *)buf);
28  } else {
29  LogTrace ("CSCDDUDataItr|CSCRawToDigi") << "Failed DDU header check.";
30  }
31 }
32 
33 
35  theDDUData(dduData),
36  theCurrentCSC(-1),
37  theNumberOfCSCs(theDDUData->cscData().size()),
38  theDataIsOwnedByMe(false)
39 {
40 }
41 
42 
44 {
45  if(theDataIsOwnedByMe) delete theDDUData;
46 }
47 
48 
50  theCurrentCSC(i.theCurrentCSC),
51  theNumberOfCSCs(i.theNumberOfCSCs),
52  theDataIsOwnedByMe(i.theDataIsOwnedByMe)
53 {
55  {
56  if(i.theDDUData != 0)
57  {
59  }
60  }
61  else
62  {
64  }
65 }
66 
67 
69 {
71  {
72  delete theDDUData;
73  if(i.theDDUData != 0)
74  {
76  }
77  }
78  else
79  {
81  }
82 
87 }
88 
89 
91 {
92  return (++theCurrentCSC < theNumberOfCSCs);
93 }
94 
95 
97 {
99  return theDDUData->cscData()[theCurrentCSC];
100 }
101 
102 
int i
Definition: DBlmapReader.cc:9
bool check() const
Definition: CSCDDUHeader.cc:54
void operator=(const CSCDDUDataItr &)
assert(m_qm.get())
const CSCDDUEventData * theDDUData
Definition: CSCDDUDataItr.h:36
CSCDDUDataItr()
default constructor
Definition: CSCDDUDataItr.cc:8
const std::vector< CSCEventData > & cscData() const
accessor to data
#define LogTrace(id)
bool theDataIsOwnedByMe
Definition: CSCDDUDataItr.h:39
volatile std::atomic< bool > shutdown_flag false
const CSCEventData & operator*()
tuple size
Write out results.