Skip to content

Commit 69248f6

Browse files
committed
remove usage of obsolete traits
1 parent e0a4d7e commit 69248f6

File tree

5 files changed

+13
-84
lines changed

5 files changed

+13
-84
lines changed

Framework/Core/include/Framework/ASoA.h

Lines changed: 6 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ template <typename C>
152152
static constexpr bool is_persistent_v = is_persistent_column<C>;
153153

154154
template <typename C>
155-
concept is_index_column = requires { typename C::binding_t{nullptr}; };
155+
concept is_index_column = not_void<typename C::binding_t>;//requires { typename C::binding_t{nullptr}; };
156156

157157
template <typename C>
158158
using is_external_index_t = typename std::conditional_t<is_index_column<C>, std::true_type, std::false_type>;
@@ -205,51 +205,15 @@ inline constexpr bool is_type_with_originals_v = false;
205205
template <typename T>
206206
inline constexpr bool is_type_with_originals_v<T, std::void_t<decltype(sizeof(typename T::originals))>> = true;
207207

208-
template <typename T, typename = void>
209-
inline constexpr bool is_type_with_parent_v = false;
210-
211208
template <typename T>
212-
inline constexpr bool is_type_with_parent_v<T, std::void_t<decltype(sizeof(typename T::parent_t))>> = true;
209+
concept has_parent_t = not_void<typename T::parent_t>;
213210

214211
template <typename T>
215212
concept has_metadata = soa::not_void<typename aod::MetadataTrait<T>::metadata>;
216213

217-
template <typename T>
218-
inline constexpr bool is_type_with_metadata_v = has_metadata<T>;
219-
220-
template <typename, typename = void>
221-
inline constexpr bool is_type_spawnable_v = false;
222-
223-
template <typename T>
224-
inline constexpr bool is_type_spawnable_v<T, std::void_t<decltype(sizeof(typename T::spawnable_t))>> = true;
225-
226-
template <typename, typename = void>
227-
inline constexpr bool is_soa_extension_table_v = false;
228-
229-
template <typename T>
230-
inline constexpr bool is_soa_extension_table_v<T, std::void_t<decltype(sizeof(typename T::expression_pack_t))>> = true;
231-
232-
template <typename T, typename = void>
233-
inline constexpr bool is_index_table_v = false;
234-
235-
template <typename T>
236-
inline constexpr bool is_index_table_v<T, std::void_t<decltype(sizeof(typename T::indexing_t))>> = true;
237-
238-
template <typename, typename = void>
239-
inline constexpr bool is_self_index_column_v = false;
240-
241-
template <typename T>
242-
inline constexpr bool is_self_index_column_v<T, std::void_t<decltype(sizeof(typename T::self_index_t))>> = true;
243-
244214
template <typename T>
245215
concept is_spawnable_column = std::is_same_v<typename T::spawnable_t, std::true_type>;
246216

247-
template <typename, typename = void>
248-
inline constexpr bool is_with_base_table_v = false;
249-
250-
template <typename T>
251-
inline constexpr bool is_with_base_table_v<T, std::void_t<decltype(sizeof(typename T::base_table_t))>> = true;
252-
253217
template <typename B, typename E>
254218
struct EquivalentIndex {
255219
constexpr static bool value = false;
@@ -283,7 +247,7 @@ consteval decltype(auto) make_originals_from_type()
283247
return typename decayed::originals{};
284248
} else if constexpr (is_type_with_originals_v<typename decayed::table_t>) {
285249
return typename decayed::table_t::originals{};
286-
} else if constexpr (is_type_with_parent_v<decayed>) {
250+
} else if constexpr (soa::has_parent_t<decayed>) {
287251
return make_originals_from_type<typename decayed::parent_t>();
288252
} else {
289253
return framework::pack<decayed>{};
@@ -1730,8 +1694,8 @@ class Table
17301694
inline arrow::ChunkedArray* getIndexToKey()
17311695
{
17321696
if constexpr (framework::has_type_conditional<is_binding_compatible, Key>(external_index_columns_t{})) {
1733-
using IC = framework::pack_element_t<framework::has_type_at_conditional<is_binding_compatible, Key>(external_index_columns_t{}), external_index_columns_t>;
1734-
return mColumnChunks[framework::has_type_at<IC>(persistent_columns_t{})];
1697+
using IC = framework::pack_element_t<framework::has_type_at_conditional_v<is_binding_compatible, Key>(external_index_columns_t{}), external_index_columns_t>;
1698+
return mColumnChunks[framework::has_type_at_v<IC>(persistent_columns_t{})];
17351699
} else if constexpr (std::is_same_v<table_t, Key>) {
17361700
return nullptr;
17371701
} else {
@@ -2027,7 +1991,7 @@ DECLARE_SOA_ITERATOR_METADATA();
20271991
template <typename T> \
20281992
consteval int getVersion() \
20291993
{ \
2030-
if constexpr (o2::soa::is_type_with_metadata_v<MetadataTrait<T>>) { \
1994+
if constexpr (o2::soa::has_metadata<MetadataTrait<T>>) { \
20311995
return MetadataTrait<T>::metadata::version(); \
20321996
} else if constexpr (o2::soa::is_type_with_originals_v<T>) { \
20331997
return MetadataTrait<o2::framework::pack_head_t<typename T::originals>>::metadata::version(); \

Framework/Core/include/Framework/AnalysisHelpers.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,16 +244,15 @@ namespace
244244
template <typename T, typename Key>
245245
inline std::shared_ptr<arrow::ChunkedArray> getIndexToKey(arrow::Table* table)
246246
{
247-
using IC = framework::pack_element_t<framework::has_type_at_conditional<soa::is_binding_compatible, Key>(typename T::external_index_columns_t{}), typename T::external_index_columns_t>;
248-
return table->column(framework::has_type_at<IC>(typename T::persistent_columns_t{}));
247+
using IC = framework::pack_element_t<framework::has_type_at_conditional_v<soa::is_binding_compatible, Key>(typename T::external_index_columns_t{}), typename T::external_index_columns_t>;
248+
return table->column(framework::has_type_at_v<IC>(typename T::persistent_columns_t{}));
249249
}
250250

251-
template <typename C>
251+
template <soa::is_column C>
252252
struct ColumnTrait {
253-
static_assert(framework::is_base_of_template_v<o2::soa::Column, C>, "Not a column type!");
254253
using column_t = C;
255254

256-
static constexpr auto listSize()
255+
static consteval auto listSize()
257256
{
258257
if constexpr (std::is_same_v<typename C::type, std::vector<int>>) {
259258
return -1;

Framework/Core/include/Framework/AnalysisTask.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct AnalysisDataProcessorBuilder {
8989
}
9090

9191
template <typename T>
92-
static inline auto getSources() requires soa::is_soa_extension_table_v<std::decay_t<T>>
92+
static inline auto getSources() requires soa::with_base_table<std::decay_t<T>>
9393
{
9494
return getInputSpecs(typename aod::MetadataTrait<T>::metadata::sources{});
9595
}
@@ -132,7 +132,7 @@ struct AnalysisDataProcessorBuilder {
132132
using metadata = typename aod::MetadataTrait<std::decay_t<O>>::metadata;
133133
std::vector<ConfigParamSpec> inputMetadata;
134134
inputMetadata.emplace_back(ConfigParamSpec{std::string{"control:"} + name, VariantType::Bool, value, {"\"\""}});
135-
if constexpr (soa::is_index_table<std::decay_t<O>> || soa::is_soa_extension_table_v<std::decay_t<O>>) {
135+
if constexpr (soa::is_index_table<std::decay_t<O>> || soa::with_base_table<std::decay_t<O>>) {
136136
auto inputSources = getInputMetadata<std::decay_t<O>>();
137137
inputMetadata.insert(inputMetadata.end(), inputSources.begin(), inputSources.end());
138138
}

Framework/Core/include/Framework/GroupedCombinations.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ struct GroupedCombinationsGenerator {
9393
} else {
9494
mGrouping = std::make_shared<G>(std::vector{grouping.asArrowTable()});
9595
}
96-
mAssociated = std::make_shared<std::tuple<As...>>(std::make_tuple(std::get<has_type_at<As>(pack<T2s...>{})>(associated)...));
96+
mAssociated = std::make_shared<std::tuple<As...>>(std::make_tuple(std::get<has_type_at_v<As>(pack<T2s...>{})>(associated)...));
9797
setMultipleGroupingTables<sizeof...(As)>(grouping);
9898
if (!this->mIsEnd) {
9999
setCurrentGroupedCombination();

Framework/Foundation/include/Framework/Pack.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -224,40 +224,6 @@ bool consteval has_type_conditional(framework::pack<Us...>)
224224
template <template <typename, typename> typename Condition, typename T, typename P>
225225
inline constexpr bool has_type_conditional_v = has_type_conditional<Condition, T>(P{});
226226

227-
template <typename T>
228-
constexpr size_t has_type_at(pack<> const&)
229-
{
230-
return static_cast<size_t>(-1);
231-
}
232-
233-
template <typename T, typename T1, typename... Ts>
234-
constexpr size_t has_type_at(pack<T1, Ts...> const&)
235-
{
236-
if constexpr (std::is_same_v<T, T1>) {
237-
return 0;
238-
} else if constexpr (has_type<T>(pack<Ts...>{})) {
239-
return 1 + has_type_at<T>(pack<Ts...>{});
240-
}
241-
return sizeof...(Ts) + 2;
242-
}
243-
244-
template <template <typename, typename> typename Condition, typename T>
245-
constexpr size_t has_type_at_conditional(pack<>&&)
246-
{
247-
return static_cast<size_t>(-1);
248-
}
249-
250-
template <template <typename, typename> typename Condition, typename T, typename T1, typename... Ts>
251-
constexpr size_t has_type_at_conditional(pack<T1, Ts...>&&)
252-
{
253-
if constexpr (Condition<T, T1>::value) {
254-
return 0;
255-
} else if constexpr (has_type_conditional_v<Condition, T, pack<Ts...>>) {
256-
return 1 + has_type_at_conditional<Condition, T>(pack<Ts...>{});
257-
}
258-
return sizeof...(Ts) + 2;
259-
}
260-
261227
template <typename T, typename... Ts>
262228
consteval size_t has_type_at_v(pack<Ts...>)
263229
{

0 commit comments

Comments
 (0)