KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVSeqCollection Class Reference

Detailed Description

KaliVeda extensions to ROOT collection classes.

Created by KVClassFactory on Fri Jun 19 18:51:28 2009 Author: John Frankland,,,

This class adds functionalities such as

etc. to the standard ROOT collection classes. The actual collection is embedded and referenced through a TSeqCollection base pointer. The class of the embedded object for any given instance is passed as an argument to the constructor:

KVSeqCollection my_coll("THashList");
KaliVeda extensions to ROOT collection classes.

Any collection class derived from TSeqCollection is valid: this means all ordered collections, for which the order in which objects are added is preserved. Some of these lists can also be sorted (see below).

Any object derived from TObject can be stored in the collection, but only objects derived from KVBase can be sought using their 'type', 'label', or 'number' attributes (these characteristics are not defined for TObject).

Note that we can test the 'KVBase'-ness of any object through a TObject* base pointer using the 'KaliVeda' bit, KVBase::kIsKaliVedaObject:

TObject *obj = [address of some object];
}
@ kIsKaliVedaObject
Definition KVBase.h:163
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const

Signals & slots: monitoring list modification

If SendModifiedSignals() is called, then every time an object is added to or removed from the list, it will emit the signal Modified(). This can be used to monitor any changes to the state of the list.

FindObjectBy...

In addition to the standard TList::FindObject(const Char_t*) and TList::FindObject(TObject*) methods, KVSeqCollection adds methods to find objects based on several different properties, such as type, label, number, or class. Note that type, label and number are only defined for objects derived from KVBase; if the list contains a mixture of TObject- and KVBase-derived objects, the TObject-derived objects will be ignored if type, label or number are used to search.

Finally, the very general FindObjectWithMethod() method can search for an object using any valid method.

Sublists

The GetSubListWith... methods allow to generate new lists containing a subset of the objects in the main list, according to their name, label, type, etc. These sublists do not own their objects (they are supposed to be owned by the main list), and must be deleted by the user in order to avoid memory leaks.

Execute

The Execute methods can be used to execute a given method with the same arguments for every object in the list.

Sorting lists

No Sort() method is defined in base class TSeqCollection, although the TCollection::IsSortable() method returns kTRUE by default (and is not overridden in child classes which do not implement sorting). Therefore whether or not a KVSeqCollection can be sorted depends on the collection class which is being used. We do not define a KVSeqCollection::Sort() method. If you want to sort a KVSeqCollection and you know that the embedded collection class has a valid Sort() method, you can do as follows:

KVSeqCollection seqlist("TList");
seqlist.Add(...);
...
((TList*)seqlist.GetCollection())->Sort();
void Sort(Index n, const Element *a, Index *index, Bool_t down=kTRUE)

or perhaps more cautiously you should do:

TList* tlist = dynamic_cast<TList*>(seqlist.GetCollection());
if(tlist) tlist->Sort();
virtual void Sort(Bool_t order=kSortAscending)

Definition at line 92 of file KVSeqCollection.h.

#include <KVSeqCollection.h>

Inheritance diagram for KVSeqCollection:

Public Member Functions

 KVSeqCollection ()
 Default constructor.
 
 KVSeqCollection (const Char_t *collection_classname)
 
 KVSeqCollection (const KVSeqCollection &)
 
virtual ~KVSeqCollection ()
 
virtual void Add (TObject *obj)
 
virtual void AddAfter (const TObject *after, TObject *obj)
 
virtual void AddAt (TObject *obj, Int_t idx)
 
virtual void AddBefore (const TObject *before, TObject *obj)
 
virtual void AddFirst (TObject *obj)
 
virtual void AddLast (TObject *obj)
 
virtual TObjectAfter (const TObject *obj) const
 
virtual TObjectAt (Int_t idx) const
 
virtual TObjectBefore (const TObject *obj) const
 
virtual void Clear (Option_t *option="")
 
const Char_tCollectionClassName () const
 
virtual void Copy (TObject &obj) const
 
virtual void Delete (Option_t *option="")
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 
virtual TObjectFindObject (const char *name) const
 
virtual TObjectFindObject (const TObject *obj) const
 
virtual TObjectFindObjectAny (const Char_t *att, const Char_t *keys, Bool_t contains_all=kFALSE, Bool_t case_sensitive=kTRUE) const
 
TObjectFindObjectByClass (const Char_t *) const
 Return (first) object in embedded list with given class.
 
TObjectFindObjectByClass (const TClass *) const
 Return (first) object in embedded list with given class.
 
virtual TObjectFindObjectByLabel (const Char_t *) const
 
virtual TObjectFindObjectByName (const Char_t *name) const
 
virtual TObjectFindObjectByNumber (UInt_t num) const
 
virtual TObjectFindObjectByTitle (const Char_t *) const
 Will return object with given title (value of TObject::GetTitle() method).
 
virtual TObjectFindObjectByType (const Char_t *) const
 
virtual TObjectFindObjectWithMethod (const Char_t *retvalue, const Char_t *method) const
 
virtual TObjectFindObjectWithNameAndType (const Char_t *name, const Char_t *type) const
 
virtual TObjectFirst () const
 
template<typename T >
Tget_object (const TString &name) const
 
TSeqCollectionGetCollection () const
 
virtual TObject ** GetObjectRef (const TObject *obj) const
 Return reference to object.
 
virtual Int_t GetSize () const
 
KVSeqCollectionGetSubListWithClass (const Char_t *class_name) const
 
KVSeqCollectionGetSubListWithClass (const TClass *_class) const
 
KVSeqCollectionGetSubListWithLabel (const Char_t *retvalue) const
 
KVSeqCollectionGetSubListWithMethod (const Char_t *retvalue, const Char_t *method) const
 
KVSeqCollectionGetSubListWithName (const Char_t *retvalue) const
 
KVSeqCollectionGetSubListWithType (const Char_t *retvalue) const
 
virtual Bool_t IsCleanup () const
 
virtual Bool_t IsSendingModifiedSignals () const
 
virtual Bool_t IsSortable () const
 
virtual Bool_t IsSorted () const
 
virtual TObjectLast () const
 
virtual TIteratorMakeIterator (Bool_t dir=kIterForward) const
 Make and return iterator for the list.
 
virtual void Modified ()
 
KVSeqCollectionoperator= (const KVSeqCollection &)
 
virtual void RecursiveRemove (TObject *obj)
 
virtual TObjectRemove (TObject *obj)
 Remove object from list.
 
virtual void SendModifiedSignals (Bool_t yes=kTRUE)
 
virtual void SetCleanup (Bool_t enable=kTRUE)
 
virtual void SetOwner (Bool_t enable=kTRUE)
 
- Public Member Functions inherited from TSeqCollection
virtual ~TSeqCollection ()
 
void Add (TObject *obj) override
 
virtual Int_t GetLast () const
 
virtual Int_t IndexOf (const TObject *obj) const
 
TClassIsA () const override
 
Int_t LastIndex () const
 
Long64_t Merge (TCollection *list)
 
virtual void RemoveAfter (TObject *after)
 
virtual TObjectRemoveAt (Int_t idx)
 
virtual void RemoveBefore (TObject *before)
 
virtual void RemoveFirst ()
 
virtual void RemoveLast ()
 
void Streamer (TBuffer &) override
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
void UnSort ()
 
- Public Member Functions inherited from TCollection
virtual ~TCollection ()
 
virtual void AddAll (const TCollection *col)
 
void AddVector (TObject *obj1,...)
 
Bool_t AssertClass (TClass *cl) const
 
TIter begin () const
 
void Browse (TBrowser *b) override
 
Int_t Capacity () const
 
TObjectClone (const char *newname="") const override
 
Int_t Compare (const TObject *obj) const override
 
Bool_t Contains (const char *name) const
 
Bool_t Contains (const TObject *obj) const
 
void Draw (Option_t *option="") override
 
void Dump () const override
 
TIter end () const
 
TObjectFindObject (const char *name) const override
 
TObjectFindObject (const TObject *obj) const override
 
virtual Int_t GetEntries () const
 
const char * GetName () const override
 
virtual Int_t GrowBy (Int_t delta) const
 
ULong_t Hash () const override
 
Bool_t IsArgNull (const char *where, const TObject *obj) const
 
virtual Bool_t IsEmpty () const
 
Bool_t IsFolder () const override
 
Bool_t IsOwner () const
 
Bool_t IsSortable () const override
 
R__ALWAYS_INLINE Bool_t IsUsingRWLock () const
 
void ls (Option_t *option="") const override
 
virtual TIteratorMakeReverseIterator () const
 
Bool_t Notify () override
 
TObjectoperator() (const char *name) const
 
void Paint (Option_t *option="") override
 
virtual void Print (Option_t *option, const char *wildcard, Int_t recurse=1) const
 
virtual void Print (Option_t *option, Int_t recurse) const
 
virtual void Print (Option_t *option, TPRegexp &regexp, Int_t recurse=1) const
 
void Print (Option_t *option="") const override
 
void RecursiveRemove (TObject *obj) override
 
void RemoveAll ()
 
virtual void RemoveAll (TCollection *col)
 
void SetCurrentCollection ()
 
void SetName (const char *name)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual bool UseRWLock (Bool_t enable=true)
 
Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
 
Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) override
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 
virtual ~TObject ()
 
void AbstractMethod (const char *method) const
 
virtual void AppendPad (Option_t *option="")
 
ULong_t CheckedHash ()
 
virtual const char * ClassName () const
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void DrawClass () const
 
virtual TObjectDrawClone (Option_t *option="") const
 
virtual void Error (const char *method, const char *msgfmt,...) const
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 
virtual Option_tGetDrawOption () const
 
virtual const char * GetIconName () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Option_tGetOption () const
 
virtual const char * GetTitle () const
 
virtual UInt_t GetUniqueID () const
 
virtual Bool_t HandleTimer (TTimer *timer)
 
Bool_t HasInconsistentHash () const
 
virtual void Info (const char *method, const char *msgfmt,...) const
 
virtual Bool_t InheritsFrom (const char *classname) const
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 
virtual void Inspect () const
 
void InvertBit (UInt_t f)
 
Bool_t IsDestructed () const
 
virtual Bool_t IsEqual (const TObject *obj) const
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *vp)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, void *vp)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 
virtual void Pop ()
 
virtual Int_t Read (const char *name)
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 
virtual void SetDrawOption (Option_t *option="")
 
virtual void SetUniqueID (UInt_t uid)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 

Static Public Member Functions

static KVSeqCollectionMakeListFromFile (TFile *file)
 
static KVSeqCollectionMakeListFromFileWithClass (TFile *file, const Char_t *class_name)
 
static KVSeqCollectionMakeListFromFileWithClass (TFile *file, const TClass *_class)
 
static KVSeqCollectionMakeListFromFileWithMethod (TFile *file, const Char_t *retvalue, const Char_t *method)
 
static void RehashCleanupList ()
 
- Static Public Member Functions inherited from TSeqCollection
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Int_t ObjCompare (TObject *a, TObject *b)
 
static void QSort (TObject **a, Int_t first, Int_t last)
 
static void QSort (TObject **a, Int_t nBs, TObject ***b, Int_t first, Int_t last)
 
static void QSort (TObject **a, TObject **b, Int_t first, Int_t last)
 
- Static Public Member Functions inherited from TCollection
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static void EmptyGarbageCollection ()
 
static void GarbageCollect (TObject *obj)
 
static TCollectionGetCurrentCollection ()
 
static void StartGarbageCollection ()
 
- Static Public Member Functions inherited from TObject
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Longptr_t GetDtorOnly ()
 
static Bool_t GetObjectStat ()
 
static void SetDtorOnly (void *obj)
 
static void SetObjectStat (Bool_t stat)
 

Private Types

enum  { kSignals = BIT(15) , kCleanup = BIT(17) }
 

Private Member Functions

void _GetSubListWithClass (KVSeqCollection *, TCollection *, const TClass *) const
 
virtual void _GetSubListWithMethod (KVSeqCollection *, TCollection *, const Char_t *, const Char_t *) const
 
virtual void Changed ()
 
void init ()
 
virtual KVSeqCollectionNewCollectionLikeThisOne () const
 
virtual void PrintCollectionHeader (Option_t *option) const
 Overrides TCollection::PrintCollectionHeader to show the class name of the embedded list.
 
virtual void SetCollection (const Char_t *)
 

Private Attributes

TSeqCollectionfCollection
 Pointer to embedded ROOT collection.
 

Static Private Attributes

static TSeqCollectionfgCleanups = NULL
 regroup all lists which are to be cleaned up
 
static Int_t fgCounter = 0
 counts instances
 
static Long64_t fSCCounter = 0
 counter used to give unique names to all lists
 

Additional Inherited Members

- Public Types inherited from TObject
enum  EDeprecatedStatusBits
 
enum  EStatusBits
 
- Public Attributes inherited from TCollection
 kInitCapacity
 
 kInitHashTableCapacity
 
- Public Attributes inherited from TObject
 kBitMask
 
 kCanDelete
 
 kCannotPick
 
 kHasUUID
 
 kInconsistent
 
 kInvalidObject
 
 kIsOnHeap
 
 kIsReferenced
 
 kMustCleanup
 
 kNoContextMenu
 
 kNotDeleted
 
 kObjInCanvas
 
 kOverwrite
 
 kSingleKey
 
 kWriteDelete
 
 kZombie
 
- Protected Types inherited from TCollection
enum  EStatusBits
 
- Protected Member Functions inherited from TSeqCollection
 TSeqCollection ()
 
- Protected Member Functions inherited from TCollection
 TCollection ()
 
virtual const char * GetCollectionEntryName (TObject *entry) const
 
virtual void PrintCollectionEntry (TObject *entry, Option_t *option, Int_t recurse) const
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 
void MakeZombie ()
 
- Protected Attributes inherited from TSeqCollection
Bool_t fSorted
 
- Protected Attributes inherited from TCollection
TString fName
 
Int_t fSize
 
 kIsOwner
 
 kUseRWLock
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kSignals 
kCleanup 

in ROOT v6 BIT(16) is used by TCollection - without changing the class version

Definition at line 95 of file KVSeqCollection.h.

Constructor & Destructor Documentation

◆ KVSeqCollection() [1/3]

KVSeqCollection::KVSeqCollection ( )

Default constructor.

Definition at line 52 of file KVSeqCollection.cpp.

◆ KVSeqCollection() [2/3]

KVSeqCollection::KVSeqCollection ( const KVSeqCollection col)

Copy constructor See KVSeqCollection::Copy

Definition at line 66 of file KVSeqCollection.cpp.

◆ KVSeqCollection() [3/3]

KVSeqCollection::KVSeqCollection ( const Char_t collection_classname)

Create new extended collection of class "collection_classname". Must be the name of a class derived from TSeqCollection.

Definition at line 84 of file KVSeqCollection.cpp.

◆ ~KVSeqCollection()

KVSeqCollection::~KVSeqCollection ( )
virtual

Destructor If the cleanup mechanism is in use, we first remove the list from the list of cleanups

Definition at line 134 of file KVSeqCollection.cpp.

Member Function Documentation

◆ _GetSubListWithClass()

void KVSeqCollection::_GetSubListWithClass ( KVSeqCollection outputList,
TCollection Col,
const TClass _class 
) const
private

Definition at line 775 of file KVSeqCollection.cpp.

◆ _GetSubListWithMethod()

void KVSeqCollection::_GetSubListWithMethod ( KVSeqCollection outputList,
TCollection Col,
const Char_t retvalue,
const Char_t method 
) const
privatevirtual

Definition at line 860 of file KVSeqCollection.cpp.

◆ Add()

virtual void KVSeqCollection::Add ( TObject obj)
inlinevirtual

Add an object to the list. If the cleanup mechanism is in use, we set the TObject::kMustCleanup bit of the object before adding it to the list.

Implements TCollection.

Reimplemented in KVParticle::FrameList, KVPartitionList, KVUniqueNameList, and KVGVList.

Examples
KVClassFactory_examples.C, and MicroStat_example2.C.

Definition at line 223 of file KVSeqCollection.h.

◆ AddAfter()

virtual void KVSeqCollection::AddAfter ( const TObject after,
TObject obj 
)
inlinevirtual

Add an object to the list. If the cleanup mechanism is in use, we set the TObject::kMustCleanup bit of the object before adding it to the list.

Implements TSeqCollection.

Reimplemented in KVPartitionList, and KVUniqueNameList.

Definition at line 187 of file KVSeqCollection.h.

◆ AddAt()

virtual void KVSeqCollection::AddAt ( TObject obj,
Int_t  idx 
)
inlinevirtual

Add an object to the list. If the cleanup mechanism is in use, we set the TObject::kMustCleanup bit of the object before adding it to the list.

Implements TSeqCollection.

Reimplemented in KVPartitionList, and KVUniqueNameList.

Definition at line 177 of file KVSeqCollection.h.

◆ AddBefore()

virtual void KVSeqCollection::AddBefore ( const TObject before,
TObject obj 
)
inlinevirtual

Add an object to the list. If the cleanup mechanism is in use, we set the TObject::kMustCleanup bit of the object before adding it to the list.

Implements TSeqCollection.

Reimplemented in KVPartitionList, and KVUniqueNameList.

Definition at line 197 of file KVSeqCollection.h.

◆ AddFirst()

virtual void KVSeqCollection::AddFirst ( TObject obj)
inlinevirtual

Add an object to the list. If the cleanup mechanism is in use, we set the TObject::kMustCleanup bit of the object before adding it to the list.

Implements TSeqCollection.

Reimplemented in KVPartitionList, KVUniqueNameList, and KVGVList.

Definition at line 157 of file KVSeqCollection.h.

◆ AddLast()

virtual void KVSeqCollection::AddLast ( TObject obj)
inlinevirtual

Add an object to the list. If the cleanup mechanism is in use, we set the TObject::kMustCleanup bit of the object before adding it to the list.

Implements TSeqCollection.

Reimplemented in KVPartitionList, and KVUniqueNameList.

Definition at line 167 of file KVSeqCollection.h.

◆ After()

virtual TObject * KVSeqCollection::After ( const TObject obj) const
inlinevirtual

Implements TSeqCollection.

Definition at line 211 of file KVSeqCollection.h.

◆ At()

virtual TObject * KVSeqCollection::At ( Int_t  idx) const
inlinevirtual

Implements TSeqCollection.

Definition at line 153 of file KVSeqCollection.h.

◆ Before()

virtual TObject * KVSeqCollection::Before ( const TObject obj) const
inlinevirtual

Implements TSeqCollection.

Definition at line 207 of file KVSeqCollection.h.

◆ Changed()

virtual void KVSeqCollection::Changed ( )
inlineprivatevirtual

Called by Add/RemoveObject, Clear and Delete. We make it emit the "Modified()" signal, if the kSignals bit has been set using SendModifiedSignals(kTRUE).

Reimplemented from TSeqCollection.

Definition at line 109 of file KVSeqCollection.h.

◆ Clear()

void KVSeqCollection::Clear ( Option_t option = "")
virtual

Clear the list of objects. If the cleanup mechanism is in use, and the objects belong to the list (i.e. Clear() will in fact delete all the objects) we first remove this list from the list of cleanups in order to avoid recursive deletes

Implements TCollection.

Reimplemented in KVParticle::FrameList, KVBreakUp, and KVPartitionList.

Examples
KVClassFactory_examples.C.

Definition at line 274 of file KVSeqCollection.cpp.

◆ CollectionClassName()

const Char_t * KVSeqCollection::CollectionClassName ( ) const
inline

Return classname of embedded collection object

Definition at line 249 of file KVSeqCollection.h.

◆ Copy()

void KVSeqCollection::Copy ( TObject obj) const
virtual

Copy a list of objects.

The name of the list is only copied if the list is not IsCleanup(). Cleanup lists must have unique names otherwise the THashList which contains them cannot function correctly.

If this list owns its objects, we make new Clones of all objects in the list (N.B. the Clone() method must work correctly for the objects in question) and put them in the copy list, the copy will own these new objects.

Copy will have same IsOwner() and IsCleanup() status as this list.

If this list sends Modified() signal, the copy will do too.

Reimplemented from TObject.

Definition at line 182 of file KVSeqCollection.cpp.

◆ Delete()

void KVSeqCollection::Delete ( Option_t option = "")
virtual

Delete all heap-based objects in the list. If the cleanup mechanism is in use we first remove this list from the list of cleanups in order to avoid recursive deletes

Implements TCollection.

Definition at line 309 of file KVSeqCollection.cpp.

◆ Execute() [1/2]

void KVSeqCollection::Execute ( const char *  method,
const char *  params,
Int_t error = 0 
)
virtual

Redefinition of TObject::Execute(const char *, const char *, Int_t *) method. TObject::Execute is called for each object in the embedded list in order, meaning that for each object the method "method" is executed with arguments "params".

Reimplemented from TObject.

Definition at line 617 of file KVSeqCollection.cpp.

◆ Execute() [2/2]

void KVSeqCollection::Execute ( TMethod method,
TObjArray params,
Int_t error = 0 
)
virtual

Redefinition of TObject::Execute(TMethod *, TObjArray *, Int_t *) method. TObject::Execute is called for each object in the embedded list in order, meaning that for each object the method "method" is executed with arguments "params".

Reimplemented from TObject.

Definition at line 638 of file KVSeqCollection.cpp.

◆ FindObject() [1/2]

virtual TObject * KVSeqCollection::FindObject ( const char *  name) const
inlinevirtual

Reimplemented from TObject.

Definition at line 263 of file KVSeqCollection.h.

◆ FindObject() [2/2]

virtual TObject * KVSeqCollection::FindObject ( const TObject obj) const
inlinevirtual

Reimplemented from TObject.

Definition at line 273 of file KVSeqCollection.h.

◆ FindObjectAny()

TObject * KVSeqCollection::FindObjectAny ( const Char_t att,
const Char_t keys,
Bool_t  contains_all = kFALSE,
Bool_t  case_sensitive = kTRUE 
) const
virtual

Find an object in the list, if one of its characteristics 'att' contains any or all of the keywords contained in the string 'keys'

att = "name", "title", "class", "type", "label", WARNING: when using "type" or "label", any objects in list which do not inherit from KVBase are ignored keys = list of keywords, separated by spaces

contains_all = kFALSE (default) : object found if any keyword occurs in the characteristic 'att' contains_all = kTRUE : object found if all keywords occur in the characteristic 'att'

case_sensitive = kTRUE (default) : case-sensitive comparison case_sensitive = kFALSE : ignore case of keywords

Definition at line 669 of file KVSeqCollection.cpp.

◆ FindObjectByClass() [1/2]

TObject * KVSeqCollection::FindObjectByClass ( const Char_t cl) const

Return (first) object in embedded list with given class.

Definition at line 464 of file KVSeqCollection.cpp.

◆ FindObjectByClass() [2/2]

TObject * KVSeqCollection::FindObjectByClass ( const TClass cl) const

Return (first) object in embedded list with given class.

Definition at line 447 of file KVSeqCollection.cpp.

◆ FindObjectByLabel()

TObject * KVSeqCollection::FindObjectByLabel ( const Char_t label) const
virtual

Will return object with given label (value of KVBase::GetLabel() method). Objects in list which do not inherit KVBase do not have GetLabel() method, and are ignored.

Definition at line 478 of file KVSeqCollection.cpp.

◆ FindObjectByName()

virtual TObject * KVSeqCollection::FindObjectByName ( const Char_t name) const
inlinevirtual

Definition at line 277 of file KVSeqCollection.h.

◆ FindObjectByNumber()

TObject * KVSeqCollection::FindObjectByNumber ( UInt_t  num) const
virtual

Will return object with given number (value of KVBase::GetNumber() method). Objects in list which do not inherit KVBase do not have GetNumber() method, and are ignored.

Definition at line 502 of file KVSeqCollection.cpp.

◆ FindObjectByTitle()

TObject * KVSeqCollection::FindObjectByTitle ( const Char_t title) const
virtual

Will return object with given title (value of TObject::GetTitle() method).

Definition at line 429 of file KVSeqCollection.cpp.

◆ FindObjectByType()

TObject * KVSeqCollection::FindObjectByType ( const Char_t type) const
virtual

Will return object with given type (value of KVBase::GetType() method). Objects in list which do not inherit KVBase do not have GetType() method, and are ignored.

Definition at line 407 of file KVSeqCollection.cpp.

◆ FindObjectWithMethod()

TObject * KVSeqCollection::FindObjectWithMethod ( const Char_t retvalue,
const Char_t method 
) const
virtual

Find the first object in the list for which the given method returns the given return value: e.g. if method = "GetName" and retvalue = "john", we return the first object in this list for which GetName() returns "john".

For each object of the list, the existence of the given method is checked using TMethodCall::IsValid() if the method is valid and the return value is equal to the input one (retvalue) object is returned Supported return types are those defined in TMethodCall::ReturnType()

Definition at line 552 of file KVSeqCollection.cpp.

◆ FindObjectWithNameAndType()

TObject * KVSeqCollection::FindObjectWithNameAndType ( const Char_t name,
const Char_t type 
) const
virtual

Return object with specified name AND type (value of KVBase::GetType() method). Objects in list which do not inherit KVBase do not have GetType() method, and are ignored.

Definition at line 525 of file KVSeqCollection.cpp.

◆ First()

virtual TObject * KVSeqCollection::First ( ) const
inlinevirtual

Implements TSeqCollection.

Definition at line 215 of file KVSeqCollection.h.

◆ get_object()

template<typename T >
T * KVSeqCollection::get_object ( const TString name) const
inline

Definition at line 269 of file KVSeqCollection.h.

◆ GetCollection()

TSeqCollection * KVSeqCollection::GetCollection ( ) const
inline

Definition at line 325 of file KVSeqCollection.h.

◆ GetObjectRef()

TObject ** KVSeqCollection::GetObjectRef ( const TObject obj) const
virtual

Return reference to object.

Implements TCollection.

Definition at line 332 of file KVSeqCollection.cpp.

◆ GetSize()

virtual Int_t KVSeqCollection::GetSize ( ) const
inlinevirtual

Reimplemented from TCollection.

Definition at line 239 of file KVSeqCollection.h.

◆ GetSubListWithClass() [1/2]

KVSeqCollection * KVSeqCollection::GetSubListWithClass ( const Char_t class_name) const

Recursively create and fill a (sub)list with objects in this list (and any sublists) of the given class. This new list will be of the same kind as this one. The objects in the sublist do not belong to the sublist.

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(GetSubListWithClass(...));

Definition at line 799 of file KVSeqCollection.cpp.

◆ GetSubListWithClass() [2/2]

KVSeqCollection * KVSeqCollection::GetSubListWithClass ( const TClass _class) const

Create and fill a (sub)list with objects in this list of the given class. This new list will be of the same kind as this one. The objects in the sublist do not belong to the sublist.

*** WARNING *** : DELETE the KVSeqCollection returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(GetSubListWithClass(...));

Definition at line 755 of file KVSeqCollection.cpp.

◆ GetSubListWithLabel()

KVSeqCollection * KVSeqCollection::GetSubListWithLabel ( const Char_t retvalue) const

Create and fill a (sub)list with all objects in this list whose label (i.e. string returned by GetLabel()) is "retvalue" This new list will be of the same kind as this one. The objects in the sublist do not belong to the sublist.

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(GetSubListWithLabel(...));

Definition at line 942 of file KVSeqCollection.cpp.

◆ GetSubListWithMethod()

KVSeqCollection * KVSeqCollection::GetSubListWithMethod ( const Char_t retvalue,
const Char_t method 
) const

Recursively create and fill a (sub)list with objects in this list (and any sublists) for which the given method returns the given return value: e.g. if method = "GetName" and retvalue = "john", we return the (sub)list of objects in this list for which GetName() returns "john".

This new list will be of the same kind as this one. The objects in the sublist do not belong to the sublist. *** WARNING *** : DELETE the list returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(GetSubListWithMethod(...));

For each object of the list, the existence of the given method is checked using TMethodCall::IsValid() if the method is valid and the return value is equal to the input one (retvalue) object is added to the subKVList return type supported are those defined in TMethodCall::ReturnType()

Definition at line 833 of file KVSeqCollection.cpp.

◆ GetSubListWithName()

KVSeqCollection * KVSeqCollection::GetSubListWithName ( const Char_t retvalue) const

Create and fill a (sub)list with all objects in this list whose name (i.e. string returned by GetName()) is "retvalue" This new list will be of the same kind as this one. The objects in the sublist do not belong to the sublist.

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(GetSubListWithName(...));

Definition at line 916 of file KVSeqCollection.cpp.

◆ GetSubListWithType()

KVSeqCollection * KVSeqCollection::GetSubListWithType ( const Char_t retvalue) const

Create and fill a (sub)list with all objects in this list whose type (i.e. string returned by GetType()) is "retvalue" This new list will be of the same kind as this one. The objects in the sublist do not belong to the sublist.

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(GetSubListWithType(...));

Definition at line 968 of file KVSeqCollection.cpp.

◆ init()

void KVSeqCollection::init ( )
private

Default initialisation called by ctors Make sure all lists have individual names to ensure rapid look-up in fgCleanups which is a THashList

Definition at line 31 of file KVSeqCollection.cpp.

◆ IsCleanup()

virtual Bool_t KVSeqCollection::IsCleanup ( ) const
inlinevirtual

Returns kTRUE if the ROOT cleanup mechanism is used to ensure that any objects in the list which get deleted elsewhere are removed from this list

Definition at line 255 of file KVSeqCollection.h.

◆ IsSendingModifiedSignals()

virtual Bool_t KVSeqCollection::IsSendingModifiedSignals ( ) const
inlinevirtual

returns kTRUE if 'Modified()' signal is active (see SendModifiedSignals).

Definition at line 146 of file KVSeqCollection.h.

◆ IsSortable()

virtual Bool_t KVSeqCollection::IsSortable ( ) const
inlinevirtual

Reimplemented from TObject.

Definition at line 316 of file KVSeqCollection.h.

◆ IsSorted()

virtual Bool_t KVSeqCollection::IsSorted ( ) const
inlinevirtual

Reimplemented from TSeqCollection.

Definition at line 320 of file KVSeqCollection.h.

◆ Last()

virtual TObject * KVSeqCollection::Last ( ) const
inlinevirtual

Implements TSeqCollection.

Definition at line 219 of file KVSeqCollection.h.

◆ MakeIterator()

TIterator * KVSeqCollection::MakeIterator ( Bool_t  dir = kIterForward) const
virtual

Make and return iterator for the list.

Implements TCollection.

Definition at line 343 of file KVSeqCollection.cpp.

◆ MakeListFromFile()

KVSeqCollection * KVSeqCollection::MakeListFromFile ( TFile file)
static

Static method create a list containing all objects contain of a file The file can be closed after this method, objects stored in the list still remains valid if file=NULL, the current directory is considered

*** WARNING *** : DELETE the KVSeqCollection returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(MakeListFromFile(...));

Definition at line 994 of file KVSeqCollection.cpp.

◆ MakeListFromFileWithClass() [1/2]

KVSeqCollection * KVSeqCollection::MakeListFromFileWithClass ( TFile file,
const Char_t class_name 
)
static

Static method create a list containing all objects of given class in a file WARNING list has to be empty with KVList::Clear() method before closing file if file=NULL, the current directory is considered

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(MakeListFromFileWithClass(...));

Definition at line 1086 of file KVSeqCollection.cpp.

◆ MakeListFromFileWithClass() [2/2]

KVSeqCollection * KVSeqCollection::MakeListFromFileWithClass ( TFile file,
const TClass _class 
)
static

Static method create a list containing all objects of given class in a file WARNING list has to be empty with KVList::Clear() method before closing file if file=NULL, the current directory is considered

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(MakeListFromFileWithClass(...));

Definition at line 1059 of file KVSeqCollection.cpp.

◆ MakeListFromFileWithMethod()

KVSeqCollection * KVSeqCollection::MakeListFromFileWithMethod ( TFile file,
const Char_t retvalue,
const Char_t method 
)
static

Static method create a list containing all objects whose "method" returns "retvalue" in a file WARNING list has to be empty with KVSeqCollection::Clear() method before closing file if file=NULL, the current directory is considered

*** WARNING *** : DELETE the KVList returned by this method after using it !!! *** RECOMMENDED *** : store the returned value in a std::unique_ptr unique_ptr<KVSeqCollection> ptr(MakeListFromFileWithMethod(...));

Definition at line 1032 of file KVSeqCollection.cpp.

◆ Modified()

virtual void KVSeqCollection::Modified ( )
inlinevirtual

Definition at line 132 of file KVSeqCollection.h.

◆ NewCollectionLikeThisOne()

KVSeqCollection * KVSeqCollection::NewCollectionLikeThisOne ( ) const
privatevirtual

PROTECTED method Creates and returns pointer to a new (empty) KVSeqCollection (or derived class) with the same characteristics as this one :

  • class of embedded collection
  • collection is owner of objects ?
  • objects are in cleanup list ?

Definition at line 249 of file KVSeqCollection.cpp.

◆ operator=()

KVSeqCollection & KVSeqCollection::operator= ( const KVSeqCollection c)

Definition at line 230 of file KVSeqCollection.cpp.

◆ PrintCollectionHeader()

void KVSeqCollection::PrintCollectionHeader ( Option_t option) const
privatevirtual

Overrides TCollection::PrintCollectionHeader to show the class name of the embedded list.

Reimplemented from TCollection.

Definition at line 392 of file KVSeqCollection.cpp.

◆ RecursiveRemove()

void KVSeqCollection::RecursiveRemove ( TObject obj)
virtual

Remove object from this collection and recursively remove the object from all other objects (and collections).

NOTE: lists which are 'cleanup' and 'sendmodifiedsignals': the list will not emit 'Modified()' when objects in the list are deleted elsewhere, they are then removed by the cleanup mechanism by calling this method.

Reimplemented from TObject.

Definition at line 374 of file KVSeqCollection.cpp.

◆ RehashCleanupList()

void KVSeqCollection::RehashCleanupList ( )
static

Definition at line 1140 of file KVSeqCollection.cpp.

◆ Remove()

TObject * KVSeqCollection::Remove ( TObject obj)
virtual

Remove object from list.

Implements TCollection.

Reimplemented in KVParticle::FrameList.

Definition at line 354 of file KVSeqCollection.cpp.

◆ SendModifiedSignals()

virtual void KVSeqCollection::SendModifiedSignals ( Bool_t  yes = kTRUE)
inlinevirtual

yes=kTRUE: turns on signals-and-slots mechanism, list will emit 'Modified()' signal every time a change occurs (objects added or removed). yes=kFALSE: turns off signals-and-slots mechanism

By default, the 'Modified()' signal is NOT enabled.

Definition at line 136 of file KVSeqCollection.h.

◆ SetCleanup()

void KVSeqCollection::SetCleanup ( Bool_t  enable = kTRUE)
virtual

To use the ROOT cleanup mechanism to ensure that any objects in the list which get deleted elsewhere are removed from this list, call SetCleanup(kTRUE)

Definition at line 1109 of file KVSeqCollection.cpp.

◆ SetCollection()

void KVSeqCollection::SetCollection ( const Char_t class_name)
privatevirtual

Create TSeqCollection-derived object of class 'class_name' and set as the embedded collection fCollection.

Definition at line 103 of file KVSeqCollection.cpp.

◆ SetOwner()

virtual void KVSeqCollection::SetOwner ( Bool_t  enable = kTRUE)
inlinevirtual

if(enable&&IsCleanup()) Warning("SetOwner","List %s will be both owner & cleanup",GetName());

Reimplemented from TCollection.

Definition at line 243 of file KVSeqCollection.h.

Member Data Documentation

◆ fCollection

TSeqCollection* KVSeqCollection::fCollection
private

Pointer to embedded ROOT collection.

Definition at line 107 of file KVSeqCollection.h.

◆ fgCleanups

TSeqCollection * KVSeqCollection::fgCleanups = NULL
staticprivate

regroup all lists which are to be cleaned up

Definition at line 104 of file KVSeqCollection.h.

◆ fgCounter

Int_t KVSeqCollection::fgCounter = 0
staticprivate

counts instances

Definition at line 103 of file KVSeqCollection.h.

◆ fSCCounter

Long64_t KVSeqCollection::fSCCounter = 0
staticprivate

counter used to give unique names to all lists

Definition at line 101 of file KVSeqCollection.h.