KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVUniqueNameList.cpp
1//Created by KVClassFactory on Thu Dec 3 15:49:33 2009
2//Author: John Frankland,,,
3
4#include "KVUniqueNameList.h"
5
7
8
9
10
11
13
15 : fReplace(R)
16{
17 // Default constructor
18}
19
20
21
24
26{
27 // Destructor
28}
29
30
31
39
41{
42 // Return kTRUE if 'obj' can be added to list.
43 // If fReplace==kFALSE, there must be no object in the list with
44 // same name as obj->GetName().
45 // If fReplace==kTRUE the previous object is removed from the list.
46 // If IsOwner()==kTRUE the previous object is removed AND deleted.
47 // In the latter two cases the new object can always be added (returns kTRUE)
48
49 TObject* old_obj = FindObject(obj->GetName());
50 if (!old_obj) return kTRUE;
51 else {
52 if (fReplace) {
53 Remove(old_obj);
54 if (IsOwner()) delete old_obj;
55 return kTRUE;
56 }
57 }
58 return kFALSE;
59}
60
61
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
virtual TObject * FindObject(const char *name) const
virtual TObject * Remove(TObject *obj)
Remove object from list.
Optimised list in which named objects can only be placed once.
Bool_t checkObjInList(TObject *obj)
virtual ~KVUniqueNameList()
Destructor.
Bool_t fReplace
if kTRUE, objects with same name are replaced
Bool_t IsOwner() const
virtual const char * GetName() const
ClassImp(TPyArg)