Logo ROOT   6.12/07
Reference Guide
TCollection.h
Go to the documentation of this file.
1 // @(#)root/cont:$Id$
2 // Author: Fons Rademakers 13/08/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TCollection
13 #define ROOT_TCollection
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TCollection //
19 // //
20 // Collection abstract base class. This class inherits from TObject //
21 // because we want to be able to have collections of collections. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TObject.h"
26 
27 #include "TIterator.h"
28 
29 #include "TString.h"
30 
31 #include "TVirtualRWMutex.h"
32 
33 #include <assert.h>
34 
35 class TClass;
36 class TObjectTable;
37 class TVirtualMutex;
38 class TIter;
39 
42 
44 
45 // #define R__CHECK_COLLECTION_MULTI_ACCESS
46 
47 // When R__CHECK_COLLECTION_MULTI_ACCESS is turned on (defined),
48 // the normal (not locked) ROOT TCollections are instrumented with a
49 // pseudo read-write lock which does not halt the execution but detects
50 // and report concurrent access to the same collections.
51 // Multiple readers are allowed.
52 // Multiple concurrent writer is reported as a Conflict
53 // Readers access while a write is running is reported as Conflict
54 // Re-entrant writing call by the same Writer thread are allowed.
55 // Entering a writing section by a single Reader thread is allowed.
56 
57 #ifdef R__CHECK_COLLECTION_MULTI_ACCESS
58 #include <atomic>
59 #include <thread>
60 #include <unordered_set>
61 #endif
62 
63 class TCollection : public TObject {
64 
65 #ifdef R__CHECK_COLLECTION_MULTI_ACCESS
66 public:
67  class TErrorLock {
68  // Warn when multiple thread try to acquire the same 'lock'
69  std::atomic<std::thread::id> fWriteCurrent;
70  std::atomic<size_t> fWriteCurrentRecurse;
71  std::atomic<size_t> fReadCurrentRecurse;
72  std::unordered_multiset<std::thread::id> fReadSet;
73  std::atomic_flag fSpinLockFlag;
74 
75  void Lock(const TCollection *collection, const char *function);
76 
77  void Unlock();
78 
79  void ReadLock(const TCollection *collection, const char *function);
80 
81  void ReadUnlock();
82 
83  void ConflictReport(std::thread::id holder, const char *accesstype, const TCollection *collection,
84  const char *function);
85 
86  public:
87  TErrorLock() : fWriteCurrent(), fWriteCurrentRecurse(0), fReadCurrentRecurse(0)
88  {
89  std::atomic_flag_clear(&fSpinLockFlag);
90  }
91 
92  class WriteGuard {
93  TErrorLock *fLock;
94 
95  public:
96  WriteGuard(TErrorLock &lock, const TCollection *collection, const char *function) : fLock(&lock)
97  {
98  fLock->Lock(collection, function);
99  }
100  ~WriteGuard() { fLock->Unlock(); }
101  };
102 
103  class ReadGuard {
104  TErrorLock *fLock;
105 
106  public:
107  ReadGuard(TErrorLock &lock, const TCollection *collection, const char *function) : fLock(&lock)
108  {
109  fLock->ReadLock(collection, function);
110  }
111  ~ReadGuard() { fLock->ReadUnlock(); }
112  };
113  };
114 
115  mutable TErrorLock fLock; //! Special 'lock' to detect multiple access to a collection.
116 
117 #define R__COLLECTION_WRITE_GUARD() TCollection::TErrorLock::WriteGuard wg(fLock, this, __PRETTY_FUNCTION__)
118 #define R__COLLECTION_READ_GUARD() TCollection::TErrorLock::ReadGuard rg(fLock, this, __PRETTY_FUNCTION__)
119 
120 #define R__COLLECTION_ITER_GUARD(collection) \
121  TCollection::TErrorLock::ReadGuard rg(collection->fLock, collection, __PRETTY_FUNCTION__)
122 
123 #else
124 
125 #define R__COLLECTION_WRITE_GUARD()
126 #define R__COLLECTION_READ_GUARD()
127 #define R__COLLECTION_ITER_GUARD(collection)
128 
129 #endif
130 
131 private:
132  static TCollection *fgCurrentCollection; //used by macro R__FOR_EACH
133  static TObjectTable *fgGarbageCollection; //used by garbage collector
134  static Bool_t fgEmptyingGarbage; //used by garbage collector
135  static Int_t fgGarbageStack; //used by garbage collector
136 
137  TCollection(const TCollection &); //private and not-implemented, collections
138  void operator=(const TCollection &); //are too complex to be automatically copied
139 
140 protected:
141  enum EStatusBits {
142  kIsOwner = BIT(14),
143  // BIT(15) is used by TClonesArray and TMap
145  };
146 
147  TString fName; //name of the collection
148  Int_t fSize; //number of elements in collection
149 
150  TCollection() : fName(), fSize(0) { }
151 
152  virtual void PrintCollectionHeader(Option_t* option) const;
153  virtual const char* GetCollectionEntryName(TObject* entry) const;
154  virtual void PrintCollectionEntry(TObject* entry, Option_t* option, Int_t recurse) const;
155 
156 public:
158 
159  virtual ~TCollection();
160  virtual void Add(TObject *obj) = 0;
161  void AddVector(TObject *obj1, ...);
162  virtual void AddAll(const TCollection *col);
163  Bool_t AssertClass(TClass *cl) const;
164  void Browse(TBrowser *b);
165  Int_t Capacity() const { return fSize; }
166  virtual void Clear(Option_t *option="") = 0;
167  virtual TObject *Clone(const char *newname="") const;
168  Int_t Compare(const TObject *obj) const;
169  Bool_t Contains(const char *name) const { return FindObject(name) != 0; }
170  Bool_t Contains(const TObject *obj) const { return FindObject(obj) != 0; }
171  virtual void Delete(Option_t *option="") = 0;
172  virtual void Draw(Option_t *option="");
173  virtual void Dump() const ;
174  virtual TObject *FindObject(const char *name) const;
175  TObject *operator()(const char *name) const;
176  virtual TObject *FindObject(const TObject *obj) const;
177  virtual Int_t GetEntries() const { return GetSize(); }
178  virtual const char *GetName() const;
179  virtual TObject **GetObjectRef(const TObject *obj) const = 0;
180  virtual Int_t GetSize() const { return fSize; }
181  virtual Int_t GrowBy(Int_t delta) const;
182  ULong_t Hash() const { return fName.Hash(); }
183  Bool_t IsArgNull(const char *where, const TObject *obj) const;
184  virtual Bool_t IsEmpty() const { return GetSize() <= 0; }
185  virtual Bool_t IsFolder() const { return kTRUE; }
186  Bool_t IsOwner() const { return TestBit(kIsOwner); }
187  Bool_t IsSortable() const { return kTRUE; }
188  virtual void ls(Option_t *option="") const ;
189  virtual Bool_t Notify();
190  virtual TIterator *MakeIterator(Bool_t dir = kIterForward) const = 0;
192  virtual void Paint(Option_t *option="");
193  virtual void Print(Option_t *option="") const;
194  virtual void Print(Option_t *option, Int_t recurse) const;
195  virtual void Print(Option_t *option, const char* wildcard, Int_t recurse=1) const;
196  virtual void Print(Option_t *option, TPRegexp& regexp, Int_t recurse=1) const;
197  virtual void RecursiveRemove(TObject *obj);
198  virtual TObject *Remove(TObject *obj) = 0;
199  virtual void RemoveAll(TCollection *col);
200  void RemoveAll() { Clear(); }
201  void SetCurrentCollection();
202  void SetName(const char *name) { fName = name; }
203  virtual void SetOwner(Bool_t enable = kTRUE);
204  virtual bool UseRWLock();
205  virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0);
206  virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0) const;
207 
209 
211  static void StartGarbageCollection();
212  static void GarbageCollect(TObject *obj);
213  static void EmptyGarbageCollection();
214 
215  TIter begin() const;
216  TIter end() const;
217 
218  ClassDef(TCollection,3) //Collection abstract base class
219 };
220 
221 
222 //////////////////////////////////////////////////////////////////////////
223 // //
224 // TIter //
225 // //
226 // Iterator wrapper. Type of iterator used depends on type of //
227 // collection. //
228 // //
229 //////////////////////////////////////////////////////////////////////////
230 
231 class TIter {
232 
233 private:
234  TIterator *fIterator; //collection iterator
235 
236 protected:
237  TIter() : fIterator(nullptr) { }
238 
239 public:
241  : fIterator(col ? col->MakeIterator(dir) : 0) { }
242  TIter(TIterator *it) : fIterator(it) { }
243  TIter(const TIter &iter);
244  TIter &operator=(const TIter &rhs);
245  virtual ~TIter() { SafeDelete(fIterator); }
246  TObject *operator()() { return Next(); }
247  TObject *Next() { return fIterator ? fIterator->Next() : nullptr; }
248  const TCollection *GetCollection() const { return fIterator ? fIterator->GetCollection() : nullptr; }
249  Option_t *GetOption() const { return fIterator ? fIterator->GetOption() : ""; }
250  void Reset() { if (fIterator) fIterator->Reset(); }
251  TIter &operator++() { Next(); return *this; }
252  Bool_t operator==(const TIter &aIter) const {
253  if (fIterator == nullptr)
254  return aIter.fIterator == nullptr || **aIter.fIterator == nullptr;
255  if (aIter.fIterator == nullptr)
256  return fIterator == nullptr || **fIterator == nullptr;
257  return *fIterator == *aIter.fIterator;
258  }
259  Bool_t operator!=(const TIter &aIter) const {
260  return !(*this == aIter);
261  }
262  TObject *operator*() const { return fIterator ? *(*fIterator): nullptr; }
263  TIter &Begin();
264  static TIter End();
265 
266  ClassDef(TIter,0) //Iterator wrapper
267 };
268 
269 template <class T>
270 class TIterCategory: public TIter, public std::iterator_traits<typename T::Iterator_t> {
271 
272 public:
273  TIterCategory(const TCollection *col, Bool_t dir = kIterForward) : TIter(col, dir) { }
275  virtual ~TIterCategory() { }
276  TIterCategory &Begin() { TIter::Begin(); return *this; }
277  static TIterCategory End() { return TIterCategory(static_cast<TIterator*>(nullptr)); }
278 };
279 
280 
281 inline TIter TCollection::begin() const { return ++(TIter(this)); }
282 inline TIter TCollection::end() const { return TIter::End(); }
283 
284 namespace ROOT {
285 namespace Internal {
286 
288 bool ContaineeInheritsFrom(TClass *cl, TClass *base);
289 
290 /// @brief Internal help class implmenting an iterator for TRangeDynCast.
291 template <class Containee> // Containee must derive from TObject.
292 class TRangeDynCastIterator : public TIter {
293  static_assert(std::is_base_of<TObject, Containee>::value, "Containee type must inherit from TObject");
294 
295  /// This is a workaround against ClassDefInline not supporting classes
296  /// missing their default constructor or having them private.
297  template <class T>
299 
300  TRangeDynCastIterator() = default;
301 
302 public:
303  using TIter::TIter;
304  TRangeDynCastIterator(const TIter &iter) : TIter(iter) {}
305 
306  Containee *operator()() = delete;
307 
308  Containee *Next() { return dynamic_cast<Containee *>(TIter::Next()); }
309  Containee *operator*() const { return dynamic_cast<Containee *>(TIter::operator*()); }
310 
312 };
313 
314 } // namespace Internal
315 
316 namespace Detail {
317 
318 /// @brief TTypedIter is a typed version of TIter.
319 ///
320 /// This requires the collection to contains elements of the type requested
321 /// (or a derived class). Any deviation from this expectation
322 /// will only be caught/reported by an assert in debug builds.
323 ///
324 /// This is best used with a TClonesArray, for other cases prefered TRangeDynCast.
325 ///
326 /// The typical use is:
327 /// ~~~ {.cpp}
328 /// TTypedIter<TBaseClass> next(tbaseClassClonesArrayPtr);
329 /// while(auto bcl = next()) {
330 /// ... use bcl as a TBaseClass*
331 /// }
332 /// ~~~ {.cpp}
333 template <class Containee> // Containee must derive from TObject.
334 class TTypedIter : public TIter {
335  static_assert(std::is_base_of<TObject, Containee>::value, "Containee type must inherit from TObject");
336 
337  /// This is a workaround against ClassDefInline not supporting classes
338  /// missing their default constructor or having them private.
339  template <class T>
341 
342  TTypedIter() = default;
343 
344  static Containee *StaticCast(TObject *obj)
345  {
346  assert(!obj || ROOT::Internal::ContaineeInheritsFrom(obj->IsA(), Containee::Class()));
347  return static_cast<Containee *>(obj);
348  }
349 
350 public:
351  using TIter::TIter;
352  TTypedIter(const TIter &iter) : TIter(iter) {}
353 
354  Containee *operator()() { return StaticCast(TIter::Next()); }
355  Containee *Next() { return StaticCast(TIter::Next()); }
356  Containee *operator*() const { return StaticCast(TIter::operator*()); }
357 
359 };
360 
361 /// @brief TRangeStaticCast is an adaptater class that allows the typed iteration
362 /// through a TCollection. This requires the collection to contains element
363 /// of the type requested (or a derived class). Any deviation from this expectation
364 /// will only be caught/reported by an assert in debug builds.
365 ///
366 /// This is best used with a TClonesArray, for other cases prefered TRangeDynCast.
367 ///
368 /// The typical use is:
369 /// ~~~ {.cpp}
370 /// for(auto bcl : TRangeStaticCast<TBaseClass>( *tbaseClassClonesArrayPtr )) {
371 /// assert(bcl && bcl->IsA()->InheritsFrom(TBaseClass::Class()));
372 /// ... use bcl as a TBaseClass*
373 /// }
374 /// for(auto bcl : TRangeStaticCast<TBaseClass>( tbaseClassClonesArrayPtr )) {
375 /// assert(bcl && bcl->IsA()->InheritsFrom(TBaseClass::Class()));
376 /// ... use bcl as a TBaseClass*
377 /// }
378 /// ~~~ {.cpp}
379 template <class T>
382 
383 public:
384  TRangeStaticCast(const TCollection &col) : fCollection(col) {}
385  TRangeStaticCast(const TCollection *col) : fCollection(col != nullptr ? *col : ROOT::Internal::EmptyCollection()) {}
386 
387  TTypedIter<T> begin() const { return fCollection.begin(); }
388  TTypedIter<T> end() const { return fCollection.end(); }
389 };
390 
391 } // namespace Detail
392 } // namespace ROOT
393 
394 /// @brief TRangeDynCast is an adaptater class that allows the typed iteration
395 /// through a TCollection.
396 ///
397 /// The typical use is:
398 /// ~~~ {.cpp}
399 /// for(auto bcl : TRangeDynCast<TBaseClass>( *cl->GetListOfBases() )) {
400 /// if (!bcl) continue;
401 /// ... use bcl as a TBaseClass*
402 /// }
403 /// for(auto bcl : TRangeDynCast<TBaseClass>( cl->GetListOfBases() )) {
404 /// if (!bcl) continue;
405 /// ... use bcl as a TBaseClass*
406 /// }
407 /// ~~~ {.cpp}
408 template <class T>
411 
412 public:
413  TRangeDynCast(const TCollection &col) : fCollection(col) {}
414  TRangeDynCast(const TCollection *col) : fCollection(col != nullptr ? *col : ROOT::Internal::EmptyCollection()) {}
415 
416  ROOT::Internal::TRangeDynCastIterator<T> begin() const { return fCollection.begin(); }
417  ROOT::Internal::TRangeDynCastIterator<T> end() const { return fCollection.end(); }
418 };
419 
420 // Zero overhead macros in case not compiled with thread support
421 #if defined (_REENTRANT) || defined (WIN32)
422 
423 #define R__COLL_COND_MUTEX(mutex) this->IsUsingRWLock() ? mutex : nullptr
424 
425 #define R__COLLECTION_READ_LOCKGUARD(mutex) ::ROOT::TReadLockGuard _R__UNIQUE_(R__readguard)(R__COLL_COND_MUTEX(mutex))
426 #define R__COLLECTION_READ_LOCKGUARD_NAMED(name,mutex) ::ROOT::TReadLockGuard _NAME2_(R__readguard,name)(R__COLL_COND_MUTEX(mutex))
427 
428 #define R__COLLECTION_WRITE_LOCKGUARD(mutex) ::ROOT::TWriteLockGuard _R__UNIQUE_(R__readguard)(R__COLL_COND_MUTEX(mutex))
429 #define R__COLLECTION_WRITE_LOCKGUARD_NAMED(name,mutex) ::ROOT::TWriteLockGuard _NAME2_(R__readguard,name)(R__COLL_COND_MUTEX(mutex))
430 
431 #else
432 
433 #define R__COLLECTION_READ_LOCKGUARD(mutex) (void)mutex
434 #define R__COLLECTION_COLLECTION_READ_LOCKGUARD_NAMED(name,mutex) (void)mutex
435 
436 #define R__COLLECTION_WRITE_LOCKGUARD(mutex) (void)mutex
437 #define R__COLLECTION_WRITE_LOCKGUARD_NAMED(name,mutex) (void)mutex
438 
439 #endif
440 
441 //---- R__FOR_EACH macro -------------------------------------------------------
442 
443 // Macro to loop over all elements of a list of type "type" while executing
444 // procedure "proc" on each element
445 
446 #define R__FOR_EACH(type,proc) \
447  SetCurrentCollection(); \
448  TIter _NAME3_(nxt_,type,proc)(TCollection::GetCurrentCollection()); \
449  type *_NAME3_(obj_,type,proc); \
450  while ((_NAME3_(obj_,type,proc) = (type*) _NAME3_(nxt_,type,proc)())) \
451  _NAME3_(obj_,type,proc)->proc
452 
453 #endif
TIter end() const
Definition: TCollection.h:282
ROOT::Internal::TRangeDynCastIterator< T > end() const
Definition: TCollection.h:417
virtual TObject * Remove(TObject *obj)=0
static Int_t fgGarbageStack
Definition: TCollection.h:135
void Begin(Int_t type)
virtual void Clear(Option_t *option="")=0
const TCollection * GetCollection() const
Definition: TCollection.h:248
virtual Option_t * GetOption() const
Definition: TIterator.h:40
virtual void Reset()=0
R__EXTERN TVirtualMutex * gCollectionMutex
Definition: TCollection.h:43
TRangeStaticCast(const TCollection &col)
Definition: TCollection.h:384
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
TRangeDynCast(const TCollection &col)
Definition: TCollection.h:413
ROOT::Internal::TRangeDynCastIterator< T > begin() const
Definition: TCollection.h:416
const char Option_t
Definition: RtypesCore.h:62
virtual const char * GetCollectionEntryName(TObject *entry) const
For given collection entry return the string that is used to identify the object and, potentially, perform wildcard/regexp filtering on.
TRangeDynCast(const TCollection *col)
Definition: TCollection.h:414
Int_t Compare(const TObject *obj) const
Compare two TCollection objects.
TIter & Begin()
Pointing to the first element of the container.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
#define BIT(n)
Definition: Rtypes.h:78
Bool_t IsArgNull(const char *where, const TObject *obj) const
Returns true if object is a null pointer.
virtual void Draw(Option_t *option="")
Draw all objects in this collection.
virtual Int_t GetEntries() const
Definition: TCollection.h:177
virtual void AddAll(const TCollection *col)
Add all objects from collection col to this collection.
This class implements a mutex interface.
Definition: TVirtualMutex.h:34
static TIterCategory End()
Definition: TCollection.h:277
bool ContaineeInheritsFrom(TClass *cl, TClass *base)
Return true if &#39;cl&#39; inherits from &#39;base&#39;.
virtual TIterator * MakeReverseIterator() const
Definition: TCollection.h:191
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
Definition: TCollection.h:185
Basic string class.
Definition: TString.h:125
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
static TCollection * fgCurrentCollection
Definition: TCollection.h:132
TString fName
Definition: TCollection.h:147
Option_t * GetOption() const
Definition: TCollection.h:249
Bool_t Contains(const char *name) const
Definition: TCollection.h:169
Containee * operator*() const
Definition: TCollection.h:356
TRangeStaticCast is an adaptater class that allows the typed iteration through a TCollection.
Definition: TCollection.h:380
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
Iterator abstract base class.
Definition: TIterator.h:30
void Reset()
Definition: TCollection.h:250
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
Definition: TString.cxx:616
virtual void Delete(Option_t *option="")=0
Delete this object.
#define SafeDelete(p)
Definition: RConfig.h:509
TIterator * fIterator
Definition: TCollection.h:234
#define ClassDef(name, id)
Definition: Rtypes.h:320
void Class()
Definition: Class.C:29
void AddVector(TObject *obj1,...)
Add all arguments to the collection.
TRangeDynCastIterator(const TIter &iter)
Definition: TCollection.h:304
TIterCategory(const TCollection *col, Bool_t dir=kIterForward)
Definition: TCollection.h:273
Bool_t Contains(const TObject *obj) const
Definition: TCollection.h:170
const Bool_t kIterForward
Definition: TCollection.h:40
virtual bool UseRWLock()
Set this collection to use a RW lock upon access, making it thread safe.
Bool_t IsOwner() const
Definition: TCollection.h:186
XFontStruct * id
Definition: TGX11.cxx:108
virtual void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const
Print the collection entry.
Containee * operator()()
Definition: TCollection.h:354
Bool_t operator!=(const TIter &aIter) const
Definition: TCollection.h:259
Internal help class implmenting an iterator for TRangeDynCast.
Definition: TCollection.h:292
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
TTypedIter is a typed version of TIter.
Definition: TCollection.h:334
TRangeStaticCast(const TCollection *col)
Definition: TCollection.h:385
virtual Int_t GrowBy(Int_t delta) const
Increase the collection&#39;s capacity by delta slots.
virtual ~TIter()
Definition: TCollection.h:245
R__ALWAYS_INLINE Bool_t IsUsingRWLock() const
Definition: TCollection.h:208
TIter(TIterator *it)
Definition: TCollection.h:242
static TCollection * GetCurrentCollection()
Return the globally accessible collection.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
TIter & operator++()
Definition: TCollection.h:251
TObject * Next()
Definition: TCollection.h:247
Collection abstract base class.
Definition: TCollection.h:63
virtual void Paint(Option_t *option="")
Paint all objects in this collection.
virtual const TCollection * GetCollection() const =0
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
TTypedIter(const TIter &iter)
Definition: TCollection.h:352
static void StartGarbageCollection()
Set up for garbage collection.
TIter begin() const
Definition: TCollection.h:281
TObject * operator()()
Definition: TCollection.h:246
This class registers all instances of TObject and its derived classes in a hash table.
Definition: TObjectTable.h:35
void SetName(const char *name)
Definition: TCollection.h:202
virtual Bool_t Notify()
&#39;Notify&#39; all objects in this collection.
void SetCurrentCollection()
Set this collection to be the globally accesible collection.
virtual void Dump() const
Dump all objects in this collection.
static Bool_t fgEmptyingGarbage
Definition: TCollection.h:134
static TIter End()
Pointing to the element after the last - to a nullptr value in our case.
void RemoveAll()
Definition: TCollection.h:200
const TCollection & fCollection
Definition: TCollection.h:410
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
TTypedIter< T > begin() const
Definition: TCollection.h:387
virtual Bool_t IsEmpty() const
Definition: TCollection.h:184
virtual ~TIterCategory()
Definition: TCollection.h:275
const TCollection & EmptyCollection()
Return an empty collection for use with nullptr TRangeCast.
TIter(const TCollection *col, Bool_t dir=kIterForward)
Definition: TCollection.h:240
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
virtual ~TCollection()
TNamed destructor.
EStatusBits
Definition: TObject.h:57
static TObjectTable * fgGarbageCollection
Definition: TCollection.h:133
unsigned long ULong_t
Definition: RtypesCore.h:51
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
virtual void Add(TObject *obj)=0
static void EmptyGarbageCollection()
Do the garbage collection.
Mother of all ROOT objects.
Definition: TObject.h:37
#define R__EXTERN
Definition: DllImport.h:27
void operator=(const TCollection &)
virtual void PrintCollectionHeader(Option_t *option) const
Print the collection header.
Int_t Capacity() const
Definition: TCollection.h:165
#define ClassDefInline(name, id)
Definition: Rtypes.h:332
virtual TObject * Next()=0
TObject * operator*() const
Definition: TCollection.h:262
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
TIterCategory & Begin()
Definition: TCollection.h:276
void End()
Bool_t AssertClass(TClass *cl) const
Make sure all objects in this collection inherit from class cl.
TTypedIter< T > end() const
Definition: TCollection.h:388
virtual TObject ** GetObjectRef(const TObject *obj) const =0
#define R__ALWAYS_INLINE
Definition: RConfig.h:533
const Bool_t kIterBackward
Definition: TCollection.h:41
Bool_t operator==(const TIter &aIter) const
Definition: TCollection.h:252
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
Bool_t IsSortable() const
Definition: TCollection.h:187
virtual Int_t GetSize() const
Definition: TCollection.h:180
TObject * operator()(const char *name) const
Find an object in this collection by name.
const Bool_t kTRUE
Definition: RtypesCore.h:87
TIterCategory(TIterator *it)
Definition: TCollection.h:274
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
char name[80]
Definition: TGX11.cxx:109
const TCollection & fCollection
Definition: TCollection.h:381
virtual const char * GetName() const
Return name of this collection.
TRangeDynCast is an adaptater class that allows the typed iteration through a TCollection.
Definition: TCollection.h:409
ULong_t Hash() const
Return hash value for this object.
Definition: TCollection.h:182
static Containee * StaticCast(TObject *obj)
Definition: TCollection.h:344