ATLAS Offline Software
Loading...
Searching...
No Matches
ColumnarToolDataArray.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8#ifndef COLUMNAR_CORE_COLUMNAR_TOOL_DATA_ARRAY_H
9#define COLUMNAR_CORE_COLUMNAR_TOOL_DATA_ARRAY_H
10
13
14namespace columnar
15{
16 struct ColumnDataArray final
17 {
19 ColumnDataArray () noexcept = default;
20
22 ColumnDataArray (ColumnDataArray&& other) noexcept;
23
24 ColumnDataArray operator= (ColumnDataArray&& other) noexcept = delete;
25
27 ~ColumnDataArray () noexcept;
28
30 bool empty () const noexcept;
31
33 const ColumnInfo& info () const noexcept;
34
36 void addAccessor (const std::string& name, const ColumnInfo& val_info, ColumnAccessorDataArray* val_accessorData);
37
39 void removeAccessor (ColumnAccessorDataArray& val_accessorData);
40
42 void mergeData (const std::string& name, ColumnDataArray&& other);
43
45 void setIndex (unsigned val_index) noexcept;
46
47 private:
48
51
54 };
55
56
57
59 {
60 struct StringHash {
61 using is_transparent = void; // enables heterogeneous lookup
62 size_t operator()(std::string_view sv) const noexcept {
63 return std::hash<std::string_view>{}(sv);
64 }
65 };
66
69
71 std::vector<ColumnarTool<ColumnarModeArray>*> sharedTools;
72
74 std::unordered_map<std::string,std::string,StringHash,std::equal_to<>> containerInternalToUserNames;
75 std::unordered_map<std::string,std::vector<std::string>,StringHash,std::equal_to<>> containerUserToInternalNames;
76
78 std::unordered_map<std::string,std::string,StringHash,std::equal_to<>> columnInternalToUserNames;
79 std::unordered_map<std::string,std::vector<std::string>,StringHash,std::equal_to<>> columnUserToInternalNames;
80
82 std::unordered_map<std::string,ColumnDataArray> columns;
83
84
86 [[nodiscard]] std::string convertInternalToUserName (std::string_view name) const;
87 [[nodiscard]] std::vector<std::string> convertUserToInternalNames (std::string_view name) const;
88 };
89}
90
91#endif
the base class for all columnar components
STL namespace.
all the data about a column accessor that the ColumnarTool needs to know about
ColumnDataArray() noexcept=default
standard constructor
std::vector< ColumnAccessorDataArray * > m_accessors
the data on all accessors for this column
const ColumnInfo & info() const noexcept
get the column info
void mergeData(const std::string &name, ColumnDataArray &&other)
merge the data from another column
ColumnInfo m_info
the column info
void setIndex(unsigned val_index) noexcept
set the index for this column
void addAccessor(const std::string &name, const ColumnInfo &val_info, ColumnAccessorDataArray *val_accessorData)
add an info to the column
bool empty() const noexcept
whether this column has no associated accessors
void removeAccessor(ColumnAccessorDataArray &val_accessorData)
remove an accessor data object
a struct that contains meta-information about each column that's needed to interface the column with ...
Definition ColumnInfo.h:35
size_t operator()(std::string_view sv) const noexcept
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > containerInternalToUserNames
the names associated with all container ids
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > columnUserToInternalNames
ColumnarTool< ColumnarModeArray > * mainTool
the main tool that is associated with this object
std::vector< std::string > convertUserToInternalNames(std::string_view name) const
std::string convertInternalToUserName(std::string_view name) const
convert a column name between user and internal names
std::vector< ColumnarTool< ColumnarModeArray > * > sharedTools
the list of all tools that reference this object
std::unordered_map< std::string, ColumnDataArray > columns
the name-column map
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > containerUserToInternalNames
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > columnInternalToUserNames
an extra map, for mapping individual column names
#define private