KaliVeda
Toolkit for HIC analysis
KVUniqueNameList.h
1 
4 #ifndef __KVUNIQUENAMELIST_H
5 #define __KVUNIQUENAMELIST_H
6 
7 #include "KVHashList.h"
8 
101 class KVUniqueNameList : public KVHashList {
104 
106 
107 public:
108  KVUniqueNameList(Bool_t R = kFALSE);
109  virtual ~KVUniqueNameList();
110  void AddFirst(TObject* obj) override
111  {
114 
116  };
117  void AddLast(TObject* obj) override
118  {
121 
122  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddLast(obj);
123  };
124  void AddAt(TObject* obj, Int_t idx) override
125  {
128 
129  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddAt(obj, idx);
130  };
131  void AddAfter(const TObject* after, TObject* obj) override
132  {
135 
136  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddAfter(after, obj);
137  };
138  void AddBefore(const TObject* before, TObject* obj) override
139  {
142 
143  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddBefore(before, obj);
144  };
145  void Add(TObject* obj) override
146  {
149 
150  if ((fLastCheck = checkObjInList(obj))) KVHashList::Add(obj);
151  };
152 
154  {
157 
158  Bool_t save = fLastCheck;
159  fLastCheck = kFALSE;
160  return save;
161  }
162  void ReplaceObjects(Bool_t yes = kTRUE)
163  {
164  fReplace = yes;
165  }
166 
167  ClassDefOverride(KVUniqueNameList, 2) //Optimised list in which objects with the same name can only be placed once
168 };
169 
170 #endif
int Int_t
bool Bool_t
constexpr Bool_t kFALSE
#define ClassDefOverride(name, id)
Extended version of ROOT THashList.
Definition: KVHashList.h:29
void Add(TObject *obj) override
void AddAfter(const TObject *after, TObject *obj) override
void AddLast(TObject *obj) override
void AddBefore(const TObject *before, TObject *obj) override
void AddAt(TObject *obj, Int_t idx) override
void AddFirst(TObject *obj) override
Optimised list in which named objects can only be placed once.
Bool_t ObjectAdded() const
void AddAt(TObject *obj, Int_t idx) override
void AddAfter(const TObject *after, TObject *obj) override
Bool_t checkObjInList(TObject *obj)
void AddFirst(TObject *obj) override
Bool_t fLastCheck
return value of last call to checkobj
void ReplaceObjects(Bool_t yes=kTRUE)
void AddLast(TObject *obj) override
void Add(TObject *obj) override
void AddBefore(const TObject *before, TObject *obj) override
KVUniqueNameList(Bool_t R=kFALSE)
Default constructor.
virtual ~KVUniqueNameList()
Destructor.
Bool_t fReplace
if kTRUE, objects with same name are replaced