File indexing completed on 2025-02-22 10:53:06
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT_RDF_DETAIL_RACTIONIMPL
0010 #define ROOT_RDF_DETAIL_RACTIONIMPL
0011
0012 #include <ROOT/RDF/RSampleInfo.hxx> // SampleCallback_t
0013
0014 #include <memory> // std::unique_ptr
0015 #include <stdexcept> // std::logic_error
0016 #include <utility> // std::declval
0017
0018 namespace ROOT {
0019 namespace Detail {
0020 namespace RDF {
0021
0022 class RMergeableValueBase;
0023
0024
0025 template <typename Helper>
0026 class R__CLING_PTRCHECK(off) RActionImpl {
0027 public:
0028 virtual ~RActionImpl() = default;
0029
0030 template <typename T = Helper>
0031 auto CallFinalizeTask(unsigned int slot) -> decltype(std::declval<T>().FinalizeTask(slot))
0032 {
0033 static_cast<Helper *>(this)->FinalizeTask(slot);
0034 }
0035
0036 template <typename... Args>
0037 void CallFinalizeTask(unsigned int, Args...) {}
0038
0039 template <typename H = Helper>
0040 auto CallPartialUpdate(unsigned int slot) -> decltype(std::declval<H>().PartialUpdate(slot), (void *)(nullptr))
0041 {
0042 return &static_cast<Helper *>(this)->PartialUpdate(slot);
0043 }
0044
0045 template <typename... Args>
0046 [[noreturn]] void *CallPartialUpdate(...)
0047 {
0048 throw std::logic_error("This action does not support callbacks!");
0049 }
0050
0051 template <typename T = Helper>
0052 auto CallMakeNew(void *typeErasedResSharedPtr) -> decltype(std::declval<T>().MakeNew(typeErasedResSharedPtr))
0053 {
0054 return static_cast<Helper *>(this)->MakeNew(typeErasedResSharedPtr);
0055 }
0056
0057 template <typename... Args>
0058 [[noreturn]] Helper CallMakeNew(void *, Args...)
0059 {
0060 const auto &actionName = static_cast<Helper *>(this)->GetActionName();
0061 throw std::logic_error("The MakeNew method is not implemented for this action helper (" + actionName +
0062 "). Cannot Vary its result.");
0063 }
0064
0065
0066 virtual std::unique_ptr<RMergeableValueBase> GetMergeableValue() const
0067 {
0068 throw std::logic_error("`GetMergeableValue` is not implemented for this type of action.");
0069 }
0070
0071
0072
0073 virtual ROOT::RDF::SampleCallback_t GetSampleCallback() { return {}; }
0074 };
0075
0076 }
0077 }
0078 }
0079
0080 #endif
0081