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