1 #ifndef DataFormats_SoATemplate_interface_SoAView_h 2 #define DataFormats_SoATemplate_interface_SoAView_h 12 #define SOA_VIEW_LAYOUT(TYPE, NAME) (TYPE, NAME) 14 #define SOA_VIEW_LAYOUT_LIST(...) __VA_ARGS__ 16 #define SOA_VIEW_VALUE(LAYOUT_NAME, LAYOUT_MEMBER) (LAYOUT_NAME, LAYOUT_MEMBER, LAYOUT_MEMBER) 18 #define SOA_VIEW_VALUE_RENAME(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) (LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) 20 #define SOA_VIEW_VALUE_LIST(...) __VA_ARGS__ 46 template <
class C, SoAColumnType COLUMN_TYPE>
69 #define _DECLARE_VIEW_LAYOUT_PARAMETRIZED_TEMPLATE_IMPL(TYPE, NAME) \ 70 (using BOOST_PP_CAT(TYPE, _default) = BOOST_PP_CAT(TYPE, _StagedTemplates) < VIEW_ALIGNMENT, \ 71 VIEW_ALIGNMENT_ENFORCEMENT > ;) 73 #define _DECLARE_VIEW_LAYOUT_PARAMETRIZED_TEMPLATE(R, DATA, TYPE_NAME) \ 74 BOOST_PP_EXPAND(_DECLARE_VIEW_LAYOUT_PARAMETRIZED_TEMPLATE_IMPL TYPE_NAME) 79 #define _DECLARE_VIEW_LAYOUT_TYPE_ALIAS_IMPL(TYPE, NAME) using BOOST_PP_CAT(TypeOf_, NAME) = TYPE; 81 #define _DECLARE_VIEW_LAYOUT_TYPE_ALIAS(R, DATA, TYPE_NAME) \ 82 BOOST_PP_EXPAND(_DECLARE_VIEW_LAYOUT_TYPE_ALIAS_IMPL TYPE_NAME) 88 #define _DECLARE_VIEW_MEMBER_TYPE_ALIAS_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, CAST) \ 89 using BOOST_PP_CAT(TypeOf_, LOCAL_NAME) = \ 90 typename BOOST_PP_CAT(TypeOf_, LAYOUT_NAME)::Metadata::BOOST_PP_CAT(TypeOf_, LAYOUT_MEMBER); \ 91 using BOOST_PP_CAT(ParametersTypeOf_, LOCAL_NAME) = \ 92 typename BOOST_PP_CAT(TypeOf_, LAYOUT_NAME)::Metadata::BOOST_PP_CAT(ParametersTypeOf_, LAYOUT_MEMBER); \ 93 constexpr static cms::soa::SoAColumnType BOOST_PP_CAT(ColumnTypeOf_, LOCAL_NAME) = \ 94 BOOST_PP_CAT(TypeOf_, LAYOUT_NAME)::Metadata::BOOST_PP_CAT(ColumnTypeOf_, LAYOUT_MEMBER); \ 95 using BOOST_PP_CAT(ConstAccessorOf_, LOCAL_NAME) = \ 96 typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 97 template ColumnType<BOOST_PP_CAT(ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 98 cms::soa::SoAAccessType::constAccess>::template Alignment<conditionalAlignment>:: \ 99 template RestrictQualifier<restrictQualify> ; \ 100 using BOOST_PP_CAT(MutableAccessorOf_, LOCAL_NAME) = \ 101 typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 102 template ColumnType<BOOST_PP_CAT(ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 103 cms::soa::SoAAccessType::mutableAccess>::template Alignment<conditionalAlignment>:: \ 104 template RestrictQualifier<restrictQualify> ; \ 105 SOA_HOST_DEVICE SOA_INLINE \ 106 const auto BOOST_PP_CAT(parametersOf_, LOCAL_NAME)() const { \ 107 return CAST(parent_.BOOST_PP_CAT(LOCAL_NAME, Parameters_)); \ 118 #define _DECLARE_VIEW_MEMBER_TYPE_ALIAS(R, DATA, LAYOUT_MEMBER_NAME) \ 119 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_TYPE_ALIAS_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 125 #define _DECLARE_VIEW_MEMBER_POINTERS_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 126 SOA_HOST_DEVICE SOA_INLINE auto* BOOST_PP_CAT(addressOf_, LOCAL_NAME)() { \ 127 return BOOST_PP_CAT(parametersOf_, LOCAL_NAME)().addr_; \ 131 #define _DECLARE_VIEW_MEMBER_POINTERS(R, DATA, LAYOUT_MEMBER_NAME) \ 132 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_POINTERS_IMPL LAYOUT_MEMBER_NAME) 138 #define _DECLARE_VIEW_MEMBER_CONST_POINTERS_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 139 SOA_HOST_DEVICE SOA_INLINE auto const* BOOST_PP_CAT(addressOf_, LOCAL_NAME)() const { \ 140 return BOOST_PP_CAT(parametersOf_, LOCAL_NAME)().addr_; \ 144 #define _DECLARE_VIEW_MEMBER_CONST_POINTERS(R, DATA, LAYOUT_MEMBER_NAME) \ 145 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_CONST_POINTERS_IMPL LAYOUT_MEMBER_NAME) 150 #define _DECLARE_VIEW_CONSTRUCTION_PARAMETERS_IMPL(LAYOUT_TYPE, LAYOUT_NAME, DATA) (DATA LAYOUT_TYPE & LAYOUT_NAME) 152 #define _DECLARE_VIEW_CONSTRUCTION_PARAMETERS(R, DATA, TYPE_NAME) \ 153 BOOST_PP_EXPAND(_DECLARE_VIEW_CONSTRUCTION_PARAMETERS_IMPL BOOST_PP_TUPLE_PUSH_BACK(TYPE_NAME, DATA)) 158 #define _DECLARE_VIEW_CONSTRUCTION_BYCOLUMN_PARAMETERS_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, DATA) \ 159 (DATA typename BOOST_PP_CAT(Metadata::ParametersTypeOf_, LOCAL_NAME)::TupleOrPointerType LOCAL_NAME) 161 #define _DECLARE_VIEW_CONSTRUCTION_BYCOLUMN_PARAMETERS(R, DATA, LAYOUT_MEMBER_NAME) \ 163 _DECLARE_VIEW_CONSTRUCTION_BYCOLUMN_PARAMETERS_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 170 #define _DECLARE_VIEW_MEMBER_INITIALIZERS_IMPL(LAYOUT, MEMBER, NAME) \ 171 (BOOST_PP_CAT(NAME, Parameters_)([&]() -> auto { \ 172 auto params = LAYOUT.metadata().BOOST_PP_CAT(parametersOf_, MEMBER)(); \ 173 if constexpr (alignmentEnforcement == AlignmentEnforcement::enforced) \ 174 if (reinterpret_cast<intptr_t>(params.addr_) % alignment) \ 175 throw std::runtime_error("In constructor by layout: misaligned column: " #NAME); \ 180 #define _DECLARE_VIEW_MEMBER_INITIALIZERS(R, DATA, LAYOUT_MEMBER_NAME) \ 181 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_INITIALIZERS_IMPL LAYOUT_MEMBER_NAME) 188 #define _UPDATE_SIZE_OF_VIEW_IMPL(LAYOUT_TYPE, LAYOUT_NAME) \ 190 if (ret != LAYOUT_NAME.metadata().size()) \ 191 throw std::runtime_error("In constructor by layout: different sizes from layouts."); \ 193 ret = LAYOUT_NAME.metadata().size(); \ 198 #define _UPDATE_SIZE_OF_VIEW(R, DATA, TYPE_NAME) BOOST_PP_EXPAND(_UPDATE_SIZE_OF_VIEW_IMPL TYPE_NAME) 205 #define _DECLARE_VIEW_MEMBER_INITIALIZERS_BYCOLUMN_IMPL(LAYOUT, MEMBER, NAME) \ 207 BOOST_PP_CAT(NAME, Parameters_)([&]() -> auto { \ 208 if constexpr (alignmentEnforcement == AlignmentEnforcement::enforced) \ 209 if (Metadata:: BOOST_PP_CAT(ParametersTypeOf_, NAME)::checkAlignment(NAME, alignment)) \ 210 throw std::runtime_error("In constructor by column: misaligned column: " #NAME); \ 216 #define _DECLARE_VIEW_MEMBER_INITIALIZERS_BYCOLUMN(R, DATA, LAYOUT_MEMBER_NAME) \ 217 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_INITIALIZERS_BYCOLUMN_IMPL LAYOUT_MEMBER_NAME) 222 #define _DECLARE_LAYOUT_LIST_IMPL(LAYOUT, NAME) (NAME) 224 #define _DECLARE_LAYOUT_LIST(R, DATA, LAYOUT_MEMBER_NAME) BOOST_PP_EXPAND(_DECLARE_LAYOUT_LIST_IMPL LAYOUT_MEMBER_NAME) 229 #define _DECLARE_VIEW_MEMBER_LIST_IMPL(LAYOUT, MEMBER, NAME) (NAME) 231 #define _DECLARE_VIEW_MEMBER_LIST(R, DATA, LAYOUT_MEMBER_NAME) \ 232 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_LIST_IMPL LAYOUT_MEMBER_NAME) 237 #define _DECLARE_VIEW_OTHER_MEMBER_LIST_IMPL(LAYOUT, MEMBER, NAME) \ 238 (const_cast_SoAParametersImpl(other.BOOST_PP_CAT(NAME, Parameters_)).tupleOrPointer()) 240 #define _DECLARE_VIEW_OTHER_MEMBER_LIST(R, DATA, LAYOUT_MEMBER_NAME) \ 241 BOOST_PP_EXPAND(_DECLARE_VIEW_OTHER_MEMBER_LIST_IMPL LAYOUT_MEMBER_NAME) 246 #define _DECLARE_VIEW_MEMBER_INITIALIZERS_FROM_OTHER_IMPL(LAYOUT, MEMBER, LOCAL_NAME, DATA) \ 247 (BOOST_PP_CAT(MEMBER, Parameters_){DATA.BOOST_PP_CAT(MEMBER, Parameters_)}) 249 #define _DECLARE_VIEW_MEMBER_INITIALIZERS_FROM_OTHER(R, DATA, LAYOUT_MEMBER_NAME) \ 250 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_INITIALIZERS_FROM_OTHER_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 255 #define _DECLARE_VIEW_MEMBER_ASSIGNMENT_FROM_OTHER_IMPL(LAYOUT, MEMBER, LOCAL_NAME, DATA) \ 256 BOOST_PP_CAT(MEMBER, Parameters_) = DATA.BOOST_PP_CAT(MEMBER, Parameters_); 258 #define _DECLARE_VIEW_MEMBER_ASSIGNMENT_FROM_OTHER(R, DATA, LAYOUT_MEMBER_NAME) \ 259 BOOST_PP_EXPAND(_DECLARE_VIEW_MEMBER_ASSIGNMENT_FROM_OTHER_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 264 #define _DECLARE_VIEW_ELEM_MEMBER_INIT_IMPL(LAYOUT, MEMBER, LOCAL_NAME, DATA) (LOCAL_NAME(DATA, LOCAL_NAME)) 266 #define _DECLARE_VIEW_ELEM_MEMBER_INIT(R, DATA, LAYOUT_MEMBER_NAME) \ 267 BOOST_PP_EXPAND(_DECLARE_VIEW_ELEM_MEMBER_INIT_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 272 #define _COLUMN_TYPE(LAYOUT_NAME, LAYOUT_MEMBER) \ 273 typename std::remove_pointer<decltype(BOOST_PP_CAT(LAYOUT_NAME, Type)()::LAYOUT_MEMBER())>::type 278 #define _DECLARE_VIEW_ELEMENT_VALUE_ARG_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, DATA) \ 279 (DATA typename BOOST_PP_CAT(Metadata::ParametersTypeOf_, LOCAL_NAME) LOCAL_NAME) 281 #define _DECLARE_VIEW_ELEMENT_VALUE_ARG(R, DATA, LAYOUT_MEMBER_NAME) \ 282 _DECLARE_VIEW_ELEMENT_VALUE_ARG_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA) 287 #define _DECLARE_CONST_VIEW_ELEMENT_VALUE_ARG_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, DATA) \ 288 (DATA typename BOOST_PP_CAT(Metadata::ParametersTypeOf_, LOCAL_NAME)::ConstType LOCAL_NAME) 290 #define _DECLARE_CONST_VIEW_ELEMENT_VALUE_ARG(R, DATA, LAYOUT_MEMBER_NAME) \ 291 _DECLARE_CONST_VIEW_ELEMENT_VALUE_ARG_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA) 296 #define _DECLARE_VIEW_CONST_ELEM_MEMBER_INIT_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, DATA) \ 297 (BOOST_PP_CAT(LOCAL_NAME, _)(DATA, LOCAL_NAME)) 300 #define _DECLARE_VIEW_CONST_ELEM_MEMBER_INIT(R, DATA, LAYOUT_MEMBER_NAME) \ 301 BOOST_PP_EXPAND(_DECLARE_VIEW_CONST_ELEM_MEMBER_INIT_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 307 #define _DECLARE_VIEW_CONST_ELEMENT_ACCESSOR_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 308 SOA_HOST_DEVICE SOA_INLINE \ 309 const typename SoAConstValueWithConf<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME), \ 310 const typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>::RefToConst \ 311 LOCAL_NAME() const { \ 312 return BOOST_PP_CAT(LOCAL_NAME, _)(); \ 316 #define _DECLARE_VIEW_CONST_ELEMENT_ACCESSOR(R, DATA, LAYOUT_MEMBER_NAME) \ 317 _DECLARE_VIEW_CONST_ELEMENT_ACCESSOR_IMPL LAYOUT_MEMBER_NAME 323 #define _DECLARE_VIEW_CONST_ELEMENT_VALUE_MEMBER_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 324 const cms::soa::ConstValueTraits<SoAConstValueWithConf<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME), \ 325 typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>, \ 326 BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)> \ 327 BOOST_PP_CAT(LOCAL_NAME, _); 330 #define _DECLARE_VIEW_CONST_ELEMENT_VALUE_MEMBER(R, DATA, LAYOUT_MEMBER_NAME) \ 331 _DECLARE_VIEW_CONST_ELEMENT_VALUE_MEMBER_IMPL LAYOUT_MEMBER_NAME 336 #define _DECLARE_VIEW_ELEMENT_VALUE_COPY_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 337 if constexpr (Metadata::BOOST_PP_CAT(ColumnTypeOf_, LOCAL_NAME) != cms::soa::SoAColumnType::scalar) \ 338 LOCAL_NAME() = _soa_impl_other.LOCAL_NAME(); 340 #define _DECLARE_VIEW_ELEMENT_VALUE_COPY(R, DATA, LAYOUT_MEMBER_NAME) \ 341 BOOST_PP_EXPAND(_DECLARE_VIEW_ELEMENT_VALUE_COPY_IMPL LAYOUT_MEMBER_NAME) 347 #define _DECLARE_VIEW_ELEMENT_VALUE_MEMBER_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 348 SoAValueWithConf<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME), \ 349 typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)> \ 353 #define _DECLARE_VIEW_ELEMENT_VALUE_MEMBER(R, DATA, LAYOUT_MEMBER_NAME) \ 354 _DECLARE_VIEW_ELEMENT_VALUE_MEMBER_IMPL LAYOUT_MEMBER_NAME 359 #define _DECLARE_VIEW_CONST_ELEMENT_CONSTR_CALL_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 360 (BOOST_PP_CAT(LOCAL_NAME, Parameters_)) 362 #define _DECLARE_VIEW_CONST_ELEMENT_CONSTR_CALL(R, DATA, LAYOUT_MEMBER_NAME) \ 363 BOOST_PP_EXPAND(_DECLARE_VIEW_CONST_ELEMENT_CONSTR_CALL_IMPL LAYOUT_MEMBER_NAME) 371 #define _DECLARE_VIEW_ELEMENT_CONSTR_CALL_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 372 (const_cast_SoAParametersImpl(base_type::BOOST_PP_CAT(LOCAL_NAME, Parameters_))) 374 #define _DECLARE_VIEW_ELEMENT_CONSTR_CALL(R, DATA, LAYOUT_MEMBER_NAME) \ 375 BOOST_PP_EXPAND(_DECLARE_VIEW_ELEMENT_CONSTR_CALL_IMPL LAYOUT_MEMBER_NAME) 381 #define _DECLARE_VIEW_SOA_ACCESSOR_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 383 SOA_HOST_DEVICE SOA_INLINE \ 384 typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 385 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 386 cms::soa::SoAAccessType::mutableAccess>::template Alignment<conditionalAlignment>:: \ 387 template RestrictQualifier<restrictQualify>::NoParamReturnType \ 389 return typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 390 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 391 cms::soa::SoAAccessType::mutableAccess>::template Alignment<conditionalAlignment>:: \ 392 template RestrictQualifier<restrictQualify>(const_cast_SoAParametersImpl( \ 393 base_type:: BOOST_PP_CAT(LOCAL_NAME, Parameters_)))(); \ 395 SOA_HOST_DEVICE SOA_INLINE \ 396 typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 397 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 398 cms::soa::SoAAccessType::mutableAccess>::template Alignment<conditionalAlignment>:: \ 399 template RestrictQualifier<restrictQualify>::ParamReturnType \ 400 LOCAL_NAME(size_type _soa_impl_index) { \ 401 if constexpr (rangeChecking == cms::soa::RangeChecking::enabled) { \ 402 if (_soa_impl_index >= base_type::elements_ or _soa_impl_index < 0) \ 403 SOA_THROW_OUT_OF_RANGE("Out of range index in mutable " #LOCAL_NAME "(size_type index)") \ 405 return typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 406 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 407 cms::soa::SoAAccessType::mutableAccess>::template Alignment<conditionalAlignment>:: \ 408 template RestrictQualifier<restrictQualify>(const_cast_SoAParametersImpl( \ 409 base_type:: BOOST_PP_CAT(LOCAL_NAME, Parameters_)))(_soa_impl_index); \ 413 #define _DECLARE_VIEW_SOA_ACCESSOR(R, DATA, LAYOUT_MEMBER_NAME) \ 414 BOOST_PP_EXPAND(_DECLARE_VIEW_SOA_ACCESSOR_IMPL LAYOUT_MEMBER_NAME) 420 #define _DECLARE_VIEW_SOA_CONST_ACCESSOR_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME) \ 422 SOA_HOST_DEVICE SOA_INLINE \ 423 typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 424 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 425 cms::soa::SoAAccessType::constAccess>::template Alignment<conditionalAlignment>:: \ 426 template RestrictQualifier<restrictQualify>::NoParamReturnType \ 427 LOCAL_NAME() const { \ 428 return typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 429 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 430 cms::soa::SoAAccessType::constAccess>::template Alignment<conditionalAlignment>:: \ 431 template RestrictQualifier<restrictQualify>(BOOST_PP_CAT(LOCAL_NAME, Parameters_))(); \ 433 SOA_HOST_DEVICE SOA_INLINE \ 434 typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 435 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 436 cms::soa::SoAAccessType::constAccess>::template Alignment<conditionalAlignment>:: \ 437 template RestrictQualifier<restrictQualify>::ParamReturnType \ 438 LOCAL_NAME(size_type _soa_impl_index) const { \ 439 if constexpr (rangeChecking == cms::soa::RangeChecking::enabled) { \ 440 if (_soa_impl_index >= elements_ or _soa_impl_index < 0) \ 441 SOA_THROW_OUT_OF_RANGE("Out of range index in const " #LOCAL_NAME "(size_type index)") \ 443 return typename cms::soa::SoAAccessors<typename BOOST_PP_CAT(Metadata::TypeOf_, LOCAL_NAME)>:: \ 444 template ColumnType<BOOST_PP_CAT(Metadata::ColumnTypeOf_, LOCAL_NAME)>::template AccessType< \ 445 cms::soa::SoAAccessType::constAccess>::template Alignment<conditionalAlignment>:: \ 446 template RestrictQualifier<restrictQualify>(BOOST_PP_CAT(LOCAL_NAME, Parameters_))(_soa_impl_index); \ 450 #define _DECLARE_VIEW_SOA_CONST_ACCESSOR(R, DATA, LAYOUT_MEMBER_NAME) \ 451 BOOST_PP_EXPAND(_DECLARE_VIEW_SOA_CONST_ACCESSOR_IMPL LAYOUT_MEMBER_NAME) 456 #define _DECLARE_VIEW_SOA_MEMBER_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, DATA) \ 457 typename BOOST_PP_CAT(Metadata::ParametersTypeOf_, LOCAL_NAME) BOOST_PP_CAT(LOCAL_NAME, Parameters_); 459 #define _DECLARE_VIEW_SOA_MEMBER(R, DATA, LAYOUT_MEMBER_NAME) \ 460 BOOST_PP_EXPAND(_DECLARE_VIEW_SOA_MEMBER_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 465 #define _DECLARE_CONST_VIEW_SOA_MEMBER_IMPL(LAYOUT_NAME, LAYOUT_MEMBER, LOCAL_NAME, DATA) \ 466 typename BOOST_PP_CAT(Metadata::ParametersTypeOf_, LOCAL_NAME)::ConstType BOOST_PP_CAT(LOCAL_NAME, Parameters_); 468 #define _DECLARE_CONST_VIEW_SOA_MEMBER(R, DATA, LAYOUT_MEMBER_NAME) \ 469 BOOST_PP_EXPAND(_DECLARE_CONST_VIEW_SOA_MEMBER_IMPL BOOST_PP_TUPLE_PUSH_BACK(LAYOUT_MEMBER_NAME, DATA)) 476 #define _TRIVIAL_VIEW_ASSIGN_VALUE_ELEMENT_IMPL(VALUE_TYPE, CPP_TYPE, NAME) \ 477 _SWITCH_ON_TYPE(VALUE_TYPE, \ 481 NAME() = _soa_impl_value.NAME; \ 484 NAME() = _soa_impl_value.NAME; \ 488 #define _TRIVIAL_VIEW_ASSIGN_VALUE_ELEMENT(R, DATA, TYPE_NAME) _TRIVIAL_VIEW_ASSIGN_VALUE_ELEMENT_IMPL TYPE_NAME 492 #define _GENERATE_SOA_VIEW_PART_0(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 493 template <CMS_SOA_BYTE_SIZE_TYPE VIEW_ALIGNMENT = cms::soa::CacheLineSize::defaultSize, \ 494 bool VIEW_ALIGNMENT_ENFORCEMENT = cms::soa::AlignmentEnforcement::relaxed, \ 495 bool RESTRICT_QUALIFY = cms::soa::RestrictQualify::enabled, \ 496 bool RANGE_CHECKING = cms::soa::RangeChecking::disabled> \ 497 struct VIEW : public CONST_VIEW<VIEW_ALIGNMENT, VIEW_ALIGNMENT_ENFORCEMENT, RESTRICT_QUALIFY, RANGE_CHECKING> { \ 501 using self_type = VIEW; \ 502 using base_type = CONST_VIEW<VIEW_ALIGNMENT, VIEW_ALIGNMENT_ENFORCEMENT, RESTRICT_QUALIFY, RANGE_CHECKING>; 506 #define _GENERATE_SOA_VIEW_PART_0_NO_DEFAULTS(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 507 template <CMS_SOA_BYTE_SIZE_TYPE VIEW_ALIGNMENT, \ 508 bool VIEW_ALIGNMENT_ENFORCEMENT, \ 509 bool RESTRICT_QUALIFY, \ 510 bool RANGE_CHECKING> \ 511 struct VIEW : public CONST_VIEW<VIEW_ALIGNMENT, VIEW_ALIGNMENT_ENFORCEMENT, RESTRICT_QUALIFY, RANGE_CHECKING> { \ 515 using self_type = VIEW; \ 516 using base_type = CONST_VIEW<VIEW_ALIGNMENT, VIEW_ALIGNMENT_ENFORCEMENT, RESTRICT_QUALIFY, RANGE_CHECKING>; 524 #define _GENERATE_SOA_VIEW_PART_1(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 525 using size_type = cms::soa::size_type; \ 526 using byte_size_type = cms::soa::byte_size_type; \ 527 using AlignmentEnforcement = cms::soa::AlignmentEnforcement; \ 533 constexpr static byte_size_type defaultAlignment = cms::soa::CacheLineSize::defaultSize; \ 534 constexpr static byte_size_type alignment = VIEW_ALIGNMENT; \ 535 constexpr static bool alignmentEnforcement = VIEW_ALIGNMENT_ENFORCEMENT; \ 536 constexpr static byte_size_type conditionalAlignment = \ 537 alignmentEnforcement == AlignmentEnforcement::enforced ? alignment : 0; \ 538 constexpr static bool restrictQualify = RESTRICT_QUALIFY; \ 539 constexpr static bool rangeChecking = RANGE_CHECKING; \ 541 template <cms::soa::SoAColumnType COLUMN_TYPE, class C> \ 542 using SoAValueWithConf = cms::soa::SoAValue<COLUMN_TYPE, C, conditionalAlignment, restrictQualify>; \ 544 template <cms::soa::SoAColumnType COLUMN_TYPE, class C> \ 545 using SoAConstValueWithConf = cms::soa::SoAConstValue<COLUMN_TYPE, C, conditionalAlignment, restrictQualify>; \ 547 template <CMS_SOA_BYTE_SIZE_TYPE, bool, bool, bool> \ 548 friend struct VIEW; \ 555 SOA_HOST_DEVICE SOA_INLINE size_type size() const { return parent_.elements_; } \ 557 _ITERATE_ON_ALL(_DECLARE_VIEW_LAYOUT_TYPE_ALIAS, ~, LAYOUTS_LIST) \ 560 _ITERATE_ON_ALL(_DECLARE_VIEW_MEMBER_TYPE_ALIAS, const_cast_SoAParametersImpl, VALUE_LIST) \ 561 _ITERATE_ON_ALL(_DECLARE_VIEW_MEMBER_POINTERS, ~, VALUE_LIST) \ 562 _ITERATE_ON_ALL(_DECLARE_VIEW_MEMBER_CONST_POINTERS, ~, VALUE_LIST) \ 565 Metadata& operator=(const Metadata&) = delete; \ 566 Metadata(const Metadata&) = delete; \ 569 SOA_HOST_DEVICE SOA_INLINE Metadata(const VIEW& _soa_impl_parent) : parent_(_soa_impl_parent) {} \ 570 const VIEW& parent_; \ 574 SOA_HOST_DEVICE SOA_INLINE const Metadata metadata() const { return Metadata(*this); } \ 575 SOA_HOST_DEVICE SOA_INLINE Metadata metadata() { return Metadata(*this); } \ 581 SOA_HOST_ONLY VIEW(_ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONSTRUCTION_PARAMETERS, BOOST_PP_EMPTY(), LAYOUTS_LIST)) \ 582 : base_type{_ITERATE_ON_ALL_COMMA(_DECLARE_LAYOUT_LIST, BOOST_PP_EMPTY(), LAYOUTS_LIST)} {} \ 585 SOA_HOST_ONLY VIEW(size_type _soa_impl_elements, \ 586 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONSTRUCTION_BYCOLUMN_PARAMETERS, \ 589 : base_type{_soa_impl_elements, \ 590 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_MEMBER_LIST, BOOST_PP_EMPTY(), VALUE_LIST) \ 594 VIEW(VIEW const&) = default; \ 595 VIEW& operator=(VIEW const&) = default; \ 598 template <CMS_SOA_BYTE_SIZE_TYPE OTHER_VIEW_ALIGNMENT, \ 599 bool OTHER_VIEW_ALIGNMENT_ENFORCEMENT, \ 600 bool OTHER_RESTRICT_QUALIFY, \ 601 bool OTHER_RANGE_CHECKING> \ 602 VIEW(VIEW<OTHER_VIEW_ALIGNMENT, OTHER_VIEW_ALIGNMENT_ENFORCEMENT, OTHER_RESTRICT_QUALIFY, \ 603 OTHER_RANGE_CHECKING> const& other): base_type{other.elements_, \ 604 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_OTHER_MEMBER_LIST, BOOST_PP_EMPTY(), VALUE_LIST) \ 607 template <CMS_SOA_BYTE_SIZE_TYPE OTHER_VIEW_ALIGNMENT, \ 608 bool OTHER_VIEW_ALIGNMENT_ENFORCEMENT, \ 609 bool OTHER_RESTRICT_QUALIFY, \ 610 bool OTHER_RANGE_CHECKING> \ 611 VIEW& operator=(VIEW<OTHER_VIEW_ALIGNMENT, OTHER_VIEW_ALIGNMENT_ENFORCEMENT, OTHER_RESTRICT_QUALIFY, \ 612 OTHER_RANGE_CHECKING> const& other) { static_cast<base_type>(*this) = static_cast<base_type>(other); } \ 615 VIEW(VIEW &&) = default; \ 616 VIEW& operator=(VIEW &&) = default; \ 622 using const_element = typename base_type::const_element; \ 624 using base_type::operator[]; \ 628 SOA_HOST_DEVICE SOA_INLINE \ 629 element(size_type _soa_impl_index, \ 630 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_ELEMENT_VALUE_ARG, BOOST_PP_EMPTY(), VALUE_LIST)) \ 631 : _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_ELEM_MEMBER_INIT, _soa_impl_index, VALUE_LIST) {} \ 632 SOA_HOST_DEVICE SOA_INLINE \ 633 element& operator=(const element& _soa_impl_other) { \ 634 _ITERATE_ON_ALL(_DECLARE_VIEW_ELEMENT_VALUE_COPY, ~, VALUE_LIST) \ 637 SOA_HOST_DEVICE SOA_INLINE \ 638 element& operator=(const const_element& _soa_impl_other) { \ 639 _ITERATE_ON_ALL(_DECLARE_VIEW_ELEMENT_VALUE_COPY, ~, VALUE_LIST) \ 645 #define _GENERATE_SOA_VIEW_PART_2(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 646 _ITERATE_ON_ALL(_DECLARE_VIEW_ELEMENT_VALUE_MEMBER, ~, VALUE_LIST) \ 649 SOA_HOST_DEVICE SOA_INLINE \ 650 element operator[](size_type _soa_impl_index) { \ 651 if constexpr (rangeChecking == cms::soa::RangeChecking::enabled) { \ 652 if (_soa_impl_index >= base_type::elements_ or _soa_impl_index < 0) \ 653 SOA_THROW_OUT_OF_RANGE("Out of range index in " #VIEW "::operator[]") \ 655 return element{_soa_impl_index, _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_ELEMENT_CONSTR_CALL, ~, VALUE_LIST)}; \ 661 _ITERATE_ON_ALL(_DECLARE_VIEW_SOA_ACCESSOR, ~, VALUE_LIST) \ 664 template <typename T> \ 665 SOA_HOST_ONLY friend void dump(); \ 671 #define _GENERATE_SOA_CONST_VIEW_PART_0(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 672 template <CMS_SOA_BYTE_SIZE_TYPE VIEW_ALIGNMENT = cms::soa::CacheLineSize::defaultSize, \ 673 bool VIEW_ALIGNMENT_ENFORCEMENT = cms::soa::AlignmentEnforcement::relaxed, \ 674 bool RESTRICT_QUALIFY = cms::soa::RestrictQualify::enabled, \ 675 bool RANGE_CHECKING = cms::soa::RangeChecking::disabled> \ 676 struct CONST_VIEW { \ 678 using self_type = CONST_VIEW; 682 #define _GENERATE_SOA_CONST_VIEW_PART_0_NO_DEFAULTS(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 683 template <CMS_SOA_BYTE_SIZE_TYPE VIEW_ALIGNMENT, \ 684 bool VIEW_ALIGNMENT_ENFORCEMENT, \ 685 bool RESTRICT_QUALIFY, \ 686 bool RANGE_CHECKING> \ 687 struct CONST_VIEW { \ 689 using self_type = CONST_VIEW; 697 #define _GENERATE_SOA_CONST_VIEW_PART_1(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 698 using size_type = cms::soa::size_type; \ 699 using byte_size_type = cms::soa::byte_size_type; \ 700 using AlignmentEnforcement = cms::soa::AlignmentEnforcement; \ 702 template <CMS_SOA_BYTE_SIZE_TYPE, bool, bool, bool> \ 703 friend struct VIEW; \ 705 template <CMS_SOA_BYTE_SIZE_TYPE, bool, bool, bool> \ 706 friend struct CONST_VIEW; \ 712 constexpr static byte_size_type defaultAlignment = cms::soa::CacheLineSize::defaultSize; \ 713 constexpr static byte_size_type alignment = VIEW_ALIGNMENT; \ 714 constexpr static bool alignmentEnforcement = VIEW_ALIGNMENT_ENFORCEMENT; \ 715 constexpr static byte_size_type conditionalAlignment = \ 716 alignmentEnforcement == AlignmentEnforcement::enforced ? alignment : 0; \ 717 constexpr static bool restrictQualify = RESTRICT_QUALIFY; \ 718 constexpr static bool rangeChecking = RANGE_CHECKING; \ 720 template <cms::soa::SoAColumnType COLUMN_TYPE, class C> \ 721 using SoAValueWithConf = cms::soa::SoAValue<COLUMN_TYPE, C, conditionalAlignment, restrictQualify>; \ 723 template <cms::soa::SoAColumnType COLUMN_TYPE, class C> \ 724 using SoAConstValueWithConf = cms::soa::SoAConstValue<COLUMN_TYPE, C, conditionalAlignment, restrictQualify>; \ 731 SOA_HOST_DEVICE SOA_INLINE size_type size() const { return parent_.elements_; } \ 733 _ITERATE_ON_ALL(_DECLARE_VIEW_LAYOUT_TYPE_ALIAS, ~, LAYOUTS_LIST) \ 736 _ITERATE_ON_ALL(_DECLARE_VIEW_MEMBER_TYPE_ALIAS, BOOST_PP_EMPTY(), VALUE_LIST) \ 737 _ITERATE_ON_ALL(_DECLARE_VIEW_MEMBER_CONST_POINTERS, ~, VALUE_LIST) \ 740 Metadata& operator=(const Metadata&) = delete; \ 741 Metadata(const Metadata&) = delete; \ 744 SOA_HOST_DEVICE SOA_INLINE Metadata(const CONST_VIEW& _soa_impl_parent) : parent_(_soa_impl_parent) {} \ 745 const CONST_VIEW& parent_; \ 749 SOA_HOST_DEVICE SOA_INLINE const Metadata metadata() const { return Metadata(*this); } \ 752 CONST_VIEW() = default; \ 755 SOA_HOST_ONLY CONST_VIEW(_ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONSTRUCTION_PARAMETERS, const, LAYOUTS_LIST)) \ 756 : elements_([&]() -> size_type { \ 759 _ITERATE_ON_ALL(_UPDATE_SIZE_OF_VIEW, BOOST_PP_EMPTY(), LAYOUTS_LIST) \ 762 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_MEMBER_INITIALIZERS, ~, VALUE_LIST) {} \ 765 SOA_HOST_ONLY CONST_VIEW(size_type _soa_impl_elements, \ 766 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONSTRUCTION_BYCOLUMN_PARAMETERS, const, VALUE_LIST)) \ 767 : elements_(_soa_impl_elements), \ 768 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_MEMBER_INITIALIZERS_BYCOLUMN, ~, VALUE_LIST) {} \ 771 CONST_VIEW(CONST_VIEW const&) = default; \ 772 CONST_VIEW& operator=(CONST_VIEW const&) = default; \ 775 template <CMS_SOA_BYTE_SIZE_TYPE OTHER_VIEW_ALIGNMENT, \ 776 bool OTHER_VIEW_ALIGNMENT_ENFORCEMENT, \ 777 bool OTHER_RESTRICT_QUALIFY, \ 778 bool OTHER_RANGE_CHECKING> \ 779 CONST_VIEW(CONST_VIEW<OTHER_VIEW_ALIGNMENT, OTHER_VIEW_ALIGNMENT_ENFORCEMENT, OTHER_RESTRICT_QUALIFY, \ 780 OTHER_RANGE_CHECKING> const& other): CONST_VIEW{other.elements_, \ 781 _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_OTHER_MEMBER_LIST, BOOST_PP_EMPTY(), VALUE_LIST) \ 784 template <CMS_SOA_BYTE_SIZE_TYPE OTHER_VIEW_ALIGNMENT, \ 785 bool OTHER_VIEW_ALIGNMENT_ENFORCEMENT, \ 786 bool OTHER_RESTRICT_QUALIFY, \ 787 bool OTHER_RANGE_CHECKING> \ 788 CONST_VIEW& operator=(CONST_VIEW<OTHER_VIEW_ALIGNMENT, OTHER_VIEW_ALIGNMENT_ENFORCEMENT, OTHER_RESTRICT_QUALIFY, \ 789 OTHER_RANGE_CHECKING> const& other) { *this = other; } \ 792 CONST_VIEW(CONST_VIEW &&) = default; \ 793 CONST_VIEW& operator=(CONST_VIEW &&) = default; \ 796 ~CONST_VIEW() = default; \ 799 struct const_element { \ 800 SOA_HOST_DEVICE SOA_INLINE \ 801 const_element(size_type _soa_impl_index, \ 802 _ITERATE_ON_ALL_COMMA(_DECLARE_CONST_VIEW_ELEMENT_VALUE_ARG, const, VALUE_LIST)) \ 803 : _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONST_ELEM_MEMBER_INIT, _soa_impl_index, VALUE_LIST) {} \ 804 _ITERATE_ON_ALL(_DECLARE_VIEW_CONST_ELEMENT_ACCESSOR, ~, VALUE_LIST) \ 807 _ITERATE_ON_ALL(_DECLARE_VIEW_CONST_ELEMENT_VALUE_MEMBER, ~, VALUE_LIST) \ 810 SOA_HOST_DEVICE SOA_INLINE \ 811 const_element operator[](size_type _soa_impl_index) const { \ 812 if constexpr (rangeChecking == cms::soa::RangeChecking::enabled) { \ 813 if (_soa_impl_index >= elements_ or _soa_impl_index < 0) \ 814 SOA_THROW_OUT_OF_RANGE("Out of range index in " #CONST_VIEW "::operator[]") \ 816 return const_element{ \ 817 _soa_impl_index, _ITERATE_ON_ALL_COMMA(_DECLARE_VIEW_CONST_ELEMENT_CONSTR_CALL, ~, VALUE_LIST) \ 822 _ITERATE_ON_ALL(_DECLARE_VIEW_SOA_CONST_ACCESSOR, ~, VALUE_LIST) \ 825 template <typename T> \ 826 SOA_HOST_ONLY friend void dump(); \ 829 size_type elements_ = 0; \ 830 _ITERATE_ON_ALL(_DECLARE_CONST_VIEW_SOA_MEMBER, const, VALUE_LIST) \ 836 #define _GENERATE_SOA_CONST_VIEW(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 837 _GENERATE_SOA_CONST_VIEW_PART_0(CONST_VIEW, VIEW, \ 838 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 839 _GENERATE_SOA_CONST_VIEW_PART_1(CONST_VIEW, VIEW, \ 840 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) 842 #define GENERATE_SOA_CONST_VIEW(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 843 _GENERATE_SOA_CONST_VIEW(CONST_VIEW, BOOST_PP_CAT(CONST_VIEW, Unused_), \ 844 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) 846 #define _GENERATE_SOA_TRIVIAL_CONST_VIEW(CLASS, LAYOUTS_LIST, VALUE_LIST) \ 847 _GENERATE_SOA_CONST_VIEW_PART_0_NO_DEFAULTS(ConstViewTemplateFreeParams, ViewTemplateFreeParams, \ 848 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 849 using BOOST_PP_CAT(CLASS, _parametrized) = CLASS<VIEW_ALIGNMENT, VIEW_ALIGNMENT_ENFORCEMENT>; \ 850 _GENERATE_SOA_CONST_VIEW_PART_1(ConstViewTemplateFreeParams, ViewTemplateFreeParams, \ 851 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) 853 #define _GENERATE_SOA_VIEW(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 854 _GENERATE_SOA_VIEW_PART_0(CONST_VIEW, VIEW, SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 855 _GENERATE_SOA_VIEW_PART_1(CONST_VIEW, VIEW, SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 856 _GENERATE_SOA_VIEW_PART_2(CONST_VIEW, VIEW, SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) 858 #define GENERATE_SOA_VIEW(CONST_VIEW, VIEW, LAYOUTS_LIST, VALUE_LIST) \ 859 _GENERATE_SOA_CONST_VIEW(CONST_VIEW, VIEW, SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 860 _GENERATE_SOA_VIEW(CONST_VIEW, VIEW, SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) 862 #define _GENERATE_SOA_TRIVIAL_VIEW(CLASS, LAYOUTS_LIST, VALUE_LIST, ...) \ 863 _GENERATE_SOA_VIEW_PART_0_NO_DEFAULTS(ConstViewTemplateFreeParams, ViewTemplateFreeParams, \ 864 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 865 using BOOST_PP_CAT(CLASS, _parametrized) = CLASS<VIEW_ALIGNMENT, VIEW_ALIGNMENT_ENFORCEMENT>; \ 866 _GENERATE_SOA_VIEW_PART_1(ConstViewTemplateFreeParams, ViewTemplateFreeParams, \ 867 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) \ 870 SOA_HOST_DEVICE SOA_INLINE constexpr element & operator=(const typename \ 871 BOOST_PP_CAT(CLASS, _parametrized)::Metadata::value_element _soa_impl_value) { \ 872 _ITERATE_ON_ALL(_TRIVIAL_VIEW_ASSIGN_VALUE_ELEMENT, ~, __VA_ARGS__) \ 876 _GENERATE_SOA_VIEW_PART_2(ConstViewTemplateFreeParams, ViewTemplateFreeParams, \ 877 SOA_VIEW_LAYOUT_LIST(LAYOUTS_LIST), SOA_VIEW_VALUE_LIST(VALUE_LIST)) 883 #define _VIEW_FIELD_FROM_LAYOUT_IMPL(VALUE_TYPE, CPP_TYPE, NAME, DATA) (DATA, NAME, NAME) 885 #define _VIEW_FIELD_FROM_LAYOUT(R, DATA, VALUE_TYPE_NAME) \ 886 BOOST_PP_EXPAND((_VIEW_FIELD_FROM_LAYOUT_IMPL BOOST_PP_TUPLE_PUSH_BACK(VALUE_TYPE_NAME, DATA))) 888 #endif // DataFormats_SoATemplate_interface_SoAView_h
double scalar(const CLHEP::HepGenMatrix &m)
Return the matrix as a scalar. Raise an assertion if the matris is not .