Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TListOfDataMembers.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/cont
0002 // Author: Philippe Canal Aug 2013
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2013, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TListOfDataMembers
0013 #define ROOT_TListOfDataMembers
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TListOfDataMembers                                                   //
0018 //                                                                      //
0019 // A collection of TDataMember objects designed for fast access given a //
0020 // DeclId_t and for keep track of TDataMember that were described       //
0021 // unloaded member.                                                     //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "THashList.h"
0026 
0027 #include "TDictionary.h"
0028 
0029 class TExMap;
0030 class TDataMember;
0031 
0032 class TListOfDataMembers : public THashList
0033 {
0034 private:
0035    TClass           *fClass = nullptr;    //! Context of this list.  Not owned.
0036 
0037    TExMap           *fIds = nullptr;      //! Map from DeclId_t to TDataMember*
0038    THashList        *fUnloaded = nullptr; //! Holder of TDataMember for unloaded DataMembers.
0039    ULong64_t         fLastLoadMarker = 0; //! Represent interpreter state when we last did a full load.
0040    std::atomic<bool> fIsLoaded{kFALSE};  //! Mark whether Load was executed.
0041 
0042    TDictionary::EMemberSelection fSelection = TDictionary::EMemberSelection::kNoUsingDecls; //! Whether the list should contain regular data members or only using decls or both.
0043 
0044    TListOfDataMembers(const TListOfDataMembers&) = delete;
0045    TListOfDataMembers& operator=(const TListOfDataMembers&) = delete;
0046 
0047    void       MapObject(TObject *obj);
0048    void       UnmapObject(TObject *obj);
0049 
0050 public:
0051    typedef TDictionary::DeclId_t DeclId_t;
0052 
0053    /// Constructor, possibly for all members of a class (or globals).
0054    /// Include (or not) the scope's using declarations of variables.
0055    TListOfDataMembers(TClass *cl, TDictionary::EMemberSelection selection):
0056       fClass(cl), fSelection(selection) {}
0057 
0058    /// Construct from a generic collection of data members objects
0059    template<class DataMemberList>
0060    TListOfDataMembers(DataMemberList & dmlist) :
0061       fIsLoaded(kTRUE)
0062    {
0063       for (auto * dataMember : dmlist)
0064          Add(dataMember);
0065    }
0066 
0067    ~TListOfDataMembers();
0068 
0069    void       Clear(Option_t *option = "") override;
0070    void       Delete(Option_t *option="") override;
0071 
0072    using THashList::FindObject;
0073    TObject   *FindObject(const char *name) const override;
0074 
0075    TDictionary *Find(DeclId_t id) const;
0076    TDictionary *Get(DeclId_t id);
0077    TDictionary *Get(DataMemberInfo_t *info, bool skipChecks=kFALSE);
0078 
0079    Bool_t     IsLoaded() const { return fIsLoaded; }
0080    void       AddFirst(TObject *obj) override;
0081    void       AddFirst(TObject *obj, Option_t *opt) override;
0082    void       AddLast(TObject *obj) override;
0083    void       AddLast(TObject *obj, Option_t *opt) override;
0084    void       AddAt(TObject *obj, Int_t idx) override;
0085    void       AddAfter(const TObject *after, TObject *obj) override;
0086    void       AddAfter(TObjLink *after, TObject *obj) override;
0087    void       AddBefore(const TObject *before, TObject *obj) override;
0088    void       AddBefore(TObjLink *before, TObject *obj) override;
0089 
0090    TClass    *GetClass() const { return fClass; }
0091    void       SetClass(TClass* cl) { fClass = cl; }
0092    void       Update(TDictionary *member);
0093 
0094    void       RecursiveRemove(TObject *obj) override;
0095    TObject   *Remove(TObject *obj) override;
0096    TObject   *Remove(TObjLink *lnk) override;
0097 
0098    void Load();
0099    void Unload();
0100    void Unload(TDictionary *member);
0101 
0102    ClassDefOverride(TListOfDataMembers,2);  // List of TDataMembers for a class
0103 };
0104 
0105 #endif // ROOT_TListOfDataMembers