30using namespace std::string_literals;
44 std::unique_ptr<TIterator>
fIter;
53 if (!
fDir)
return false;
56 auto lst =
fDir->GetListOfKeys();
57 if (lst->GetSize() == 0) {
58 auto olst =
fDir->GetList();
59 if (olst->GetSize() > 0) {
61 fIter.reset(olst->MakeIterator());
66 fIter.reset(lst->MakeIterator());
73 if (!
fIter)
return false;
81 fIter.reset(
fDir->GetList()->MakeIterator());
91 if (!
fDir->GetListOfKeys()->FindObject(
fObj->GetName()))
117 bool found_newer =
false;
118 while ((key =
dynamic_cast<TKey*
>(iter())) !=
nullptr) {
125 if (!found_newer)
break;
140 const char *undef =
"<undefined>";
141 const char *
value =
gEnv->GetValue(
"WebGui.LastCycle", undef);
143 std::string svalue =
value;
144 if (svalue != undef) {
147 else if (svalue ==
"no")
184 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(
fObj,
kFALSE);
188 return elem ? elem->CreateItem() :
nullptr;
228 if (!
gROOT->GetListOfFiles()->FindObject(
fObj))
271 return fObj->GetName();
285 return fObj->GetTitle();
297 return dir ? std::make_unique<TDirectoryLevelIter>(dir) :
nullptr;
318 if (
f)
return f->GetSize();
325 if (
f)
return f->GetModificationDate().AsSQLString();
403 if (!dir)
return nullptr;
405 auto subdir = dir->GetDirectory(
fKeyName.c_str());
407 subdir = dir->GetDirectory(
GetName().c_str());
408 if (!subdir)
return nullptr;
409 return std::make_unique<TDirectoryLevelIter>(subdir);
433 if (!obj_class->HasDictionary()) {
443 void *obj = dir->GetObjectChecked(namecycle.c_str(), obj_class);
451 bool in_dir = dir->FindObject(tobj) !=
nullptr,
454 if (in_dir && !special_class)
457 return std::make_unique<TObjectHolder>(tobj, !special_class);
460 return std::make_unique<RAnyObjectHolder>(obj_class, obj,
true);
466 return fElement->GetDefaultAction();
522 default:
return false;
535 auto item = std::make_unique<TObjectItem>(
GetName(), is_folder ? -1 : 0);
555 return std::make_shared<TObjectElement>(
fObj);
557 if (
"ROOT::Experimental::RNTuple"s ==
fKey->GetClassName())
560 std::string key_class =
fKey->GetClassName();
561 if (read_dir && (key_class.find(
"TDirectory") == 0)) {
562 auto subdir =
fDir->GetDirectory(
fKey->GetName());
563 if (subdir)
return std::make_shared<TDirectoryElement>(
"", subdir);
566 return std::make_shared<TKeyElement>(
fDir,
fKey);
584 RegisterFile(
"root", [] (
const std::string &fullname) -> std::shared_ptr<RElement> {
585 auto f =
dynamic_cast<TFile *
> (
gROOT->GetListOfFiles()->FindObject(fullname.c_str()));
587 if (!
f)
return nullptr;
588 return std::make_shared<TDirectoryElement>(fullname,
f,
true);
592 return std::make_shared<TDirectoryElement>(
"",
const_cast<TFile*
>(
object->Get<
TFile>()),
true);
#define R__LOG_ERROR(...)
RTFileProvider newRTFileProvider
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
static EContentKind GetContentKind(const std::string &kind)
Find item with specified name Default implementation, should work for all.
@ kFileName
"filename" - file name if applicable
EActionKind
Possible actions on double-click.
@ kActImage
can be shown in image viewer, can provide image
@ kActDraw6
can be drawn inside ROOT6 canvas
@ kActCanvas
indicate that it is canvas and should be drawn directly
@ kActTree
can be shown in tree viewer
@ kActGeom
can be shown in geometry viewer
@ kActBrowse
just browse (expand) item
@ kActEdit
can provide data for text editor
@ kActDraw7
can be drawn inside ROOT7 canvas
Iterator over single level hierarchy like any array, keys list, ...
Provider of different browsing methods for supported classes.
static std::shared_ptr< RElement > BrowseNTuple(const std::string &tuplename, const std::string &filename)
Start browsing of RNTuple.
static bool CanDraw6(const ClassArg &)
Return true if provided class can be drawn on the TCanvas.
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 std::string GetClassIcon(const ClassArg &, bool=false)
Return icon name for the given class - either class name or TClass *.
void RegisterFile(const std::string &extension, FileFunc_t func)
void RegisterBrowse(const TClass *cl, BrowseFunc_t func)
static bool CanHaveChilds(const ClassArg &)
Return true if provided class can have childs.
TObjectElement(TObject *obj, const std::string &name="", bool _hide_childs=false)
Constructor with plain TObject* as argument - ownership is not defined.
void SetObject(TObject *obj)
Constructor with std::unique_ptr<RHolder> as argument.
virtual const TObject * CheckObject() const
Check if object still exists.
void ForgetObject() const
Forget object, use when it was deleted behind the scene.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
bool cd() override
Select directory as active.
bool fIsFile
! is TFile instance registered in global list of files
virtual ~TDirectoryElement()=default
EActionKind GetDefaultAction() const override
Get default action - browsing for the TFile/TDirectory.
Long64_t GetSize() const override
Size of TDirectory.
std::string GetContent(const std::string &kind) override
Returns element content, depends from kind.
TDirectory * GetDir() const
std::unique_ptr< RLevelIter > GetChildsIter() override
Provide iterator over TDirectory.
bool IsFolder() const override
Check if element can have childs.
TDirectoryElement(const std::string &fname, TDirectory *dir=nullptr, bool isfile=false)
std::string GetMTime() const override
std::string GetName() const override
Name of TDirectoryElement.
const TObject * CheckObject() const override
Check if object still exists.
std::string fFileName
! file name
std::string GetTitle() const override
Title of TDirectoryElement.
TDirectoryLevelIter(TDirectory *dir)
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
bool fKeysIter
! iterating over keys list (default)
std::string GetItemName() const override
Returns current entry name.
std::unique_ptr< RItem > CreateItem() override
Create item for the client.
TKey * fKey
! currently selected key
bool fOnlyLastCycle
! show only last cycle in list of keys
std::shared_ptr< RElement > GetDirElement(bool read_dir)
Return element for current TKey object in TDirectory.
std::string fCurrentName
! current key name
std::unique_ptr< TIterator > fIter
! created iterator
bool CanItemHaveChilds() const override
Returns true if current item can have childs.
TDirectory * fDir
! current directory handle
TObject * fObj
! currently selected object
virtual ~TDirectoryLevelIter()=default
bool Next() override
Shift to next entry.
Describe directory structure in memory.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
bool IsCapable(EActionKind action) const override
Check if want to perform action.
EActionKind GetDefaultAction() const override
Get default action - browsing for the TFile/TDirectory.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any Means we should try to browse inside.
std::string GetTitle() const override
Title of TKeyElement (optional)
std::shared_ptr< RElement > fElement
! holder of read object
virtual ~TKeyElement()=default
std::unique_ptr< RHolder > GetObject() override
Return object associated with the TKey.
std::unique_ptr< RItem > CreateItem() const override
Returns item with element description.
Long64_t GetSize() const override
Size of TDirectory.
bool IsFolder() const override
Check if element can have childs.
TKeyElement(TDirectory *dir, TKey *key)
std::string GetMTime() const override
std::string GetName() const override
Name of TKeyElement, includes key cycle.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
const char * GetTitle() const override
Returns title (title can contain 32x32 xpm thumbnail/icon).
virtual const char * GetClassName() const
const TDatime & GetDatime() const
Short_t GetCycle() const
Return cycle number associated to this key.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
@ kInvalidObject
if object ctor succeeded but object should not be used
ROOT::Experimental::RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.