Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RJittedDefine.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo CERN 09/2018
2
3/*************************************************************************
4 * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_RJITTEDDEFINE
12#define ROOT_RJITTEDDEFINE
13
16#include "ROOT/RDF/Utils.hxx" // TypeName2TypeID
17#include <string_view>
18#include "RtypesCore.h"
19
20#include <memory>
21#include <stdexcept>
22#include <string>
23#include <typeinfo>
24#include <vector>
25
26class TTreeReader;
27
28namespace ROOT {
29namespace Detail {
30namespace RDF {
31
32/// A wrapper around a concrete RDefine, which forwards all calls to it
33/// RJittedDefine is a placeholder that is put in the collection of custom columns in place of a RDefine
34/// that will be just-in-time compiled. Jitted code will assign the concrete RDefine to this RJittedDefine
35/// before the event-loop starts.
36class RJittedDefine : public RDefineBase {
37 std::unique_ptr<RDefineBase> fConcreteDefine = nullptr;
38 /// Type info obtained through TypeName2TypeID based on the column type name.
39 /// The expectation is that this always compares equal to fConcreteDefine->GetTypeId() (which however is only
40 /// available after jitting). It can be null if TypeName2TypeID failed to figure out this type.
41 const std::type_info *fTypeId = nullptr;
42
43public:
44 RJittedDefine(std::string_view name, std::string_view type, RLoopManager &lm,
45 const RDFInternal::RColumnRegister &colRegister, const ColumnNames_t &columns)
46 : RDefineBase(name, type, colRegister, lm, columns)
47 {
48 // try recovering the type_info of this type, no problem if we fail (as long as no one calls GetTypeId)
49 try {
51 } catch (const std::runtime_error &) {
52 }
53 }
55
56 void SetDefine(std::unique_ptr<RDefineBase> c) { fConcreteDefine = std::move(c); }
57
58 void InitSlot(TTreeReader *r, unsigned int slot) final;
59 void *GetValuePtr(unsigned int slot) final;
60 const std::type_info &GetTypeId() const final;
61 void Update(unsigned int slot, Long64_t entry) final;
62 void Update(unsigned int slot, const ROOT::RDF::RSampleInfo &id) final;
63 void FinalizeSlot(unsigned int slot) final;
64 void MakeVariations(const std::vector<std::string> &variations) final;
65 RDefineBase &GetVariedDefine(const std::string &variationName) final;
66};
67
68} // ns RDF
69} // ns Detail
70} // ns ROOT
71
72#endif // ROOT_RJITTEDDEFINE
#define c(i)
Definition RSha256.hxx:101
long long Long64_t
Definition RtypesCore.h:80
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
A wrapper around a concrete RDefine, which forwards all calls to it RJittedDefine is a placeholder th...
void InitSlot(TTreeReader *r, unsigned int slot) final
RJittedDefine(std::string_view name, std::string_view type, RLoopManager &lm, const RDFInternal::RColumnRegister &colRegister, const ColumnNames_t &columns)
RDefineBase & GetVariedDefine(const std::string &variationName) final
Return a clone of this Define that works with values in the variationName "universe".
const std::type_info * fTypeId
Type info obtained through TypeName2TypeID based on the column type name.
std::unique_ptr< RDefineBase > fConcreteDefine
void MakeVariations(const std::vector< std::string > &variations) final
Create clones of this Define that work with values in varied "universes".
void FinalizeSlot(unsigned int slot) final
Clean-up operations to be performed at the end of a task.
void SetDefine(std::unique_ptr< RDefineBase > c)
const std::type_info & GetTypeId() const final
void * GetValuePtr(unsigned int slot) final
Return the (type-erased) address of the Define'd value for the given processing slot.
The head node of a RDF computation graph.
A binder for user-defined columns, variations and aliases.
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
Definition TTreeReader.h:44
const std::type_info & TypeName2TypeID(const std::string &name)
Return the type_info associated to a name.
Definition RDFUtils.cxx:51
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.