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)
127 boost::mp11::tuple_for_each (m_accessors, [&columnarTool,&name,&info] (
auto& accessor)
149 template<
unsigned Index>
157 template<
unsigned Index>
160 if (
id.getVariantIndex() ==
Index)
162 using CI2 = std::tuple_element_t<
Index,std::tuple<CIList...>>;
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);
186 std::cerr <<
"Invalid variant index: " <<
id.getVariantIndex() << std::endl;
IndexedConstituentUserInfo::Index Index
bool isAvailable(ObjectId< CI, CM > id) const noexcept
std::tuple< AccessorTemplate< CIList, CT, CAM, CM >... > AccessorTuple
AccessorTemplate(AccessorTemplate &&that)
AccessorTemplate() noexcept=default
AccessorTemplate(const AccessorTemplate &)=delete
VariantContainerId< CIBase, CIList... > CI
AccessorTemplate< CIBase, CT, CAM, CM > m_accessor
void reset(ColumnarTool< CM > &columnarTool, const std::string &name, ColumnInfo &&info={})
decltype(auto) internalGet(const ObjectId< CI, CM > &id) const noexcept
void reset(ColumnarTool< CM > &columnarTool, const std::string &name, ColumnInfo &&info={})
bool isAvailable(ObjectId< CI, CM > id) const noexcept
VariantContainerId< CIBase, CIList... > CI
AccessorTemplate(const AccessorTemplate &)=delete
bool internalIsAvailable(const ObjectId< CI, CM > &id) const noexcept
AccessorTemplate(AccessorTemplate &&that)
AccessorTuple m_accessors
std::tuple< AccessorTemplate< CIList, CT, CAM, CM >... > AccessorTuple
void internalInit(ColumnarTool< CM > &columnarTool, const std::string &name, const ColumnInfo &info)
AccessorTemplate() noexcept=default
the raw column accessor template class
a class representing a single object (electron, muons, etc.)
concept for a container id
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
ColumnAccessMode
an enum for the different access modes for a column
a struct that contains meta-information about each column that's needed to interface the column with ...
static constexpr std::size_t numVariants