 |
ATLAS Offline Software
|
Go to the documentation of this file.
8 #ifndef COLUMNAR_VARIANT_VARIANT_ACCESSOR_H
9 #define COLUMNAR_VARIANT_VARIANT_ACCESSOR_H
13 #include <boost/mp11/tuple.hpp>
29 static_assert (!std::is_const_v<CT>,
"CT must not be const");
33 using AccessorTuple = std::tuple<AccessorTemplate<CIList,CT,CAM,CM>...>;
69 return m_accessor.isAvailable (
id.getBaseObject());
94 static_assert (!std::is_const_v<CT>,
"CT must not be const");
98 using AccessorTuple = std::tuple<AccessorTemplate<CIList,CT,CAM,CM>...>;
104 boost::mp11::tuple_for_each (m_accessors, [&columnarTool,&
name,&
info] (
auto&
accessor)
112 m_accessors = std::move (that.m_accessors);
118 m_accessors = std::move (that.m_accessors);
127 boost::mp11::tuple_for_each (m_accessors, [&columnarTool,&
name,&
info] (
auto&
accessor)
135 return internalGet<0> (
id);
140 return internalIsAvailable<0> (
id);
149 template<
unsigned Index>
153 if constexpr (
Index + 1 < CI::numVariants)
154 internalInit<Index + 1>(columnarTool,
name,
info);
157 template<
unsigned Index>
160 if (
id.getVariantIndex() ==
Index)
162 using CI2 = std::tuple_element_t<
Index,std::tuple<CIList...>>;
164 return std::get<Index>(m_accessors)(objId);
165 }
else if constexpr (
Index+1 < CI::numVariants)
166 return internalGet<Index + 1>(
id);
169 std::cerr <<
"Invalid variant index: " <<
id.getVariantIndex() << std::endl;
174 template<
unsigned Index>
177 if (
id.getVariantIndex() ==
Index)
179 using CI2 = std::tuple_element_t<
Index,std::tuple<CIList...>>;
181 return std::get<Index>(m_accessors).isAvailable(objId);
182 }
else if constexpr (
Index+1 < CI::numVariants)
183 return internalIsAvailable<Index + 1>(
id);
186 std::cerr <<
"Invalid variant index: " <<
id.getVariantIndex() << std::endl;
AccessorTemplate() noexcept=default
std::tuple< AccessorTemplate< CIList, CT, CAM, CM >... > AccessorTuple
AccessorTuple m_accessors
AccessorTemplate & operator=(AccessorTemplate &&that)
bool const RAWDATA *ch2 const
bool isAvailable(ObjectId< CI, CM > id) const noexcept
void reset(ColumnarTool< CM > &columnarTool, const std::string &name, ColumnInfo &&info={})
a struct that contains meta-information about each column that's needed to interface the column with ...
IndexedConstituentUserInfo::Index Index
void internalInit(ColumnarTool< CM > &columnarTool, const std::string &name, const ColumnInfo &info)
AccessorTemplate(AccessorTemplate &&that)
ColumnAccessMode
an enum for the different access modes for a column
std::tuple< AccessorTemplate< CIList, CT, CAM, CM >... > AccessorTuple
a class representing a single object (electron, muons, etc.)
void reset(ColumnarTool< CM > &columnarTool, const std::string &name, ColumnInfo &&info={})
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
AccessorTemplate() noexcept=default
AccessorTemplate< CIBase, CT, CAM, CM > m_accessor
concept ContainerIdConcept
concept for a container id
ColumnAccessor< CI, std::vector< typename ColumnTypeTraits< CT, CM >::ColumnType >, CM > m_accessor
bool internalIsAvailable(const ObjectId< CI, CM > &id) const noexcept
AccessorTemplate(const AccessorTemplate &)=delete
the raw column accessor template class
void resetAccessor(AccessorTemplate< CI, CT, CAM, CM > &accessor, ColumnarTool< CM > &columnBase, const std::string &name, ColumnInfo &&info={})
reset a column accessor to point to a new column
AccessorTemplate(const AccessorTemplate &)=delete
bool isAvailable(ObjectId< CI, CM > id) const noexcept
AccessorTemplate(AccessorTemplate &&that)