ATLAS Offline Software
Loading...
Searching...
No Matches
ColumnarToolHelpers.cxx
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//
9// includes
10//
11
13
16
17//
18// method implementations
19//
20
21namespace columnar
22{
23 void renameContainers (IColumnarTool& tool, const std::vector<std::pair<std::string,std::string>>& renames)
24 {
25 if (!renames.empty())
26 {
27 auto columnInfo = tool.getColumnInfo ();
28 for (auto& [from, to] : renames)
29 {
30 for (auto& column : columnInfo)
31 {
32 if (column.name.starts_with (from) && (column.name.size() == from.size() || column.name[from.size()] == '.'))
33 {
34 std::string newName = to + column.name.substr (from.size());
35 tool.renameColumn (column.name, newName);
36 }
37 }
38 }
39 }
40 }
41}
an interface for tools that operate on columnar data
void renameContainers(IColumnarTool &tool, const std::vector< std::pair< std::string, std::string > > &renames)
rename containers in the columnar tool