ATLAS Offline Software
Loading...
Searching...
No Matches
ToolColumnVectorMap.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_TOOL_WRAPPER_TOOL_COLUMN_VECTOR_MAP_H
9#define COLUMNAR_TOOL_WRAPPER_TOOL_COLUMN_VECTOR_MAP_H
10
12
13#include <unordered_map>
14
15namespace columnar
16{
28
30 {
33
34 public:
35
41 explicit ToolColumnVectorMap (ColumnVectorHeader& val_columnHeader, IColumnarTool& val_tool);
42
43
45 [[nodiscard]] const IColumnarTool& getTool () const {
46 return *m_tool; }
47
49 [[nodiscard]] const ColumnVectorHeader& getColumnHeader () const {
50 return *m_columnHeader; }
51
52
58 [[nodiscard]] std::vector<std::string> getColumnNames () const;
59
64 [[nodiscard]] std::size_t getColumnIndex (const std::string& name) const;
65
66
67
74
75
78 template<typename CT>
79 void setColumn (ColumnVectorData& columnData, const std::string& name, std::size_t size, CT* dataPtr) const {
80 columnData.setColumn (getColumnIndex(name), size, dataPtr);
81 }
82
85 void setColumnVoid (ColumnVectorData& columnData, const std::string& name, std::size_t size, const void *dataPtr, const std::type_info& type, bool isConst) const {
86 columnData.setColumnVoid (getColumnIndex(name), size, dataPtr, type, isConst);
87 }
88
89
92 template<typename CT>
93 [[nodiscard]] std::pair<std::size_t,CT*>
94 getColumn (ColumnVectorData& columnData, const std::string& name) const {
95 return columnData.getColumn<CT> (getColumnIndex(name));
96 }
97
99 [[nodiscard]] std::pair<std::size_t,const void*>
100 getColumnVoid (ColumnVectorData& columnData, const std::string& name, const std::type_info *type, bool isConst) const {
101 return columnData.getColumnVoid (getColumnIndex(name), type, isConst);
102 }
103
104
105
108
109 private:
110
112 const IColumnarTool *m_tool = nullptr;
113
116
119 {
120 unsigned index = 0u;
121 };
122 std::unordered_map<std::string,MyColumnInfo> m_columns;
123 };
124}
125
126#endif
a class that holds the columnar data for a single call
std::pair< std::size_t, const void * > getColumnVoid(std::size_t columnIndex, const std::type_info *type, bool isConst)
void setColumnVoid(std::size_t columnIndex, std::size_t size, const void *dataPtr, const std::type_info &type, bool isConst)
void setColumn(std::size_t columnIndex, std::size_t size, CT *dataPtr)
set the data for the given column
std::pair< std::size_t, CT * > getColumn(std::size_t columnIndex)
get the data for the given column
the header information for the entire columnar data vector
an interface for tools that operate on columnar data
ColumnVectorHeader * m_columnHeader
the header information for the various columns needed
const ColumnVectorHeader & getColumnHeader() const
get the header information for the various columns needed
const IColumnarTool & getTool() const
get the wrapped tool
std::vector< std::string > getColumnNames() const
get the list of all defined columns
ToolColumnVectorMap(ColumnVectorHeader &val_columnHeader, IColumnarTool &val_tool)
standard constructor
std::pair< std::size_t, const void * > getColumnVoid(ColumnVectorData &columnData, const std::string &name, const std::type_info *type, bool isConst) const
get the data for the given column in a type-erased manner
std::unordered_map< std::string, MyColumnInfo > m_columns
const IColumnarTool * m_tool
the wrapped tool
void setColumn(ColumnVectorData &columnData, const std::string &name, std::size_t size, CT *dataPtr) const
set the data for the given column picking up the type via a template
std::pair< std::size_t, CT * > getColumn(ColumnVectorData &columnData, const std::string &name) const
get the data for the given column picking up the type via a template
std::size_t getColumnIndex(const std::string &name) const
get the index for the column with the given name
void setColumnVoid(ColumnVectorData &columnData, const std::string &name, std::size_t size, const void *dataPtr, const std::type_info &type, bool isConst) const
set the data for the given column with the user passing in the type
Definition index.py:1
my cached information for the various columns needed