19using namespace std::string_literals;
112 if (cl && (bmap.find(cl) != bmap.end()))
125 if (cl && (bmap.find(cl) != bmap.end()))
138 if (cl && (bmap.find(cl) != bmap.end()))
156 const std::string &browselib,
const std::string &draw6lib,
157 const std::string &draw7lib,
const std::string &drawopt)
161 if (!clname.empty() && (bmap.find(clname) != bmap.end()))
164 std::string blib = browselib;
165 bool can_have_childs = !browselib.empty();
166 if ((blib ==
"dflt") || (blib ==
"TObject")) blib =
"";
168 bmap.emplace(clname,
StructClass{
this, can_have_childs, iconname, blib, draw6lib, draw7lib, drawopt});
178 if (iter != bmap.end())
181 if (!cl.
name.empty()) {
182 for (
auto &elem : bmap)
183 if (cl.
name.compare(0, elem.first.length(), elem.first) == 0)
186 auto bases =
const_cast<TClass *
>(cl.
cl)->GetListOfBases();
187 const TClass *basecl = bases && (bases->GetSize() > 0) ?
dynamic_cast<TBaseClass *
>(bases->First())->GetClassPointer() :
nullptr;
206 return fmap.find(
extension) != fmap.end();
218 if (iter != fmap.end())
219 return iter->second.func(fullname);
227template<
class Map_t,
class Func_t>
236 auto iter = fmap.find(testcl);
237 if (iter != fmap.end())
238 if (!check_func || check_func(iter->second.func))
243 testcl = bases && (bases->GetSize() > 0) ?
dynamic_cast<TBaseClass *
>(bases->First())->GetClassPointer() :
nullptr;
246 for (
auto &entry : fmap) {
247 if (!entry.first)
continue;
248 std::string
name = entry.first->GetName();
254 if (check_func(entry.second.func))
260 if (test_all && check_func) {
261 for (
auto &entry : fmap)
262 if (!entry.first && check_func(entry.second.func))
275 std::shared_ptr<RElement> res;
277 if (!
object)
return res;
281 return (res || !
object) ? true :
false;
285 if (ScanProviderMap<BrowseMap_t,BrowseFunc_t>(
GetBrowseMap(),
object->GetClass(),
false, browse_func))
289 if (!entry.dummy() && !entry.browselib.empty())
293 ScanProviderMap<BrowseMap_t,BrowseFunc_t>(
GetBrowseMap(),
object->GetClass(),
true, browse_func);
306 if (entry.browselib.empty())
324 if (!
object || !
object->GetClass())
328 return func(subpad,
object, opt);
331 if (ScanProviderMap<Draw6Map_t,Draw6Func_t>(
GetDraw6Map(),
object->GetClass(),
false, draw_func))
335 if (!entry.dummy() && !entry.draw6lib.empty())
338 return ScanProviderMap<Draw6Map_t,Draw6Func_t>(
GetDraw6Map(),
object->GetClass(),
true, draw_func);
345bool RProvider::Draw7(std::shared_ptr<ROOT::Experimental::RPadBase> &subpad, std::unique_ptr<RHolder> &
object,
const std::string &opt)
347 if (!
object || !
object->GetClass())
351 return func(subpad,
object, opt);
354 if (ScanProviderMap<Draw7Map_t,Draw7Func_t>(
GetDraw7Map(),
object->GetClass(),
false, draw_func))
358 if (!entry.dummy() && !entry.draw7lib.empty())
361 return ScanProviderMap<Draw7Map_t,Draw7Func_t>(
GetDraw7Map(),
object->GetClass(),
true, draw_func);
370 if (!entry.iconname.empty())
371 return entry.iconname;
373 return is_folder ?
"sap-icon://folder-blank"s :
"sap-icon://electronic-medical-record"s;
412 return !entry.dummy() && !entry.can_have_childs;
420 if (ScanProviderMap<Draw6Map_t,Draw6Func_t>(
GetDraw6Map(), arg))
434 if (ScanProviderMap<Draw7Map_t,Draw7Func_t>(
GetDraw7Map(), arg))
458 auto iter = vect.begin();
459 while (iter != vect.end()) {
460 if (iter->handle == fHandle) {
482 if (elem.handle == handle)
483 elem.handle2 = handle2;
496 if ((elem.handle == handle) || (elem.handle2 == handle)) {
497 elem.func(progress, elem.handle);
512 RegisterClass(
"ROOT::Experimental::RH1D",
"sap-icon://bar-chart",
"",
"",
"libROOTHistDrawProvider");
513 RegisterClass(
"ROOT::Experimental::RH2D",
"sap-icon://pixelate",
"",
"",
"libROOTHistDrawProvider");
514 RegisterClass(
"ROOT::Experimental::RH3D",
"sap-icon://product",
"",
"",
"libROOTHistDrawProvider");
515 RegisterClass(
"ROOT::Experimental::RCanvas",
"sap-icon://business-objects-experience",
"",
"",
"libROOTHistDrawProvider");
516 RegisterClass(
"ROOT::RNTuple",
"sap-icon://table-chart",
"libROOTNTupleBrowseProvider",
517 "libROOTNTupleDraw6Provider",
"libROOTNTupleDraw7Provider");
#define R__LOG_ERROR(...)
RDefaultProvider newRDefaultProvider
bool ScanProviderMap(Map_t &fmap, const RProvider::ClassArg &cl, bool test_all=false, std::function< bool(Func_t &)> check_func=nullptr)
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 filename
R__EXTERN TSystem * gSystem
const std::string & GetName() const
const TClass * GetClass() const
void Extend(void *handle2)
Extend progress handle.
ProgressHandle(const ProgressHandle &)=delete
~ProgressHandle()
Destroy progress handle.
Provider of different browsing methods for supported classes.
void RegisterDraw7(const TClass *cl, Draw7Func_t func)
static bool ReportProgress(void *handle, float progress)
Report running progress Returns true if handling function was invoked Method can be used to detect if...
static ProgressVect_t & GetProgressVect()
static std::shared_ptr< RElement > BrowseNTuple(const std::string &tuplename, const std::string &filename)
Start browsing of RNTuple.
void RegisterClass(const std::string &clname, const std::string &iconname, const std::string &browselib="", const std::string &draw6lib="", const std::string &draw7lib="", const std::string &drawopt="")
static bool CanDraw6(const ClassArg &)
Return true if provided class can be drawn on the TCanvas.
static ClassMap_t & GetClassMap()
static bool SetClassDrawOption(const ClassArg &, const std::string &)
Set draw option for the class Return true if entry for the class exists.
static FileMap_t & GetFileMap()
void RegisterDraw6(const TClass *cl, Draw6Func_t func)
static std::shared_ptr< RElement > Browse(std::unique_ptr< RHolder > &obj)
Create browsable element for the object Created element may take ownership over the object.
static bool CanDraw7(const ClassArg &)
Return true if provided class can be drawn on the RCanvas.
static BrowseNTupleFunc_t gNTupleFunc
static bool Draw6(TVirtualPad *subpad, std::unique_ptr< RHolder > &obj, const std::string &opt="")
Invoke drawing of object on TCanvas sub-pad All existing providers are checked, first checked are cla...
std::multimap< const TClass *, StructDraw6 > Draw6Map_t
virtual ~RProvider()
Automatically unregister provider from all maps.
std::function< std::shared_ptr< RElement >(const std::string &)> FileFunc_t
static std::string GetClassIcon(const ClassArg &, bool=false)
Return icon name for the given class - either class name or TClass *.
static bool Draw7(std::shared_ptr< ROOT::Experimental::RPadBase > &subpad, std::unique_ptr< RHolder > &obj, const std::string &opt="")
Invoke drawing of object on RCanvas sub-pad All existing providers are checked, first checked are cla...
std::function< void(float progress, void *handle)> ProgressFunc_t
std::multimap< const TClass *, StructBrowse > BrowseMap_t
void RegisterFile(const std::string &extension, FileFunc_t func)
static bool IsFileFormatSupported(const std::string &extension)
static Draw7Map_t & GetDraw7Map()
std::function< bool(TVirtualPad *, std::unique_ptr< RHolder > &, const std::string &)> Draw6Func_t
void RegisterBrowse(const TClass *cl, BrowseFunc_t func)
std::function< std::shared_ptr< RElement >(std::unique_ptr< RHolder > &)> BrowseFunc_t
void RegisterNTupleFunc(BrowseNTupleFunc_t func)
static bool CanHaveChilds(const ClassArg &)
Return true if provided class can have childs.
static BrowseMap_t & GetBrowseMap()
static StructClass & GetClassEntry(const ClassArg &)
std::function< bool(std::shared_ptr< ROOT::Experimental::RPadBase > &, std::unique_ptr< RHolder > &, const std::string &)> Draw7Func_t
static std::shared_ptr< RElement > OpenFile(const std::string &extension, const std::string &fullname)
std::vector< StructProgress > ProgressVect_t
void CleanThis(Map_t &fmap)
std::multimap< std::string, StructFile > FileMap_t
static Draw6Map_t & GetDraw6Map()
std::function< std::shared_ptr< RElement >(const std::string &, const std::string &)> BrowseNTupleFunc_t
static bool NotShowChilds(const ClassArg &)
Check if showing of sub-elements was disabled.
static std::string GetClassDrawOption(const ClassArg &)
Return configured draw option for the class.
std::multimap< std::string, StructClass > ClassMap_t
static void ExtendProgressHandle(void *handle, void *handle2)
Extend progress handle - to be able react on sub item.
std::multimap< const TClass *, StructDraw7 > Draw7Map_t
Each class (see TClass) has a linked list of its base class(es).
TClass instances represent classes, structs and namespaces in the ROOT type system.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
const char * GetName() const override
Returns name of object.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
TVirtualPad is an abstract base class for the Pad and Canvas classes.
ROOT::Experimental::RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.