28 T castGetAny (
const std::string& columnName,
const std::any& value)
30 if (
value.type() ==
typeid(
float))
31 return std::any_cast<float> (value);
32 if (
value.type() ==
typeid(
double))
33 return std::any_cast<double> (value);
34 if (
value.type() ==
typeid(
char))
35 return std::any_cast<char> (value);
36 if (
value.type() ==
typeid(
int))
37 return std::any_cast<int> (value);
38 if (
value.type() ==
typeid(
unsigned))
39 return std::any_cast<unsigned> (value);
40 if (
value.type() ==
typeid(std::size_t))
41 return std::any_cast<std::size_t> (value);
42 throw std::logic_error (columnName +
": received unsupported input type " + boost::core::demangle(
value.type().name()) +
", cast value or extend test handler to support it");
45 std::vector<T> castGetAnyVector (
const std::string& columnName,
const std::vector<std::any>& value)
50 result.push_back (castGetAny<T> (columnName, v));
54 std::shared_ptr<void> castGetAnyColumn (
const std::string& columnName,
const std::vector<std::any>& value)
56 auto vec = std::make_shared<std::vector<T>> (castGetAnyVector<T> (columnName, value));
57 return std::shared_ptr<void> (
vec,
vec->data());
64 ManualColumnData (std::vector<std::any>&&
data)
71 void ManualColumnData ::
72 configureType (
const std::string& columnName,
const std::type_info&
type)
78 if (
type ==
typeid(
float))
81 }
else if (
type ==
typeid(
char))
84 }
else if (
type ==
typeid(
int))
87 }
else if (
type ==
typeid(std::uint8_t))
90 }
else if (
type ==
typeid(std::uint16_t))
93 }
else if (
type ==
typeid(std::uint32_t))
96 }
else if (
type ==
typeid(std::uint64_t))
100 throw std::runtime_error (
101 columnName +
": column has unsupported type " +
102 boost::core::demangle(
type.name()) +
103 ", extend test handler to support it");
std::vector< size_t > vec
char data[hepevt_bytes_allocation_ATLAS]
std::shared_ptr< void > m_column
the column created from m_data
const std::type_info * type() const noexcept
get the type we are configured for
const std::type_info * m_type
the actual type for the column
std::vector< std::any > m_data
a vector of untyped data provided by the user