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#include <functional>
14
15namespace columnar
16{
17 struct ColumnDataArray final
18 {
20 ColumnDataArray () noexcept = default;
21
24
25 ColumnDataArray& operator= (ColumnDataArray&& other) noexcept = default;
26
28 ~ColumnDataArray () noexcept;
29
31 bool empty () const noexcept;
32
34 const ColumnInfo& info () const noexcept;
35
37 void addAccessor (const std::string& name, const ColumnInfo& val_info, ColumnAccessorDataArray* val_accessorData);
38
40 void removeAccessor (ColumnAccessorDataArray& val_accessorData);
41
43 void mergeData (const std::string& name, ColumnDataArray&& other);
44
46 void setIndex (unsigned val_index) noexcept;
47
48 private:
49
52
55 };
56
57
58
60 {
61 struct StringHash {
62 using is_transparent = void; // enables heterogeneous lookup
63 size_t operator()(std::string_view sv) const noexcept {
64 return std::hash<std::string_view>{}(sv);
65 }
66 };
67
69 ColumnarToolArray* mainTool = nullptr;
70
72 std::vector<ColumnarToolArray*> sharedTools;
73
75 std::unordered_map<std::string,std::string,StringHash,std::equal_to<>> containerInternalToUserNames;
76 std::unordered_map<std::string,std::vector<std::string>,StringHash,std::equal_to<>> containerUserToInternalNames;
77
79 std::unordered_map<std::string,std::string,StringHash,std::equal_to<>> columnInternalToUserNames;
80 std::unordered_map<std::string,std::vector<std::string>,StringHash,std::equal_to<>> columnUserToInternalNames;
81
83 std::unordered_map<std::string,ColumnDataArray,StringHash,std::equal_to<>> columns;
84
87 std::unordered_map<std::string,std::string,StringHash,std::equal_to<>> linkTargetNames;
88
90 std::unordered_map<std::string,std::vector<std::function<void(const std::string&)>>,StringHash,std::equal_to<>> linkTargetNameWatchers;
91
92
94 [[nodiscard]] std::string convertInternalToUserName (std::string_view name) const;
95 [[nodiscard]] std::vector<std::string> convertUserToInternalNames (std::string_view name) const;
96
99 [[nodiscard]] std::string linkTargetName (std::string_view ciName) const;
100
102 [[nodiscard]] bool hasContainerUserName (std::string_view ciName) const;
103
106 void notifyLinkTargetNameWatchers () const;
107 };
108}
109
110#endif
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:73
size_t operator()(std::string_view sv) const noexcept
std::string linkTargetName(std::string_view ciName) const
the name of the given container as a link target, i.e.
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
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > linkTargetNames
the names to use for link targets that were set explicitly, instead of the name set by the ObjectColu...
bool hasContainerUserName(std::string_view ciName) const
whether the given container has a user name assigned
ColumnarToolArray * mainTool
the main tool that is associated with this object
std::vector< std::string > convertUserToInternalNames(std::string_view name) const
void notifyLinkTargetNameWatchers() const
call all the container name watchers for containers that have a user name assigned
std::string convertInternalToUserName(std::string_view name) const
convert a column name between user and internal names
std::vector< ColumnarToolArray * > sharedTools
the list of all tools that reference this object
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > containerUserToInternalNames
std::unordered_map< std::string, ColumnDataArray, StringHash, std::equal_to<> > columns
the name-column map
std::unordered_map< std::string, std::vector< std::function< void(const std::string &)> >, StringHash, std::equal_to<> > linkTargetNameWatchers
the watchers for the link target names of containers
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > columnInternalToUserNames
an extra map, for mapping individual column names
#define private
Definition testRead.cxx:27