ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
Columnar
ColumnarTestFixtures
ColumnarTestFixtures
ManualColumnData.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_TEST_FIXTURES_MANUAL_COLUMN_DATA_H
9
#define COLUMNAR_TEST_FIXTURES_MANUAL_COLUMN_DATA_H
10
11
#include <boost/core/demangle.hpp>
12
13
#include <any>
14
#include <memory>
15
#include <span>
16
#include <stdexcept>
17
#include <string>
18
#include <vector>
19
20
namespace
columnar
21
{
22
namespace
TestUtils
23
{
37
38
class
ManualColumnData
final
39
{
42
public
:
43
45
ManualColumnData
(std::vector<std::any>&& data);
46
47
49
void
configureType
(
const
std::string& columnName,
const
std::type_info&
type
);
50
52
[[nodiscard]]
const
std::type_info*
type
()
const
noexcept {
53
return
m_type
; }
54
56
template
<
typename
T>
57
[[nodiscard]] std::span<const T>
getSpan
(
const
std::string& name)
const
58
{
59
if
(
m_type
==
nullptr
)
60
throw
std::runtime_error (
"column "
+ name +
" not configured"
);
61
if
(*
m_type
!=
typeid
(T))
62
throw
std::runtime_error (
"column "
+ name +
" has wrong type: "
+ boost::core::demangle(
m_type
->name()) +
" != "
+ boost::core::demangle(
typeid
(T).name()));
63
return
std::span<const T> (
static_cast<
const
T*
>
(
m_column
.get()),
m_data
.size());
64
}
65
67
[[nodiscard]] std::size_t
columnSize
()
const
noexcept {
68
return
m_data
.size(); }
69
71
[[nodiscard]]
void
*
columnVoidData
() noexcept {
72
return
m_column
.get(); }
73
74
75
78
private
:
79
81
std::vector<std::any>
m_data
;
82
84
const
std::type_info *
m_type
=
nullptr
;
85
87
std::shared_ptr<void>
m_column
;
88
};
89
}
90
}
91
92
#endif
columnar::TestUtils::ManualColumnData::m_column
std::shared_ptr< void > m_column
the column created from m_data
Definition
ManualColumnData.h:87
columnar::TestUtils::ManualColumnData::type
const std::type_info * type() const noexcept
get the type we are configured for
Definition
ManualColumnData.h:52
columnar::TestUtils::ManualColumnData::m_type
const std::type_info * m_type
the actual type for the column
Definition
ManualColumnData.h:84
columnar::TestUtils::ManualColumnData::ManualColumnData
ManualColumnData(std::vector< std::any > &&data)
standard constructor
Definition
ManualColumnData.cxx:64
columnar::TestUtils::ManualColumnData::configureType
void configureType(const std::string &columnName, const std::type_info &type)
configure for the given type
Definition
ManualColumnData.cxx:72
columnar::TestUtils::ManualColumnData::m_data
std::vector< std::any > m_data
a vector of untyped data provided by the user
Definition
ManualColumnData.h:81
columnar::TestUtils::ManualColumnData::columnSize
std::size_t columnSize() const noexcept
get the size of the column
Definition
ManualColumnData.h:67
columnar::TestUtils::ManualColumnData::columnVoidData
void * columnVoidData() noexcept
get the data pointer for the column
Definition
ManualColumnData.h:71
columnar::TestUtils::ManualColumnData::getSpan
std::span< const T > getSpan(const std::string &name) const
get the configured column as an std::span
Definition
ManualColumnData.h:57
const
columnar::TestUtils
Definition
Benchmark.h:20
columnar
Definition
ClusterDef.h:16
Generated on
for ATLAS Offline Software by
1.17.0