ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Event
EventContainers
EventContainers
SelectAllObjectMT.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef EVENTCONTAINERS_SELECTALLOBJECTMT_H
6
#define EVENTCONTAINERS_SELECTALLOBJECTMT_H
7
8
//after SelectAllObjectMT is destroyed all iterators become invalid!
9
template
<
class
DCC,
typename
OBJECT =
typename
DCC::IDENTIFIABLE::DIGIT >
10
class
SelectAllObjectMT
11
{
12
public
:
13
typedef
typename
DCC::IDENTIFIABLE
DC
;
14
// typedef typename DC::OBJECT OBJECT;
15
// typedef OBJECT OBJECT;
16
typedef
SelectAllObjectMT<DCC,OBJECT>
MyType
;
17
typedef
typename
DC::const_iterator
Object_const_iterator
;
18
typedef
typename
DCC::const_iterator
Cont_iterator
;
19
// typedef typename DCC::Hash_Container::const_iterator Hash_iterator;
20
21
class
const_iterator
22
{
23
Cont_iterator
m_cont_itr
;
24
const
SelectAllObjectMT<DCC,OBJECT>
*
m_Parent
;
25
Object_const_iterator
m_digit_it
;
26
const
DC
*
m_dc
;
// cache DC
27
friend
class
SelectAllObjectMT
<DCC,OBJECT>;
28
29
void
AdvanceCollection
() {
30
31
SKIPNEXT:
32
33
++
m_cont_itr
;
34
if
(
m_cont_itr
!=
m_Parent
->m_dcc->end()) {
35
m_dc
= *
m_cont_itr
;
36
m_digit_it
=
m_dc
->begin();
37
if
(
m_digit_it
==
m_dc
->end())
goto
SKIPNEXT;
38
}
else
{
39
m_dc
=
nullptr
;
40
m_digit_it
=
Object_const_iterator
();
41
}
42
}
43
44
public
:
45
46
const_iterator
()
47
:
48
m_cont_itr
(),
49
m_Parent
(nullptr),
50
m_digit_it
(),
51
m_dc
(nullptr)
52
{}
53
54
const_iterator
(
const
Cont_iterator
&itr,
const
SelectAllObjectMT<DCC,OBJECT>
* parent,
55
Object_const_iterator
digitit,
const
DC
* dc )
56
:
57
m_cont_itr
(itr),
58
m_Parent
(parent),
59
m_digit_it
(digitit),
60
m_dc
(dc)
61
{}
62
63
const
OBJECT*
operator *
()
64
{
65
return
*
m_digit_it
;
66
}
67
68
69
70
71
const_iterator
&
operator ++
()
// pre increment
72
{
73
++
m_digit_it
;
74
if
(
m_digit_it
!=
m_dc
->end()) {
75
// OK
76
}
else
77
{
78
// reached end of a collection,
79
AdvanceCollection
();
80
}
81
return
*
this
;
82
83
}
84
85
86
const_iterator
operator ++
(
int
)
// post increment
87
{
const_iterator
tmp = *
this
;
88
++*
this
;
89
return
tmp;
90
}
91
92
93
bool
operator !=
(
const
const_iterator
it )
const
94
{
95
if
( it.m_cont_itr !=
m_cont_itr
|| it.m_digit_it !=
m_digit_it
)
96
return
true
;
97
98
return
false
;
99
}
100
101
bool
operator ==
(
const
const_iterator
it )
const
102
{
103
return
( it.m_cont_itr ==
m_cont_itr
&& it.m_digit_it ==
m_digit_it
);
104
}
105
106
107
108
};
109
110
SelectAllObjectMT
(
const
DCC* dcc) :
m_dcc
(dcc)
111
{ }
112
113
SelectAllObjectMT
( ) =
delete
;
114
115
const_iterator
begin
() {
116
auto
b =
m_dcc
->begin();
117
NEXT:
118
const
DC
* dc =
nullptr
;
119
Object_const_iterator
digit_it;
120
if
(b!=
m_dcc
->end()) {
121
dc = *b;
122
digit_it = dc->begin();
123
if
(digit_it == dc->end()){
124
++b;
125
goto
NEXT;
126
}
127
}
128
return
const_iterator(b,
this
, digit_it, dc);
129
}
130
131
const_iterator
end
() {
132
auto
b =
m_dcc
->end();
133
const
DC
* dc =
nullptr
;
134
Object_const_iterator
digit_it;
135
return
const_iterator(b,
this
, digit_it, dc);
136
}
137
138
//Compatability with C++11
139
const_iterator
cbegin
() {
140
return
begin
();
141
}
142
const_iterator
cend
() {
143
return
end
();
144
}
145
146
147
private
:
148
// pointer to the container it is processing.
149
const
DCC*
m_dcc
;
150
};
151
152
153
#endif
SelectAllObjectMT::const_iterator::operator==
bool operator==(const const_iterator it) const
Definition
SelectAllObjectMT.h:101
SelectAllObjectMT::const_iterator::operator++
const_iterator & operator++()
Definition
SelectAllObjectMT.h:71
SelectAllObjectMT::const_iterator::operator*
const OBJECT * operator*()
Definition
SelectAllObjectMT.h:63
SelectAllObjectMT::const_iterator::operator!=
bool operator!=(const const_iterator it) const
Definition
SelectAllObjectMT.h:93
SelectAllObjectMT::const_iterator::m_dc
const DC * m_dc
Definition
SelectAllObjectMT.h:26
SelectAllObjectMT::const_iterator::const_iterator
const_iterator(const Cont_iterator &itr, const SelectAllObjectMT< DCC, OBJECT > *parent, Object_const_iterator digitit, const DC *dc)
Definition
SelectAllObjectMT.h:54
SelectAllObjectMT::const_iterator::AdvanceCollection
void AdvanceCollection()
Definition
SelectAllObjectMT.h:29
SelectAllObjectMT::const_iterator::m_digit_it
Object_const_iterator m_digit_it
Definition
SelectAllObjectMT.h:25
SelectAllObjectMT::const_iterator::m_cont_itr
Cont_iterator m_cont_itr
Definition
SelectAllObjectMT.h:23
SelectAllObjectMT::const_iterator::m_Parent
const SelectAllObjectMT< DCC, OBJECT > * m_Parent
Definition
SelectAllObjectMT.h:24
SelectAllObjectMT::const_iterator::const_iterator
const_iterator()
Definition
SelectAllObjectMT.h:46
const_iterator::m_dcc
const DCC * m_dcc
Definition
SelectAllObjectMT.h:149
SelectAllObjectMT< DCC, OBJECT >::SelectAllObjectMT
SelectAllObjectMT()=delete
SelectAllObjectMT< DCC, OBJECT >::cend
const_iterator cend()
Definition
SelectAllObjectMT.h:142
SelectAllObjectMT< DCC, OBJECT >::MyType
SelectAllObjectMT< DCC, OBJECT > MyType
Definition
SelectAllObjectMT.h:16
SelectAllObjectMT< DCC, OBJECT >::DC
DCC::IDENTIFIABLE DC
Definition
SelectAllObjectMT.h:13
SelectAllObjectMT< DCC, OBJECT >::cbegin
const_iterator cbegin()
Definition
SelectAllObjectMT.h:139
SelectAllObjectMT< DCC, OBJECT >::Cont_iterator
DCC::const_iterator Cont_iterator
Definition
SelectAllObjectMT.h:18
SelectAllObjectMT< DCC, OBJECT >::Object_const_iterator
DC::const_iterator Object_const_iterator
Definition
SelectAllObjectMT.h:17
SelectAllObjectMT::SelectAllObjectMT
SelectAllObjectMT(const DCC *dcc)
Definition
SelectAllObjectMT.h:110
SelectAllObjectMT< DCC, OBJECT >::end
const_iterator end()
Definition
SelectAllObjectMT.h:131
SelectAllObjectMT< DCC, OBJECT >::begin
const_iterator begin()
Definition
SelectAllObjectMT.h:115
Generated on
for ATLAS Offline Software by
1.17.0