Warning, file /include/root/RooLinkedList.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROO_LINKED_LIST
0017 #define ROO_LINKED_LIST
0018
0019 #include "TObject.h"
0020 #include "RooLinkedListElem.h"
0021 #include "TString.h"
0022
0023 #include <vector>
0024 #include <memory>
0025 #include <unordered_map>
0026
0027 class RooLinkedListIter ;
0028 class RooLinkedListIterImpl ;
0029 class RooFIter;
0030 class TIterator ;
0031 class RooAbsArg ;
0032 template<class T>
0033 class RooSTLRefCountList;
0034
0035
0036
0037 namespace RooLinkedListImplDetails {
0038 class Chunk;
0039 class Pool;
0040 }
0041
0042
0043
0044 class RooLinkedList : public TObject {
0045 public:
0046
0047 RooLinkedList(Int_t htsize=0) ;
0048
0049
0050 RooLinkedList(const RooLinkedList& other) ;
0051
0052 TObject* Clone(const char* =nullptr) const override {
0053 return new RooLinkedList(*this) ;
0054 }
0055
0056
0057 RooLinkedList& operator=(const RooLinkedList& other) ;
0058
0059 Int_t getHashTableSize() const {
0060
0061 return _htableName ? _htableName->size() : 0 ;
0062 }
0063
0064 void setHashTableSize(Int_t size) ;
0065
0066
0067 ~RooLinkedList() override ;
0068
0069 Int_t GetSize() const { return _size ; }
0070 std::size_t size() const { return _size ; }
0071 bool empty() const { return _size == 0 ; }
0072
0073 virtual void Add(TObject* arg) { Add(arg,1) ; }
0074 virtual bool Remove(TObject* arg) ;
0075 TObject* At(int index) const ;
0076 bool Replace(const TObject* oldArg, const TObject* newArg) ;
0077 TIterator* MakeIterator(bool forward = true) const ;
0078 RooLinkedListIter iterator(bool forward = true) const ;
0079 RooFIter fwdIterator() const ;
0080 RooLinkedListIterImpl begin() const;
0081 RooLinkedListIterImpl end() const;
0082 RooLinkedListIterImpl rbegin() const;
0083 RooLinkedListIterImpl rend() const;
0084
0085 void Clear(Option_t *o=nullptr) override ;
0086 void Delete(Option_t *o=nullptr) override ;
0087 TObject* find(const char* name) const ;
0088 RooAbsArg* findArg(const RooAbsArg*) const ;
0089 TObject* FindObject(const char* name) const override ;
0090 TObject* FindObject(const TObject* obj) const override ;
0091 Int_t IndexOf(const char* name) const ;
0092 Int_t IndexOf(const TObject* arg) const ;
0093 TObject* First() const {
0094 return _first ? _first->_arg : nullptr ;
0095 }
0096
0097 void RecursiveRemove(TObject *obj) override;
0098
0099 void Print(const char* opt) const override ;
0100 void Sort(bool ascend=true) ;
0101
0102
0103
0104 const char* GetName() const override { return _name.Data() ; }
0105 void SetName(const char* name) { _name = name ; }
0106
0107 void useNptr(bool flag) { _useNptr = flag ; }
0108
0109
0110 ULong_t Hash() const override { return _name.Hash(); }
0111
0112 protected:
0113
0114 RooLinkedListElem* createElement(TObject* obj, RooLinkedListElem* elem=nullptr) ;
0115 void deleteElement(RooLinkedListElem*) ;
0116
0117 template<class T> friend class RooSTLRefCountList;
0118 friend class RooLinkedListIterImpl ;
0119 friend class RooFIterForLinkedList ;
0120
0121 virtual void Add(TObject* arg, Int_t refCount) ;
0122
0123 RooLinkedListElem* findLink(const TObject* arg) const ;
0124
0125 Int_t _hashThresh ;
0126 Int_t _size ;
0127 RooLinkedListElem* _first ;
0128 RooLinkedListElem* _last ;
0129
0130 using HashTableByName = std::unordered_map<std::string,TObject const*>;
0131 using HashTableByLink = std::unordered_map<TObject const*,TObject const*>;
0132 std::unique_ptr<HashTableByName> _htableName;
0133 std::unique_ptr<HashTableByLink> _htableLink;
0134
0135 TString _name ;
0136 bool _useNptr ;
0137
0138 private:
0139 template <bool ascending>
0140 static RooLinkedListElem* mergesort_impl(RooLinkedListElem* l1,
0141 const unsigned sz, RooLinkedListElem** tail = nullptr);
0142
0143 typedef RooLinkedListImplDetails::Pool Pool;
0144
0145 static Pool* _pool;
0146
0147 std::vector<RooLinkedListElem *> _at;
0148
0149 ClassDefOverride(RooLinkedList,3)
0150 };
0151
0152 #endif