Skip to content

Commit 9089858

Browse files
authored
DPL Analysis: out-of-line LabelMap (AliceO2Group#6345)
1 parent 228e29e commit 9089858

2 files changed

Lines changed: 39 additions & 26 deletions

File tree

Framework/Core/include/Framework/Array2D.h

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <unordered_map>
1616
#include <memory>
1717
#include <string>
18+
extern template class std::unordered_map<std::string, u_int32_t>;
1819

1920
namespace o2::framework
2021
{
@@ -121,36 +122,17 @@ struct Array2D {
121122

122123
static constexpr const char* const labels_rows_str = "labels_rows";
123124
static constexpr const char* const labels_cols_str = "labels_cols";
124-
125125
using labelmap_t = std::unordered_map<std::string, uint32_t>;
126126
struct LabelMap {
127-
LabelMap()
128-
: rowmap{},
129-
colmap{},
130-
labels_rows{},
131-
labels_cols{}
132-
{
133-
}
134-
LabelMap(uint32_t rows, uint32_t cols, std::vector<std::string> labels_rows_, std::vector<std::string> labels_cols_)
135-
: rowmap{populate(rows, labels_rows_)},
136-
colmap{populate(cols, labels_cols_)},
137-
labels_rows{labels_rows_},
138-
labels_cols{labels_cols_}
139-
{
140-
}
127+
LabelMap();
128+
LabelMap(uint32_t rows, uint32_t cols, std::vector<std::string> labels_rows_, std::vector<std::string> labels_cols_);
141129

142-
LabelMap(uint32_t size, std::vector<std::string> labels)
143-
: rowmap{},
144-
colmap{populate(size, labels)},
145-
labels_rows{},
146-
labels_cols{labels}
147-
{
148-
}
130+
LabelMap(uint32_t size, std::vector<std::string> labels);
149131

150-
LabelMap(LabelMap const& other) = default;
151-
LabelMap(LabelMap&& other) = default;
152-
LabelMap& operator=(LabelMap const& other) = default;
153-
LabelMap& operator=(LabelMap&& other) = default;
132+
LabelMap(LabelMap const& other);
133+
LabelMap(LabelMap&& other);
134+
LabelMap& operator=(LabelMap const& other);
135+
LabelMap& operator=(LabelMap&& other);
154136

155137
labelmap_t rowmap;
156138
labelmap_t colmap;

Framework/Core/src/Array2D.cxx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
#include <Framework/RuntimeError.h>
1313
#include <Framework/CompilerBuiltins.h>
1414

15+
template class std::unordered_map<std::string, u_int32_t>;
16+
1517
namespace o2::framework
1618
{
19+
1720
labelmap_t LabelMap::populate(uint32_t size, std::vector<std::string> labels)
1821
{
1922
labelmap_t map;
@@ -47,5 +50,33 @@ void LabelMap::replaceLabelsCols(uint32_t size, std::vector<std::string> const&
4750
colmap.clear();
4851
colmap = populate(labels.size(), labels);
4952
}
53+
LabelMap::LabelMap()
54+
: rowmap{},
55+
colmap{},
56+
labels_rows{},
57+
labels_cols{}
58+
{
59+
}
60+
61+
LabelMap::LabelMap(uint32_t rows, uint32_t cols, std::vector<std::string> labels_rows_, std::vector<std::string> labels_cols_)
62+
: rowmap{populate(rows, labels_rows_)},
63+
colmap{populate(cols, labels_cols_)},
64+
labels_rows{labels_rows_},
65+
labels_cols{labels_cols_}
66+
{
67+
}
68+
69+
LabelMap::LabelMap(uint32_t size, std::vector<std::string> labels)
70+
: rowmap{},
71+
colmap{populate(size, labels)},
72+
labels_rows{},
73+
labels_cols{labels}
74+
{
75+
}
76+
77+
LabelMap::LabelMap(LabelMap const& other) = default;
78+
LabelMap::LabelMap(LabelMap&& other) = default;
79+
LabelMap& LabelMap::operator=(LabelMap const& other) = default;
80+
LabelMap& LabelMap::operator=(LabelMap&& other) = default;
5081

5182
} // namespace o2::framework

0 commit comments

Comments
 (0)