Belle II Software
release-05-02-19
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
h
i
l
m
n
p
r
s
t
v
w
Enumerations
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
MapMergeable.h
1
#pragma once
2
/**************************************************************************
3
* BASF2 (Belle Analysis Framework 2) *
4
* Copyright(C) 2014 - Belle II Collaboration *
5
* *
6
* Author: The Belle II Collaboration *
7
* Contributors: Thomas Keck *
8
* *
9
* This software is provided "as is" without any warranty. *
10
**************************************************************************/
11
12
#include <framework/pcore/Mergeable.h>
13
14
namespace
Belle2
{
35
template
<
class
T>
class
MapMergeable :
public
Mergeable {
36
public
:
37
MapMergeable() :
m_wrapped
() { }
38
39
virtual
~MapMergeable() { }
41
template
<
class
...Args>
explicit
MapMergeable(Args&& ... params) :
m_wrapped
(std::forward<Args>(params)...) { }
42
44
T&
get
() {
return
m_wrapped
; }
45
47
const
T&
get
()
const
{
return
m_wrapped
; }
48
56
virtual
void
merge
(
const
Mergeable* other)
57
{
58
auto
* otherMergeable =
static_cast<
const
MapMergeable*
>
(other);
59
for
(
const
auto
& element : otherMergeable->get()) {
60
auto
it =
m_wrapped
.find(element.first);
61
if
(it !=
m_wrapped
.end()) {
62
it->second += element.second;
63
}
else
{
64
m_wrapped
.insert(element);
65
}
66
}
67
}
68
74
virtual
void
clear
()
75
{
76
m_wrapped
.clear();
77
}
78
79
private
:
81
T
m_wrapped
;
82
83
ClassDef
(
MapMergeable
, 1);
84
};
86
}
Belle2::MapMergeable::ClassDef
ClassDef(MapMergeable, 1)
Wrap an STL map to make it mergeable.
Belle2::MapMergeable::clear
virtual void clear()
Clear content of this object (e.g.
Definition:
MapMergeable.h:82
Belle2::MapMergeable
Wrap an STL map to make it mergeable.
Definition:
MapMergeable.h:43
Belle2::MapMergeable::m_wrapped
T m_wrapped
Wrapped object.
Definition:
MapMergeable.h:89
Belle2
Abstract base class for different kinds of events.
Definition:
MillepedeAlgorithm.h:19
Belle2::MapMergeable::get
T & get()
Get the wrapped standard object.
Definition:
MapMergeable.h:52
Belle2::MapMergeable::merge
virtual void merge(const Mergeable *other)
Merge object 'other' into this one.
Definition:
MapMergeable.h:64
framework
pcore
include
MapMergeable.h
Generated on Tue Jan 4 2022 02:56:58 for Belle II Software by
1.8.17