 |
ATLAS Offline Software
|
Go to the documentation of this file.
18 #include <boost/core/demangle.hpp>
83 throw std::logic_error (
"column index out of range");
85 throw std::logic_error (
"offset index out of range");
89 throw std::runtime_error (
"trying to set " +
offset.debugName +
" as offset column for " +
column.debugName +
", but it is not marked as offset column");
91 throw std::runtime_error (
"trying to set " +
offset.debugName +
" as offset column for " +
column.debugName +
", but it is already set to " +
m_elements.at(
column.offsetIndex).debugName);
92 column.offsetIndex = offsetIndex;
107 for (std::size_t columnIndex = 1
u; columnIndex !=
m_elements.size(); ++ columnIndex)
110 if (
column.debugName.empty())
111 throw std::logic_error (
"column " +
std::to_string(columnIndex) +
" has no name");
112 if (
column.type ==
nullptr)
113 throw std::logic_error (
"column " +
column.debugName +
" has no type");
115 throw std::logic_error (
"column " +
column.debugName +
" is an offset column that is of type " + boost::core::demangle(
column.type->name()) +
" instead of ColumnarOffsetType");
118 for (std::size_t columnIndex = 1
u; columnIndex !=
m_elements.size(); ++ columnIndex)
124 throw std::logic_error (
"column " +
column.debugName +
" has an offset index that was never set");
128 if (!offsetElement.isOffset)
129 throw std::logic_error (
"column " +
column.debugName +
" has offset index that is not marked as offset");
142 throw std::logic_error (
"null column is not set to a nullptr value");
143 const auto* sizeVector =
static_cast<const std::size_t*
>(
data[
sizeIndex]);
144 for (std::size_t columnIndex = 0
u; columnIndex !=
m_elements.size(); ++ columnIndex)
147 if (
data[columnIndex] ==
nullptr)
153 throw std::logic_error (
"column " +
column.debugName +
" was not set");
157 const auto size = sizeVector[columnIndex];
159 throw std::runtime_error (
"offset column " +
column.debugName +
" has size " +
std::to_string(
size) +
", but needs at least 1 element");
162 throw std::runtime_error (
"offset column doesn't start with 0: " +
column.debugName);
163 for (std::size_t
i = 1
u;
i !=
size; ++
i)
165 if (offsets[
i] < offsets[
i-1])
170 for (std::size_t columnIndex = 0
u; columnIndex !=
m_elements.size(); ++ columnIndex)
172 if (
data[columnIndex] ==
nullptr)
175 std::size_t expectedSize = 1
u;
179 throw std::runtime_error (
"column " +
column.debugName +
" uses offset column " +
m_elements[
column.offsetIndex].debugName +
" that is not set");
180 const auto offsetIndex =
column.offsetIndex;
182 expectedSize = offsetsPtr[sizeVector[offsetIndex]-1];
184 expectedSize *=
column.arraySize;
189 if (sizeVector[columnIndex] != expectedSize)
198 : m_header (val_header),
199 m_data (val_header->numColumns(), nullptr),
200 m_dataSize (val_header->numColumns(), 0
u)
208 setColumnVoid (std::size_t columnIndex, std::size_t
size,
const void *dataPtr,
const std::type_info&
type,
bool isConst)
211 throw std::logic_error (
"cannot set the null column");
220 if (dataPtr ==
nullptr)
223 throw std::logic_error (
"dataPtr is null but size is not zero for column: " +
header.debugName);
229 throw std::runtime_error (
"invalid type for column: " +
header.debugName);
230 if (isConst && !
header.readOnly)
231 throw std::runtime_error (
"assigning const vector to a column that is not read-only: " +
header.debugName);
232 if (
m_data[columnIndex] !=
nullptr)
233 throw std::runtime_error (
"column filled multiple times: " +
header.debugName);
235 m_data[columnIndex] = castDataPtr;
242 getColumnVoid (std::size_t columnIndex,
const std::type_info *
type,
bool isConst)
249 throw std::runtime_error (
"invalid type for column: " +
header.debugName);
250 if (!isConst &&
header.readOnly)
251 throw std::runtime_error (
"retrieving non-const vector from a read-only column: " +
header.debugName);
252 if (
m_data[columnIndex] !=
nullptr)
255 return std::make_pair (0
u,
nullptr);
char data[hepevt_bytes_allocation_ATLAS]
ColumnAccessMode accessMode
the access mode for the column
std::string name
the name of the column
std::string offsetName
the name of the offset column used for this column (or empty string for none)
void setColumn(std::size_t columnIndex, std::size_t size, CT *dataPtr)
set the data for the given column
ColumnVectorData(const ColumnVectorHeader *val_header)
standard constructor
void checkSelf() const
check the self-consistency of the header
the header information for the entire columnar data vector
static constexpr std::size_t nullIndex
the index used for an invalid index (always has to be 0)
const std::type_info * type
the type of the individual entries in the column
bool isOffset
whether this is an offset column
static constexpr std::size_t unsetIndex
the number used for an unset but non-null index
@ u
Enums for curvilinear frames.
void callNoCheck(const IColumnarTool &tool)
call the tool with the assembled data, without performing any checks on the data
std::vector< void * > m_data
std::size_t addColumn(const ColumnInfo &columnInfo)
add a column for the given ColumnInfo, returning its index
std::pair< std::size_t, const void * > getColumnVoid(std::size_t columnIndex, const std::type_info *type, bool isConst)
a struct that contains meta-information about each column that's needed to interface the column with ...
void setColumnVoid(std::size_t columnIndex, std::size_t size, const void *dataPtr, const std::type_info &type, bool isConst)
std::size_t numColumns() const noexcept
the number of columns in the columnar data vector
bool isOptional
whether this column is optional
std::vector< std::size_t > m_dataSize
std::size_t size() const noexcept
@ update
an updateable column
static constexpr std::size_t sizeIndex
the index used for the column size column
static constexpr std::size_t numFixedColumns
the number of fix elements in the columnar data vector
std::string to_string(const DetectorType &type)
const ColumnVectorElementHeader & getColumn(std::size_t index) const
get the column for the given index
std::vector< ColumnVectorElementHeader > m_elements
the elements in the columnar data vector
void setOffsetColumn(std::size_t columnIndex, std::size_t offsetIndex)
set the index of the offset column for the given column
#define ATLAS_THREAD_SAFE
void checkData(std::span< const void *const > data) const
do a basic check of the data vector
Define macros for attributes used to control the static checker.
std::size_t ColumnarOffsetType
the type used for the size and offsets in the columnar data
std::vector< unsigned > fixedDimensions
the fixed dimensions this column has (if any)
ColumnVectorHeader()
standard contructor
const ColumnVectorHeader * m_header