Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TObjectElement.hxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
9#ifndef ROOT7_Browsable_TObjectElement
10#define ROOT7_Browsable_TObjectElement
11
13
14class TObject;
15class TCollection;
16
17namespace ROOT {
18namespace Browsable {
19
20
21/** \class TObjectElement
22\ingroup rbrowser
23\brief Access to TObject basic properties for RBrowsable
24\author Sergey Linev <S.Linev@gsi.de>
25\date 2021-01-11
26\warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
27*/
28
29
30class TObjectElement : public RElement {
31protected:
32 std::unique_ptr<RHolder> fObject;
33 TObject *fObj{nullptr};
34 std::string fName;
35 bool fHideChilds{false};
36
37 bool IsSame(TObject *obj) const { return obj == fObj; }
38
39 void SetObject(TObject *obj);
40
41 void ForgetObject() const;
42
43 virtual const TObject *CheckObject() const;
44
45 virtual std::string GetMTime() const { return ""; }
46
47 virtual Long64_t GetSize() const { return -1; }
48
49public:
50 TObjectElement(TObject *obj, const std::string &name = "", bool _hide_childs = false);
51
52 TObjectElement(std::unique_ptr<RHolder> &obj, const std::string &name = "", bool _hide_childs = false);
53
54 virtual ~TObjectElement() = default;
55
56 /** Name of TObject */
57 std::string GetName() const override;
58
59 void SetName(const std::string &name) { fName = name; }
60
61 /** Is flag to hide all potential object childs set */
62 bool IsHideChilds() const { return fHideChilds; }
63
64 /** Set flag to hide all potential object childs */
65 void SetHideChilds(bool on) { fHideChilds = on; }
66
67 bool IsFolder() const override;
68
69 /** Title of TObject */
70 std::string GetTitle() const override;
71
72 /** Create iterator for childs elements if any */
73 std::unique_ptr<RLevelIter> GetChildsIter() override;
74
75 /** Return copy of TObject holder - if possible */
76 std::unique_ptr<RHolder> GetObject() override;
77
78 bool IsObject(void *) override;
79
80 bool CheckValid() override;
81
82 const TClass *GetClass() const;
83
84 EActionKind GetDefaultAction() const override;
85
86 bool IsCapable(EActionKind) const override;
87
88 std::unique_ptr<RItem> CreateItem() const override;
89
90 static std::unique_ptr<RLevelIter> GetCollectionIter(const TCollection *);
91
92};
93
94} // namespace Browsable
95} // namespace ROOT
96
97
98#endif
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 on
char name[80]
Definition TGX11.cxx:110
Basic element of browsable hierarchy.
Definition RElement.hxx:34
EActionKind
Possible actions on double-click.
Definition RElement.hxx:50
Access to TObject basic properties for RBrowsable.
std::unique_ptr< RHolder > GetObject() override
Return copy of TObject holder - if possible.
virtual std::string GetMTime() const
const TClass * GetClass() const
Returns class for contained object.
bool CheckValid() override
Returns true if object is still valid.
bool IsCapable(EActionKind) const override
Check object capability.
virtual ~TObjectElement()=default
static std::unique_ptr< RLevelIter > GetCollectionIter(const TCollection *)
Creates iterator for TCollection object.
void SetHideChilds(bool on)
Set flag to hide all potential object childs.
void SetObject(TObject *obj)
Constructor with std::unique_ptr<RHolder> as argument.
std::unique_ptr< RHolder > fObject
std::string GetTitle() const override
Title of TObject.
virtual const TObject * CheckObject() const
Check if object still exists.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
bool IsObject(void *) override
Returns true if holding specified object.
EActionKind GetDefaultAction() const override
Provides default action which can be performed with the object.
std::string GetName() const override
Name of TObject.
bool IsFolder() const override
Returns true if object can have child elements.
bool IsHideChilds() const
Is flag to hide all potential object childs set.
bool IsSame(TObject *obj) const
void SetName(const std::string &name)
virtual Long64_t GetSize() const
void ForgetObject() const
Forget object, use when it was deleted behind the scene.
std::unique_ptr< RItem > CreateItem() const override
Create item.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Collection abstract base class.
Definition TCollection.h:65
Mother of all ROOT objects.
Definition TObject.h:41
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...