ATLAS Offline Software
Loading...
Searching...
No Matches
VariantDef.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_VARIANT_VARIANT_DEF_H
9#define COLUMNAR_VARIANT_VARIANT_DEF_H
10
12
13#include <boost/mp11/list.hpp>
14#include <boost/mp11/algorithm.hpp>
15#include <array>
16#include <tuple>
17
18namespace columnar
19{
95
96 template<ContainerIdConcept CIBase,ContainerIdConcept... CIList>
98 {
99 static_assert (sizeof...(CIList) > 0, "need to have at least one variant container type for VariantContainerId");
100
102 static constexpr bool isContainerId = true;
103
105 static constexpr bool isMutable = CIBase::isMutable;
106
108 static constexpr bool perEventRange = false;
109
111 static constexpr bool perEventId = false;
112
114 using xAODObjectIdType = typename CIBase::xAODObjectIdType;
115
117 using xAODObjectRangeType = typename CIBase::xAODObjectRangeType;
118
120 using xAODElementLinkType = typename CIBase::xAODElementLinkType;
121
122
125
126 using baseId = CIBase;
127
128 static constexpr std::size_t numVariants = sizeof...(CIList);
129
130 static constexpr std::array<std::string_view,numVariants> idNameArray = {CIList::idName...};
131
132 template<ContainerIdConcept CI>
133 static constexpr bool isValidContainer ()
134 {
135 return (... || std::is_same_v<CI,CIList>);
136 }
137
139 template<ContainerIdConcept CI>
140 static constexpr unsigned getVariantIndex ()
141 {
142 constexpr unsigned index = boost::mp11::mp_find<std::tuple<CIList...>,CI>::value;
143 return index;
144 }
145
146 using mpCIList = boost::mp11::mp_list<CIList...>;
147 };
148}
149
150#endif
concept for a container id
Definition index.py:1
a "variant" ContainerId
Definition VariantDef.h:98
static constexpr std::array< std::string_view, numVariants > idNameArray
Definition VariantDef.h:130
static constexpr unsigned getVariantIndex()
get the index of the given container in the list
Definition VariantDef.h:140
static constexpr bool isValidContainer()
Definition VariantDef.h:133
std::map< std::string, HypoJetVector >::const_iterator CI