File indexing completed on 2025-01-18 10:10:32
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef ROOT_RACTIONBASE
0012 #define ROOT_RACTIONBASE
0013
0014 #include "ROOT/RDF/RColumnRegister.hxx"
0015 #include "ROOT/RDF/RSampleInfo.hxx"
0016 #include "ROOT/RDF/Utils.hxx" // ColumnNames_t
0017 #include "RtypesCore.h"
0018
0019 #include <memory>
0020 #include <string>
0021
0022 namespace ROOT {
0023
0024 namespace Detail {
0025 namespace RDF {
0026 class RLoopManager;
0027 class RDefineBase;
0028 class RMergeableValueBase;
0029 }
0030 }
0031
0032 namespace Internal {
0033 namespace RDF {
0034 namespace GraphDrawing {
0035 class GraphNode;
0036 }
0037
0038 using namespace ROOT::Detail::RDF;
0039
0040 class RActionBase {
0041 protected:
0042
0043
0044 RLoopManager *fLoopManager;
0045
0046 private:
0047 const unsigned int fNSlots;
0048 bool fHasRun = false;
0049 const ColumnNames_t fColumnNames;
0050
0051 std::vector<std::string> fVariations;
0052
0053 RColumnRegister fColRegister;
0054
0055 public:
0056 RActionBase(RLoopManager *lm, const ColumnNames_t &colNames, const RColumnRegister &colRegister,
0057 const std::vector<std::string> &prevVariations);
0058 RActionBase(const RActionBase &) = delete;
0059 RActionBase &operator=(const RActionBase &) = delete;
0060 virtual ~RActionBase();
0061
0062 const ColumnNames_t &GetColumnNames() const { return fColumnNames; }
0063 RColumnRegister &GetColRegister() { return fColRegister; }
0064 RLoopManager *GetLoopManager() { return fLoopManager; }
0065 unsigned int GetNSlots() const { return fNSlots; }
0066 virtual void Run(unsigned int slot, Long64_t entry) = 0;
0067 virtual void Initialize() = 0;
0068 virtual void InitSlot(TTreeReader *r, unsigned int slot) = 0;
0069 virtual void TriggerChildrenCount() = 0;
0070 virtual void FinalizeSlot(unsigned int) = 0;
0071 virtual void Finalize() = 0;
0072
0073
0074 virtual void *PartialUpdate(unsigned int slot) = 0;
0075
0076
0077 virtual bool HasRun() const { return fHasRun; }
0078 virtual void SetHasRun() { fHasRun = true; }
0079
0080 virtual std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>
0081 GetGraph(std::unordered_map<void *, std::shared_ptr<ROOT::Internal::RDF::GraphDrawing::GraphNode>> &visitedMap) = 0;
0082
0083
0084
0085
0086
0087 virtual std::unique_ptr<RMergeableValueBase> GetMergeableValue() const = 0;
0088
0089 virtual ROOT::RDF::SampleCallback_t GetSampleCallback() = 0;
0090
0091 const std::vector<std::string> &GetVariations() const { return fVariations; }
0092
0093 virtual std::unique_ptr<RActionBase> MakeVariedAction(std::vector<void *> &&results) = 0;
0094 virtual std::unique_ptr<RActionBase> CloneAction(void *newResult) = 0;
0095 };
0096 }
0097 }
0098 }
0099
0100 #endif