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  virtual void AddFirst(TObject* obj)
111  {
114 
116  };
117  virtual void AddLast(TObject* obj)
118  {
121 
122  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddLast(obj);
123  };
124  virtual void AddAt(TObject* obj, Int_t idx)
125  {
128 
129  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddAt(obj, idx);
130  };
131  virtual void AddAfter(const TObject* after, TObject* obj)
132  {
135 
136  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddAfter(after, obj);
137  };
138  virtual void AddBefore(const TObject* before, TObject* obj)
139  {
142 
143  if ((fLastCheck = checkObjInList(obj))) KVHashList::AddBefore(before, obj);
144  };
145  virtual void Add(TObject* obj)
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  ClassDef(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 ClassDef(name, id)
Extended version of ROOT THashList.
Definition: KVHashList.h:29
virtual void AddLast(TObject *obj)
virtual void AddBefore(const TObject *before, TObject *obj)
virtual void AddAfter(const TObject *after, TObject *obj)
virtual void Add(TObject *obj)
virtual void AddAt(TObject *obj, Int_t idx)
virtual void AddFirst(TObject *obj)
Optimised list in which named objects can only be placed once.
Bool_t ObjectAdded() const
virtual void Add(TObject *obj)
Bool_t checkObjInList(TObject *obj)
Bool_t fLastCheck
return value of last call to checkobj
void ReplaceObjects(Bool_t yes=kTRUE)
virtual void AddAfter(const TObject *after, TObject *obj)
virtual void AddFirst(TObject *obj)
KVUniqueNameList(Bool_t R=kFALSE)
Default constructor.
virtual ~KVUniqueNameList()
Destructor.
virtual void AddLast(TObject *obj)
virtual void AddBefore(const TObject *before, TObject *obj)
virtual void AddAt(TObject *obj, Int_t idx)
Bool_t fReplace
if kTRUE, objects with same name are replaced