ATLAS Offline Software
Loading...
Searching...
No Matches
ColumnInfoHelpers.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
14#include <boost/core/demangle.hpp>
15
16#include <stdexcept>
17
18//
19// method implementations
20//
21
22namespace columnar
23{
25 {
26 if (info.accessMode == ColumnAccessMode::input)
27 info.accessMode = accessMode;
28 else if (info.accessMode != accessMode)
29 throw std::runtime_error ("conflicting access modes for column " + info.name);
30 }
31
32
33
34 void mergeColumnInfo (ColumnInfo& target, const ColumnInfo& source)
35 {
36 if (target.name != source.name)
37 throw std::runtime_error ("mismatched column names in mergeColumnInfo: " + target.name + " and " + source.name);
38
39 if (target.type == nullptr || source.type == nullptr)
40 throw std::runtime_error ("missing type information in mergeColumnInfo for column: " + target.name);
41 if (*target.type != *source.type)
42 throw std::runtime_error ("mismatched column types in mergeColumnInfo for column: " + target.name + ": " + boost::core::demangle(target.type->name()) + " and " + boost::core::demangle(source.type->name()));
43
44 addColumnAccessMode (target, source.accessMode);
45
46 if (target.offsetName != source.offsetName)
47 throw std::runtime_error ("mismatched offset names in mergeColumnInfo for column: " + target.name + ": " + target.offsetName + " and " + source.offsetName);
48
49 if (target.fixedDimensions != source.fixedDimensions)
50 throw std::runtime_error ("mismatched fixed dimensions in mergeColumnInfo for column: " + target.name);
51
52 if (target.isOffset != source.isOffset)
53 throw std::runtime_error ("mismatched isOffset in mergeColumnInfo for column: " + target.name);
54
55 if (target.replacesColumn.empty())
56 target.replacesColumn = source.replacesColumn;
57 else if (!source.replacesColumn.empty() && target.replacesColumn != source.replacesColumn)
58 throw std::runtime_error ("mismatched replacesColumn in mergeColumnInfo for column: " + target.name + ": " + target.replacesColumn + " and " + source.replacesColumn);
59
60 if (!source.isOptional)
61 target.isOptional = false;
62
63 if (target.linkTargetNames != source.linkTargetNames)
64 throw std::runtime_error ("mismatched linkTargetNames in mergeColumnInfo for column: " + target.name);
65
66 if (target.variantLinkKeyColumn != source.variantLinkKeyColumn)
67 throw std::runtime_error ("mismatched variantLinkKeyColumn in mergeColumnInfo for column: " + target.name + ": " + target.variantLinkKeyColumn + " and " + source.variantLinkKeyColumn);
68 }
69}
void mergeColumnInfo(ColumnInfo &target, const ColumnInfo &source)
void addColumnAccessMode(ColumnInfo &info, ColumnAccessMode accessMode)
ColumnAccessMode
an enum for the different access modes for a column
Definition ColumnInfo.h:19
@ input
an input column
Definition ColumnInfo.h:21
a struct that contains meta-information about each column that's needed to interface the column with ...
Definition ColumnInfo.h:35