Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:31

0001 /*************************************************************************
0002  * Copyright (C) 1995-2021, Rene Brun and Fons Rademakers.               *
0003  * All rights reserved.                                                  *
0004  *                                                                       *
0005  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0006  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0007  *************************************************************************/
0008 
0009 #ifndef ROOT7_Browsable_TObjectElement
0010 #define ROOT7_Browsable_TObjectElement
0011 
0012 #include <ROOT/Browsable/RElement.hxx>
0013 
0014 class TObject;
0015 class TCollection;
0016 
0017 namespace ROOT {
0018 namespace Browsable {
0019 
0020 
0021 /** \class TObjectElement
0022 \ingroup rbrowser
0023 \brief Access to TObject basic properties for RBrowsable
0024 \author Sergey Linev <S.Linev@gsi.de>
0025 \date 2021-01-11
0026 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!
0027 */
0028 
0029 
0030 class TObjectElement : public RElement {
0031 protected:
0032    std::unique_ptr<RHolder> fObject;
0033    TObject *fObj{nullptr};
0034    std::string fName;
0035    bool fHideChilds{false};
0036 
0037    bool IsSame(TObject *obj) const { return obj == fObj; }
0038 
0039    void SetObject(TObject *obj);
0040 
0041    void ForgetObject() const;
0042 
0043    virtual const TObject *CheckObject() const;
0044 
0045    virtual std::string GetMTime() const { return ""; }
0046 
0047    virtual Long64_t GetSize() const { return -1; }
0048 
0049 public:
0050    TObjectElement(TObject *obj, const std::string &name = "", bool _hide_childs = false);
0051 
0052    TObjectElement(std::unique_ptr<RHolder> &obj, const std::string &name = "", bool _hide_childs = false);
0053 
0054    virtual ~TObjectElement() = default;
0055 
0056    /** Name of TObject */
0057    std::string GetName() const override;
0058 
0059    void SetName(const std::string &name) { fName = name; }
0060 
0061    /** Is flag to hide all potential object childs set */
0062    bool IsHideChilds() const { return fHideChilds; }
0063 
0064    /** Set flag to hide all potential object childs */
0065    void SetHideChilds(bool on) { fHideChilds = on; }
0066 
0067    bool IsFolder() const override;
0068 
0069    /** Title of TObject */
0070    std::string GetTitle() const override;
0071 
0072    /** Create iterator for childs elements if any */
0073    std::unique_ptr<RLevelIter> GetChildsIter() override;
0074 
0075    /** Return copy of TObject holder - if possible */
0076    std::unique_ptr<RHolder> GetObject() override;
0077 
0078    bool IsObject(void *) override;
0079 
0080    bool CheckValid() override;
0081 
0082    const TClass *GetClass() const;
0083 
0084    EActionKind GetDefaultAction() const override;
0085 
0086    bool IsCapable(EActionKind) const override;
0087 
0088    std::unique_ptr<RItem> CreateItem() const override;
0089 
0090    static std::unique_ptr<RLevelIter> GetCollectionIter(const TCollection *);
0091 
0092 };
0093 
0094 } // namespace Browsable
0095 } // namespace ROOT
0096 
0097 
0098 #endif