BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
McIterator.cxx
Go to the documentation of this file.
1#include "McEventSelector/McIterator.h"
2
3#include <iostream>
4#include "McEventSelector/McAddress.h"
5
6IOpaqueAddress* McIterator::operator*() const {
7 return dereference();
8}
9IOpaqueAddress* McIterator::operator->() const {
10 return dereference();
11}
12IEvtSelector::Iterator& McIterator::operator++() {
13 if(m_eventNo>=m_eventsP){
14 m_runNo++;
15 m_eventNo=1;
16 }
17 m_eventNo++;
18 return *this;
19}
20IEvtSelector::Iterator& McIterator::operator--() {
21 m_eventNo--;
22 return *this;
23}
24IEvtSelector::Iterator& McIterator::operator++(int){
25
26 if(m_eventNo>=m_eventsP){
27 m_runNo++;
28 m_eventNo=1;
29 }
30 m_eventNo++;
31 return *this;
32}
33
34IEvtSelector::Iterator& McIterator::operator--(int){
35 m_eventNo--;
36 return *this;
37}
38
39bool McIterator::operator==(const IEvtSelector::Iterator& it) const {
40 const McIterator* zIt = dynamic_cast<const McIterator*>(&it);
41 return (NULL != zIt) &&
42 (m_runNo == zIt->runNumber()) &&
43 (m_eventNo == zIt->eventNumber()) ;
44}
45
46
47bool McIterator::operator!=(const IEvtSelector::Iterator& it) const {
48 return !operator==(it);
49}
50
51McAddress* McIterator::dereference() const {
52 McAddress* zAddress(dynamic_cast<McAddress*>(m_evtSelector->reference(*this)));
53 if (NULL != zAddress) {
54 zAddress->setRunEvt(m_runNo, m_eventNo);
55// cerr << "McIterator::dereference: to object "
56// << zAddress->objectName() << " : " << zAddress->clID()<< " : "
57// << zAddress->svcType()<<endl;
58 } else
59 std::cerr << "McIterator::dereference() ERROR invalid opaque address type!! " << std::endl;
60 return zAddress;
61}
virtual Iterator & operator++()
Definition: McIterator.cxx:12
virtual Iterator & operator--()
Definition: McIterator.cxx:20
virtual bool operator!=(const Iterator &it) const
virtual bool operator==(const Iterator &it) const
virtual IOpaqueAddress * operator->() const
Definition: McIterator.cxx:9
virtual IOpaqueAddress * operator*() const
Definition: McIterator.cxx:6