12#ifndef ROOT_TCollection 
   13#define ROOT_TCollection 
   59#ifdef R__CHECK_COLLECTION_MULTI_ACCESS 
   62#include <unordered_multiset> 
   67#ifdef R__CHECK_COLLECTION_MULTI_ACCESS 
   71      std::atomic<std::thread::id> fWriteCurrent;
 
   72      std::atomic<size_t> fWriteCurrentRecurse;
 
   73      std::atomic<size_t> fReadCurrentRecurse;
 
   74      std::unordered_multiset<std::thread::id> fReadSet;
 
   75      std::atomic_flag fSpinLockFlag;
 
   77      void Lock(
const TCollection *collection, 
const char *function);
 
   81      void ReadLock(
const TCollection *collection, 
const char *function);
 
   85      void ConflictReport(std::thread::id holder, 
const char *accesstype, 
const TCollection *collection,
 
   86                          const char *function);
 
   89      TErrorLock() : fWriteCurrent(), fWriteCurrentRecurse(0), fReadCurrentRecurse(0)
 
   91         std::atomic_flag_clear(&fSpinLockFlag);
 
   98         WriteGuard(TErrorLock &lock, 
const TCollection *collection, 
const char *function) : fLock(&lock)
 
  100            fLock->Lock(collection, function);
 
  102         ~WriteGuard() { fLock->Unlock(); }
 
  109         ReadGuard(TErrorLock &lock, 
const TCollection *collection, 
const char *function) : fLock(&lock)
 
  111            fLock->ReadLock(collection, function);
 
  113         ~ReadGuard() { fLock->ReadUnlock(); }
 
  117   mutable TErrorLock fLock; 
 
  119#define R__COLLECTION_WRITE_GUARD() TCollection::TErrorLock::WriteGuard wg(fLock, this, __PRETTY_FUNCTION__) 
  120#define R__COLLECTION_READ_GUARD() TCollection::TErrorLock::ReadGuard rg(fLock, this, __PRETTY_FUNCTION__) 
  122#define R__COLLECTION_ITER_GUARD(collection) \ 
  123   TCollection::TErrorLock::ReadGuard rg(collection->fLock, collection, __PRETTY_FUNCTION__) 
  127#define R__COLLECTION_WRITE_GUARD() 
  128#define R__COLLECTION_READ_GUARD() 
  129#define R__COLLECTION_ITER_GUARD(collection) 
  175   virtual void       Dump() 
const ;
 
  180   virtual const char *
GetName() 
const;
 
  245         : 
fIterator(col ? col->MakeIterator(dir) : 0) { }
 
  264      return !(*
this == aIter);
 
  310template <
typename T, 
bool isDynamic>
 
  314      static_assert(std::is_base_of<TObject, T>::value, 
"Containee type must inherit from TObject");
 
  361#if defined (_REENTRANT) || defined (WIN32) 
  363#define R__COLL_COND_MUTEX(mutex) this->IsUsingRWLock() ? mutex : nullptr 
  365#define R__COLLECTION_READ_LOCKGUARD(mutex) ::ROOT::TReadLockGuard _R__UNIQUE_(R__readguard)(R__COLL_COND_MUTEX(mutex)) 
  366#define R__COLLECTION_READ_LOCKGUARD_NAMED(name,mutex) ::ROOT::TReadLockGuard _NAME2_(R__readguard,name)(R__COLL_COND_MUTEX(mutex)) 
  368#define R__COLLECTION_WRITE_LOCKGUARD(mutex) ::ROOT::TWriteLockGuard _R__UNIQUE_(R__readguard)(R__COLL_COND_MUTEX(mutex)) 
  369#define R__COLLECTION_WRITE_LOCKGUARD_NAMED(name,mutex) ::ROOT::TWriteLockGuard _NAME2_(R__readguard,name)(R__COLL_COND_MUTEX(mutex)) 
  373#define R__COLLECTION_READ_LOCKGUARD(mutex) (void)mutex 
  374#define R__COLLECTION_COLLECTION_READ_LOCKGUARD_NAMED(name,mutex) (void)mutex 
  376#define R__COLLECTION_WRITE_LOCKGUARD(mutex) (void)mutex 
  377#define R__COLLECTION_WRITE_LOCKGUARD_NAMED(name,mutex) (void)mutex 
  386#define R__FOR_EACH(type,proc) \ 
  387    SetCurrentCollection(); \ 
  388    TIter _NAME3_(nxt_,type,proc)(TCollection::GetCurrentCollection()); \ 
  389    type *_NAME3_(obj_,type,proc); \ 
  390    while ((_NAME3_(obj_,type,proc) = (type*) _NAME3_(nxt_,type,proc)())) \ 
  391       _NAME3_(obj_,type,proc)->proc 
#define ClassDef(name, id)
 
const Bool_t kIterBackward
 
R__EXTERN TVirtualMutex * gCollectionMutex
 
const Bool_t kIterForward
 
TRangeCast(TCollection const &col)
 
TRangeCast(TCollection const *col)
 
Wraps any collection that can be used in range-based loops and applies static_cast<T> or dynamic_cast...
 
Using a TBrowser one can browse all ROOT objects.
 
TClass instances represent classes, structs and namespaces in the ROOT type system.
 
Collection abstract base class.
 
virtual void Dump() const
Dump all objects in this collection.
 
virtual TObject ** GetObjectRef(const TObject *obj) const =0
 
virtual TObject * Remove(TObject *obj)=0
 
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
 
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
 
virtual Bool_t Notify()
'Notify' all objects in this collection.
 
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
 
virtual void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const
Print the collection entry.
 
Bool_t IsArgNull(const char *where, const TObject *obj) const
Returns true if object is a null pointer.
 
TCollection(const TCollection &)
 
virtual const char * GetName() const
Return name of this collection.
 
Bool_t IsSortable() const
 
void SetCurrentCollection()
Set this collection to be the globally accessible collection.
 
static TCollection * GetCurrentCollection()
Return the globally accessible collection.
 
virtual bool UseRWLock(Bool_t enable=true)
Set this collection to use a RW lock upon access, making it thread safe.
 
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
 
static Bool_t fgEmptyingGarbage
 
Bool_t AssertClass(TClass *cl) const
Make sure all objects in this collection inherit from class cl.
 
static Int_t fgGarbageStack
 
void operator=(const TCollection &)
 
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
 
virtual void Clear(Option_t *option="")=0
 
void SetName(const char *name)
 
virtual void AddAll(const TCollection *col)
Add all objects from collection col to this collection.
 
virtual TIterator * MakeReverseIterator() const
 
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
 
ULong_t Hash() const
Return hash value for this object.
 
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
 
virtual Int_t GetEntries() const
 
virtual const char * GetCollectionEntryName(TObject *entry) const
For given collection entry return the string that is used to identify the object and,...
 
static void EmptyGarbageCollection()
Do the garbage collection.
 
virtual void PrintCollectionHeader(Option_t *option) const
Print the collection header.
 
virtual void Delete(Option_t *option="")=0
Delete this object.
 
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
 
static TCollection * fgCurrentCollection
 
virtual void Add(TObject *obj)=0
 
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
 
virtual Bool_t IsEmpty() const
 
R__ALWAYS_INLINE Bool_t IsUsingRWLock() const
 
Int_t Compare(const TObject *obj) const
Compare two TCollection objects.
 
static TObjectTable * fgGarbageCollection
 
void AddVector(TObject *obj1,...)
Add all arguments to the collection.
 
virtual ~TCollection()
TNamed destructor.
 
static void StartGarbageCollection()
Set up for garbage collection.
 
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
 
virtual void Paint(Option_t *option="")
Paint all objects in this collection.
 
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
 
TObject * operator()(const char *name) const
Find an object in this collection by name.
 
Bool_t Contains(const char *name) const
 
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
 
Bool_t Contains(const TObject *obj) const
 
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
 
TIterCategory(TIterator *it)
 
TIterCategory(const TCollection *col, Bool_t dir=kIterForward)
 
static TIterCategory End()
 
TIter & Begin()
Pointing to the first element of the container.
 
const TCollection * GetCollection() const
 
Bool_t operator!=(const TIter &aIter) const
 
Bool_t operator==(const TIter &aIter) const
 
TIter & operator=(TIterator *iter)
 
Option_t * GetOption() const
 
static TIter End()
Pointing to the element after the last - to a nullptr value in our case.
 
TObject * operator*() const
 
TIter & operator=(const TIter &rhs)
Assigning an TIter to another.
 
TIter(const TCollection *col, Bool_t dir=kIterForward)
 
Iterator abstract base class.
 
virtual TObject * Next()=0
 
virtual Option_t * GetOption() const
 
virtual const TCollection * GetCollection() const =0
 
This class registers all instances of TObject and its derived classes in a hash table.
 
Mother of all ROOT objects.
 
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
 
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
 
This class implements a mutex interface.
 
bool ContaineeInheritsFrom(TClass *cl, TClass *base)
Return true if 'cl' inherits from 'base'.
 
const TCollection & EmptyCollection()
Return an empty collection for use with nullptr TRangeCast.
 
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...