11#ifndef FRAMEWORK_ARRAY2D_H
12#define FRAMEWORK_ARRAY2D_H
16#include <unordered_map>
19extern template class std::unordered_map<std::string, u_int32_t>;
41 for (
auto i = 0U;
i <
rows; ++
i) {
42 for (
auto j = 0U;
j <
cols; ++
j) {
47 Array2D(std::vector<T> data_, uint32_t
r, uint32_t
c)
51 for (
auto i = 0U;
i <
rows; ++
i) {
52 for (
auto j = 0U;
j <
cols; ++
j) {
63 for (
auto i = 0U;
i <
rows; ++
i) {
64 for (
auto j = 0U;
j <
cols; ++
j) {
85 for (
auto i = 0U;
i <
rows; ++
i) {
86 for (
auto j = 0U;
j <
cols; ++
j) {
106 if (
data !=
nullptr) {
125static constexpr const char*
const labels_rows_str =
"labels_rows";
126static constexpr const char*
const labels_cols_str =
"labels_cols";
130 LabelMap(uint32_t
rows, uint32_t
cols, std::vector<std::string> labels_rows_, std::vector<std::string> labels_cols_);
132 LabelMap(uint32_t
size, std::vector<std::string> labels);
145 static labelmap_t populate(uint32_t
size, std::vector<std::string> labels);
157 void replaceLabelsRows(uint32_t
size, std::vector<std::string>
const& labels);
158 void replaceLabelsCols(uint32_t
size, std::vector<std::string>
const& labels);
174 LabeledArray(T
const*
data, uint32_t rows_, uint32_t cols_, std::vector<std::string> labels_rows_ = {}, std::vector<std::string> labels_cols_ = {})
176 LabelMap{rows_, cols_, labels_rows_, labels_cols_}
204 T
get(
const char*
y,
const char*
x)
const
206 return values(rowmap.find(
y)->second, colmap.find(
x)->second);
209 T
get(
const char*
y, uint32_t
x)
const
211 return values(rowmap.find(
y)->second,
x);
214 T
get(uint32_t
y,
const char*
x)
const
216 return values(
y, colmap.find(
x)->second);
226 return values[0][colmap.find(
x)->second];
262 LabelMap::replaceLabelsRows(
values.rows, labels);
267 LabelMap::replaceLabelsCols(
values.cols, labels);
std::vector< std::string > labels_rows
std::vector< std::string > labels_cols
T get(uint32_t y, uint32_t x) const
LabeledArray(Array2D< T > const &data, std::vector< std::string > labels_rows_={}, std::vector< std::string > labels_cols_={})
LabeledArray(T const *data, uint32_t rows_, uint32_t cols_, std::vector< std::string > labels_rows_={}, std::vector< std::string > labels_cols_={})
void replaceLabelsRows(std::vector< std::string > const &labels)
void replaceLabelsCols(std::vector< std::string > const &labels)
LabeledArray & operator=(LabeledArray< T > const &other)=default
T * getRow(uint32_t y) const
T get(const char *x) const
LabeledArray(LabeledArray< T > const &other)=default
T get(const char *y, const char *x) const
LabeledArray(T const *data, uint32_t size, std::vector< std::string > labels_={})
LabeledArray(LabeledArray< T > &&other)=default
T get(uint32_t y, const char *x) const
LabeledArray & operator=(LabeledArray< T > &&other)=default
T * operator[](uint32_t y) const
T get(const char *y, uint32_t x) const
GLenum GLsizei GLsizei GLint * values
Defining PrimaryVertex explicitly as messageable.
std::unordered_map< std::string, uint32_t > labelmap_t
Array2D(Array2D< T > const &other)
Array2D & operator=(Array2D< T > &&other)
Array2D(T const *data_, uint32_t r, uint32_t c)
Array2D & operator=(Array2D< T > const &other)
T * operator[](uint32_t y) const
Array2D(std::vector< T > data_, uint32_t r, uint32_t c)
Array2D(Array2D< T > &&other)
T operator()(uint32_t y, uint32_t x) const
LabelMap(LabelMap &&other)
std::vector< std::string > labels_cols
auto getLabelsRows() const
auto getLabelsCols() const
LabelMap & operator=(LabelMap const &other)
LabelMap(LabelMap const &other)
std::vector< std::string > labels_rows
LabelMap & operator=(LabelMap &&other)
VectorOfTObjectPtrs other
std::vector< ReadoutWindowData > rows