8#ifndef COLUMNAR_TOOL_WRAPPER_COLUMN_VECTOR_WRAPPER_H
9#define COLUMNAR_TOOL_WRAPPER_COLUMN_VECTOR_WRAPPER_H
16#include <unordered_map>
48 const std::type_info *
type =
nullptr;
127 static constexpr std::size_t
unsetIndex =
static_cast<std::size_t
>(-1);
140 void setOffsetColumn (std::size_t columnIndex, std::size_t offsetIndex);
153 [[nodiscard]] std::size_t
159 [[nodiscard]] std::unordered_map<std::string, ColumnInfo>
getAllColumnInfo()
const;
198 template<
typename CT>
199 void setColumn (std::size_t columnIndex, std::size_t size, CT* dataPtr) {
200 auto voidPtr =
reinterpret_cast<const void*
>(
const_cast<const CT*
>(dataPtr));
201 setColumnVoid (columnIndex, size, voidPtr,
typeid (std::decay_t<CT>), std::is_const_v<CT>);
203 void setColumnVoid (std::size_t columnIndex, std::size_t size,
const void *dataPtr,
const std::type_info&
type,
bool isConst);
207 template<
typename CT>
208 [[nodiscard]] std::pair<std::size_t,CT*>
211 auto [size, ptr] =
getColumnVoid (columnIndex, &
typeid (std::decay_t<CT>), std::is_const_v<CT>);
212 if constexpr (std::is_const_v<CT>)
213 return std::make_pair (size,
static_cast<CT*
>(ptr));
215 return std::make_pair (size,
static_cast<CT*
>(
const_cast<void*
>(ptr)));
217 [[nodiscard]] std::pair<std::size_t,const void*>
218 getColumnVoid (std::size_t columnIndex,
const std::type_info *
type,
bool isConst);
char data[hepevt_bytes_allocation_ATLAS]
std::pair< std::size_t, const void * > getColumnVoid(std::size_t columnIndex, const std::type_info *type, bool isConst)
void setColumnVoid(std::size_t columnIndex, std::size_t size, const void *dataPtr, const std::type_info &type, bool isConst)
const ColumnVectorHeader * m_header
void checkData() const
do a basic check of the data vector
void callNoCheck(const IColumnarTool &tool)
call the tool with the assembled data, without performing any checks on the data
std::vector< void * > m_data
void setColumn(std::size_t columnIndex, std::size_t size, CT *dataPtr)
set the data for the given column
std::pair< std::size_t, CT * > getColumn(std::size_t columnIndex)
get the data for the given column
std::vector< std::size_t > m_dataSize
ColumnVectorData(const ColumnVectorHeader *val_header)
standard constructor
the header information for the entire columnar data vector
std::size_t addColumn(const ColumnInfo &columnInfo)
add a column for the given ColumnInfo, returning its index
void setOffsetColumn(std::size_t columnIndex, std::size_t offsetIndex)
set the index of the offset column for the given column
static constexpr std::size_t nullIndex
the index used for an invalid index (always has to be 0)
void checkData(std::span< const void *const > data) const
do a basic check of the data vector
static constexpr std::size_t numFixedColumns
the number of fix elements in the columnar data vector
void checkSelf() const
check the self-consistency of the header
std::unordered_map< std::string, std::size_t > m_nameToIndex
map from column name to index for deduplication
static constexpr std::size_t unsetIndex
the number used for an unset but non-null index
std::size_t getColumnIndex(const std::string &name) const noexcept
get the column index for the given name, or nullIndex if not found
std::vector< ColumnVectorElementHeader > m_elements
the elements in the columnar data vector
std::size_t numColumns() const noexcept
the number of columns in the columnar data vector
const ColumnVectorElementHeader & getColumn(std::size_t index) const
get the column for the given index
ColumnVectorHeader()
standard contructor
std::unordered_map< std::string, ColumnInfo > getAllColumnInfo() const
get all columns as a map of ColumnInfo for use with IColumnData::connect
static constexpr std::size_t sizeIndex
the index used for the column size 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 ...
the header information for a single element in the columnar data vector
std::vector< unsigned > fixedDimensions
the fixed dimensions (if any)
bool isOffset
whether this is an offset column
unsigned arraySize
the total size of all inner array dimensions
bool readOnly
whether this column will only be used for read access
ColumnAccessMode accessMode
the access mode for the column
std::string offsetName
the name of the offset column (or empty for none)
std::size_t offsetIndex
the index of the offset column (or nullIndex for none)
std::vector< std::string > linkTargetNames
for link columns: the target container names
const std::type_info * type
the type to use for the column
bool isOptional
whether this column is optional
std::string debugName
the name of the column to use in messages
std::string variantLinkKeyColumn
if this is a variant link column, the name of the key column