Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:12:13

0001 // @(#)root/cont
0002 // Author: Bianca-Cristina Cristescu February 2014
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_TListOfEnums
0013 #define ROOT_TListOfEnums
0014 
0015 //////////////////////////////////////////////////////////////////////////
0016 //                                                                      //
0017 // TListOfEnums                                                         //
0018 //                                                                      //
0019 // A collection of TEnum objects designed for fast access given a       //
0020 // DeclId_t and for keep track of TEnum that were described             //
0021 // unloaded enum.                                                       //
0022 //                                                                      //
0023 //////////////////////////////////////////////////////////////////////////
0024 
0025 #include "THashList.h"
0026 
0027 #include "TDictionary.h"
0028 
0029 class TExMap;
0030 class TEnum;
0031 
0032 class TListOfEnums : public THashList
0033 {
0034 private:
0035    friend class TCling;
0036    friend class TClass;
0037    friend class TProtoClass;
0038    friend class TROOT;
0039 
0040    TClass    *fClass; //! Context of this list.  Not owned.
0041 
0042    TExMap    *fIds;      //! Map from DeclId_t to TEnum*
0043    THashList *fUnloaded; //! Holder of TEnum for unloaded Enums.
0044    Bool_t     fIsLoaded; //! Mark whether Load was executed.
0045    ULong64_t  fLastLoadMarker; //! Represent interpreter state when we last did a full load.
0046 
0047    TListOfEnums(const TListOfEnums&) = delete;
0048    TListOfEnums& operator=(const TListOfEnums&) = delete;
0049 
0050    void MapObject(TObject *obj);
0051    void UnmapObject(TObject *obj);
0052 
0053    void Load();
0054    void Unload();
0055    void Unload(TEnum *e);
0056    void SetClass(TClass* cl) { fClass = cl; }
0057 
0058 public:
0059    typedef TDictionary::DeclId_t DeclId_t;
0060 
0061 protected:
0062    TClass *GetClass() const {return fClass;}
0063    TExMap *GetIds() { return fIds;}
0064    TEnum  *FindUnloaded(const char* name) { return (TEnum*)fUnloaded->FindObject(name);}
0065    TEnum  *Get(DeclId_t id, const char *name);
0066 
0067 public:
0068    TListOfEnums(TClass *cl = nullptr);
0069    ~TListOfEnums() override;
0070 
0071    TEnum     *Find(DeclId_t id) const;
0072    virtual TEnum *GetObject(const char*) const;
0073 
0074    TObject  *FindObject(const char*) const override;
0075    using THashList::FindObject;
0076 
0077    void Clear(Option_t *option) override;
0078    void Delete(Option_t *option="") override;
0079 
0080    Bool_t     IsLoaded() const { return fIsLoaded; }
0081    void       AddFirst(TObject *obj) override;
0082    void       AddFirst(TObject *obj, Option_t *opt) override;
0083    void       AddLast(TObject *obj) override;
0084    void       AddLast(TObject *obj, Option_t *opt) override;
0085    void       AddAt(TObject *obj, Int_t idx) override;
0086    void       AddAfter(const TObject *after, TObject *obj) override;
0087    void       AddAfter(TObjLink *after, TObject *obj) override;
0088    void       AddBefore(const TObject *before, TObject *obj) override;
0089    void       AddBefore(TObjLink *before, TObject *obj) override;
0090 
0091    void       RecursiveRemove(TObject *obj) override;
0092    TObject   *Remove(TObject *obj) override;
0093    TObject   *Remove(TObjLink *lnk) override;
0094 
0095    ClassDefOverride(TListOfEnums,2);  // List of TDataMembers for a class
0096 };
0097 
0098 #endif // ROOT_TListOfEnums