Logo ROOT   6.10/09
Reference Guide
TCollection.cxx
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 /** \class TCollection
13 \ingroup Containers
14 Collection abstract base class. This class describes the base
15 protocol all collection classes have to implement. The ROOT
16 collection classes always store pointers to objects that inherit
17 from TObject. They never adopt the objects. Therefore, it is the
18 user's responsibility to take care of deleting the actual objects
19 once they are not needed anymore. In exceptional cases, when the
20 user is 100% sure nothing else is referencing the objects in the
21 collection, one can delete all objects and the collection at the
22 same time using the Delete() function.
23 
24 Collections can be iterated using an iterator object (see
25 TIterator). Depending on the concrete collection class there may be
26 some additional methods of iterating. See the respective classes.
27 
28 TCollection inherits from TObject since we want to be able to have
29 collections of collections.
30 
31 In a later release the collections may become templatized.
32 */
33 
34 #include "TCollection.h"
35 #include "Riostream.h"
36 #include "Varargs.h"
37 #include "TClass.h"
38 #include "TROOT.h"
39 #include "TBrowser.h"
40 #include "TObjectTable.h"
41 #include "TRegexp.h"
42 #include "TPRegexp.h"
43 #include "TVirtualMutex.h"
44 
46 
51 
54 
55 ////////////////////////////////////////////////////////////////////////////////
56 /// Add all objects from collection col to this collection.
57 
58 void TCollection::AddAll(const TCollection *col)
59 {
60  TIter next(col);
61  TObject *obj;
62 
63  while ((obj = next()))
64  Add(obj);
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// Add all arguments to the collection. The list of objects must be
69 /// terminated by 0, e.g.: l.AddVector(o1, o2, o3, o4, 0);
70 
72 {
73  va_list ap;
74  va_start(ap, va_(obj1));
75  TObject *obj;
76 
77  Add(va_(obj1));
78  while ((obj = va_arg(ap, TObject *)))
79  Add(obj);
80  va_end(ap);
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// Make sure all objects in this collection inherit from class cl.
85 
87 {
88  TObject *obj;
89  TIter next(this);
90  Bool_t error = kFALSE;
91 
92  if (!cl) {
93  Error("AssertClass", "class == 0");
94  return kTRUE;
95  }
96 
97  for (int i = 0; (obj = next()); i++)
98  if (!obj->InheritsFrom(cl)) {
99  Error("AssertClass", "element %d is not an instance of class %s (%s)",
100  i, cl->GetName(), obj->ClassName());
101  error = kTRUE;
102  }
103  return error;
104 }
105 
106 ////////////////////////////////////////////////////////////////////////////////
107 /// Browse this collection (called by TBrowser).
108 /// If b=0, there is no Browse call TObject::Browse(0) instead.
109 /// This means TObject::Inspect() will be invoked indirectly
110 
112 {
113  TIter next(this);
114  TObject *obj;
115 
116  if (b)
117  while ((obj = next())) b->Add(obj);
118  else
119  TObject::Browse(b);
120 }
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// Make a clone of an collection using the Streamer facility.
124 /// If newname is specified, this will be the name of the new collection.
125 
126 TObject *TCollection::Clone(const char *newname) const
127 {
128  TCollection *new_collection = (TCollection*)TObject::Clone(newname);
129  if (newname && strlen(newname)) new_collection->SetName(newname);
130  return new_collection;
131 }
132 
133 
134 ////////////////////////////////////////////////////////////////////////////////
135 /// Compare two TCollection objects. Returns 0 when equal, -1 when this is
136 /// smaller and +1 when bigger (like strcmp()).
137 
139 {
140  if (this == obj) return 0;
141  return fName.CompareTo(obj->GetName());
142 }
143 
144 ////////////////////////////////////////////////////////////////////////////////
145 /// Draw all objects in this collection.
146 
148 {
149  TIter next(this);
150  TObject *object;
151 
152  while ((object = next())) {
153  object->Draw(option);
154  }
155 }
156 
157 ////////////////////////////////////////////////////////////////////////////////
158 /// Dump all objects in this collection.
159 
160 void TCollection::Dump() const
161 {
162  TIter next(this);
163  TObject *object;
164 
165  while ((object = next())) {
166  object->Dump();
167  }
168 }
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// Find an object in this collection using its name. Requires a sequential
172 /// scan till the object has been found. Returns 0 if object with specified
173 /// name is not found.
174 
176 {
177  TIter next(this);
178  TObject *obj;
179 
180  while ((obj = next()))
181  if (!strcmp(name, obj->GetName())) return obj;
182  return 0;
183 }
184 
185 ////////////////////////////////////////////////////////////////////////////////
186 /// Find an object in this collection by name.
187 
189 {
190  return FindObject(name);
191 }
192 
193 ////////////////////////////////////////////////////////////////////////////////
194 /// Find an object in this collection using the object's IsEqual()
195 /// member function. Requires a sequential scan till the object has
196 /// been found. Returns 0 if object is not found.
197 /// Typically this function is overridden by a more efficient version
198 /// in concrete collection classes (e.g. THashTable).
199 
201 {
202  TIter next(this);
203  TObject *ob;
204 
205  while ((ob = next()))
206  if (ob->IsEqual(obj)) return ob;
207  return 0;
208 }
209 
210 ////////////////////////////////////////////////////////////////////////////////
211 /// Return name of this collection.
212 /// if no name, return the collection class name.
213 
214 const char *TCollection::GetName() const
215 {
216  if (fName.Length() > 0) return fName.Data();
217  return ClassName();
218 }
219 
220 ////////////////////////////////////////////////////////////////////////////////
221 /// Increase the collection's capacity by delta slots.
222 
224 {
225  if (delta < 0) {
226  Error("GrowBy", "delta < 0");
227  delta = Capacity();
228  }
229  return Capacity() + TMath::Range(2, kMaxInt - Capacity(), delta);
230 }
231 
232 ////////////////////////////////////////////////////////////////////////////////
233 /// Returns true if object is a null pointer.
234 
235 Bool_t TCollection::IsArgNull(const char *where, const TObject *obj) const
236 {
237  return obj ? kFALSE : (Error(where, "argument is a null pointer"), kTRUE);
238 }
239 
240 ////////////////////////////////////////////////////////////////////////////////
241 /// List (ls) all objects in this collection.
242 /// Wildcarding supported, eg option="xxx*" lists only objects
243 /// with names xxx*.
244 
245 void TCollection::ls(Option_t *option) const
246 {
248  std::cout <<"OBJ: " << IsA()->GetName() << "\t" << GetName() << "\t" << GetTitle() << " : "
249  << Int_t(TestBit(kCanDelete)) << std::endl;
250 
251  TRegexp re(option,kTRUE);
252  TIter next(this);
253  TObject *object;
254  char *star = 0;
255  if (option) star = (char*)strchr(option,'*');
256 
258  while ((object = next())) {
259  if (star) {
260  TString s = object->GetName();
261  if (s != option && s.Index(re) == kNPOS) continue;
262  }
263  object->ls(option);
264  }
266 }
267 
268 ////////////////////////////////////////////////////////////////////////////////
269 /// 'Notify' all objects in this collection.
271 {
272  Bool_t success = true;
273  for (auto obj : *this) success &= obj->Notify();
274  return success;
275 }
276 
277 ////////////////////////////////////////////////////////////////////////////////
278 /// Paint all objects in this collection.
279 
281 {
282  this->R__FOR_EACH(TObject,Paint)(option);
283 }
284 
285 ////////////////////////////////////////////////////////////////////////////////
286 /// Print the collection header.
287 
289 {
291  printf("Collection name='%s', class='%s', size=%d\n",
292  GetName(), ClassName(), GetSize());
293 }
294 
295 ////////////////////////////////////////////////////////////////////////////////
296 /// For given collection entry return the string that is used to
297 /// identify the object and, potentially, perform wildcard/regexp
298 /// filtering on.
299 
301 {
302  return entry->GetName();
303 }
304 
305 ////////////////////////////////////////////////////////////////////////////////
306 /// Print the collection entry.
307 
308 void TCollection::PrintCollectionEntry(TObject* entry, Option_t* option, Int_t recurse) const
309 {
310  TCollection* coll = dynamic_cast<TCollection*>(entry);
311  if (coll) {
312  coll->Print(option, recurse);
313  } else {
315  entry->Print(option);
316  }
317 }
318 
319 ////////////////////////////////////////////////////////////////////////////////
320 /// Default print for collections, calls Print(option, 1).
321 /// This will print the collection header and Print() methods of
322 /// all the collection entries.
323 ///
324 /// If you want to override Print() for a collection class, first
325 /// see if you can accomplish it by overriding the following protected
326 /// methods:
327 /// ~~~ {.cpp}
328 /// void PrintCollectionHeader(Option_t* option) const;
329 /// const char* GetCollectionEntryName(TObject* entry) const;
330 /// void PrintCollectionEntry(TObject* entry, Option_t* option, Int_t recurse) const;
331 /// ~~~
332 /// Otherwise override the `Print(Option_t *option, Int_t)`
333 /// variant. Remember to declare:
334 /// ~~~ {.cpp}
335 /// using TCollection::Print;
336 /// ~~~
337 /// somewhere close to the method declaration.
338 
339 void TCollection::Print(Option_t *option) const
340 {
341  Print(option, 1);
342 }
343 
344 ////////////////////////////////////////////////////////////////////////////////
345 /// Print the collection header and its elements.
346 ///
347 /// If recurse is non-zero, descend into printing of
348 /// collection-entries with recurse - 1.
349 /// This means, if recurse is negative, the recursion is infinite.
350 ///
351 /// Option is passed recursively.
352 
353 void TCollection::Print(Option_t *option, Int_t recurse) const
354 {
355  PrintCollectionHeader(option);
356 
357  if (recurse != 0)
358  {
359  TIter next(this);
360  TObject *object;
361 
363  while ((object = next())) {
364  PrintCollectionEntry(object, option, recurse - 1);
365  }
367  }
368 }
369 
370 ////////////////////////////////////////////////////////////////////////////////
371 /// Print the collection header and its elements that match the wildcard.
372 ///
373 /// If recurse is non-zero, descend into printing of
374 /// collection-entries with recurse - 1.
375 /// This means, if recurse is negative, the recursion is infinite.
376 ///
377 /// Option is passed recursively, but wildcard is only used on the
378 /// first level.
379 
380 void TCollection::Print(Option_t *option, const char* wildcard, Int_t recurse) const
381 {
382  PrintCollectionHeader(option);
383 
384  if (recurse != 0)
385  {
386  if (!wildcard) wildcard = "";
387  TRegexp re(wildcard, kTRUE);
388  Int_t nch = strlen(wildcard);
389  TIter next(this);
390  TObject *object;
391 
393  while ((object = next())) {
394  TString s = GetCollectionEntryName(object);
395  if (nch == 0 || s == wildcard || s.Index(re) != kNPOS) {
396  PrintCollectionEntry(object, option, recurse - 1);
397  }
398  }
400  }
401 }
402 
403 ////////////////////////////////////////////////////////////////////////////////
404 /// Print the collection header and its elements that match the regexp.
405 ///
406 /// If recurse is non-zero, descend into printing of
407 /// collection-entries with recurse - 1.
408 /// This means, if recurse is negative, the recursion is infinite.
409 ///
410 /// Option is passed recursively, but regexp is only used on the
411 /// first level.
412 
413 void TCollection::Print(Option_t *option, TPRegexp& regexp, Int_t recurse) const
414 {
415  PrintCollectionHeader(option);
416 
417  if (recurse != 0)
418  {
419  TIter next(this);
420  TObject *object;
421 
423  while ((object = next())) {
424  TString s = GetCollectionEntryName(object);
425  if (regexp.MatchB(s)) {
426  PrintCollectionEntry(object, option, recurse - 1);
427  }
428  }
430  }
431 }
432 
433 ////////////////////////////////////////////////////////////////////////////////
434 /// Remove object from this collection and recursively remove the object
435 /// from all other objects (and collections).
436 
438 {
439  if (!obj) return;
440 
441  // Scan list and remove obj in the list itself
442  while (Remove(obj))
443  ;
444 
445  // Scan again the list and invoke RecursiveRemove for all objects
446  TIter next(this);
447  TObject *object;
448 
449  while ((object = next())) {
450  if (object->TestBit(kNotDeleted)) object->RecursiveRemove(obj);
451  }
452 }
453 
454 ////////////////////////////////////////////////////////////////////////////////
455 /// Remove all objects in collection col from this collection.
456 
458 {
459  TIter next(col);
460  TObject *obj;
461 
462  while ((obj = next()))
463  Remove(obj);
464 }
465 
466 ////////////////////////////////////////////////////////////////////////////////
467 /// Stream all objects in the collection to or from the I/O buffer.
468 
469 void TCollection::Streamer(TBuffer &b)
470 {
471  Int_t nobjects;
472  TObject *obj;
473  UInt_t R__s, R__c;
474 
475  if (b.IsReading()) {
476  Version_t v = b.ReadVersion(&R__s, &R__c);
477  if (v > 2)
478  TObject::Streamer(b);
479  if (v > 1)
480  fName.Streamer(b);
481  b >> nobjects;
482  for (Int_t i = 0; i < nobjects; i++) {
483  b >> obj;
484  Add(obj);
485  }
486  b.CheckByteCount(R__s, R__c,TCollection::IsA());
487  } else {
488  R__c = b.WriteVersion(TCollection::IsA(), kTRUE);
489  TObject::Streamer(b);
490  fName.Streamer(b);
491  nobjects = GetSize();
492  b << nobjects;
493 
494  TIter next(this);
495 
496  while ((obj = next())) {
497  b << obj;
498  }
499  b.SetByteCount(R__c, kTRUE);
500  }
501 }
502 
503 ////////////////////////////////////////////////////////////////////////////////
504 /// Write all objects in this collection. By default all objects in
505 /// the collection are written individually (each object gets its
506 /// own key). Note, this is recursive, i.e. objects in collections
507 /// in the collection are also written individually. To write all
508 /// objects using a single key specify a name and set option to
509 /// TObject::kSingleKey (i.e. 1).
510 
511 Int_t TCollection::Write(const char *name, Int_t option, Int_t bsize) const
512 {
513  if ((option & kSingleKey)) {
514  return TObject::Write(name, option, bsize);
515  } else {
516  option &= ~kSingleKey;
517  Int_t nbytes = 0;
518  TIter next(this);
519  TObject *obj;
520  while ((obj = next())) {
521  nbytes += obj->Write(name, option, bsize);
522  }
523  return nbytes;
524  }
525 }
526 
527 ////////////////////////////////////////////////////////////////////////////////
528 /// Write all objects in this collection. By default all objects in
529 /// the collection are written individually (each object gets its
530 /// own key). Note, this is recursive, i.e. objects in collections
531 /// in the collection are also written individually. To write all
532 /// objects using a single key specify a name and set option to
533 /// TObject::kSingleKey (i.e. 1).
534 
536 {
537  return ((const TCollection*)this)->Write(name,option,bsize);
538 }
539 
540 ////////////////////////////////////////////////////////////////////////////////
541 /// Return the globally accessible collection.
542 
544 {
545  return fgCurrentCollection;
546 }
547 
548 ////////////////////////////////////////////////////////////////////////////////
549 /// Set this collection to be the globally accesible collection.
550 
552 {
553  fgCurrentCollection = this;
554 }
555 
556 ////////////////////////////////////////////////////////////////////////////////
557 /// Set up for garbage collection.
558 
560 {
561  R__LOCKGUARD2(gCollectionMutex);
562  if (!fgGarbageCollection) {
565  fgGarbageStack = 0;
566  }
567  fgGarbageStack++;
568 }
569 
570 ////////////////////////////////////////////////////////////////////////////////
571 /// Do the garbage collection.
572 
574 {
575  R__LOCKGUARD2(gCollectionMutex);
576  if (fgGarbageStack > 0) fgGarbageStack--;
582  }
583 }
584 
585 ////////////////////////////////////////////////////////////////////////////////
586 /// Add to the list of things to be cleaned up.
587 
589 {
590  {
591  R__LOCKGUARD2(gCollectionMutex);
592  if (fgGarbageCollection) {
593  if (!fgEmptyingGarbage) {
594  fgGarbageCollection->Add(obj);
595  return;
596  }
597  }
598  }
599  delete obj;
600 }
601 
602 ////////////////////////////////////////////////////////////////////////////////
603 /// Set whether this collection is the owner (enable==true)
604 /// of its content. If it is the owner of its contents,
605 /// these objects will be deleted whenever the collection itself
606 /// is delete. The objects might also be deleted or destructed when Clear
607 /// is called (depending on the collection).
608 
610 {
611  if (enable)
612  SetBit(kIsOwner);
613  else
615 }
616 
617 ////////////////////////////////////////////////////////////////////////////////
618 /// Copy a TIter. This involves allocating a new TIterator of the right
619 /// sub class and assigning it with the original.
620 
621 TIter::TIter(const TIter &iter)
622 {
623  if (iter.fIterator) {
624  fIterator = iter.GetCollection()->MakeIterator();
625  fIterator->operator=(*iter.fIterator);
626  } else
627  fIterator = 0;
628 }
629 
630 ////////////////////////////////////////////////////////////////////////////////
631 /// Assigning an TIter to another. This involves allocating a new TIterator
632 /// of the right sub class and assigning it with the original.
633 
635 {
636  if (this != &rhs) {
637  if (rhs.fIterator) {
638  delete fIterator;
639  fIterator = rhs.GetCollection()->MakeIterator();
640  fIterator->operator=(*rhs.fIterator);
641  }
642  }
643  return *this;
644 }
645 
646 ////////////////////////////////////////////////////////////////////////////////
647 /// Pointing to the first element of the container.
648 
650 {
651  fIterator->Reset();
652  fIterator->Next();
653  return *this;
654 }
655 
656 ////////////////////////////////////////////////////////////////////////////////
657 /// Pointing to the element after the last - to a nullptr value in our case.
658 
660 {
661  return TIter(static_cast<TIterator*>(nullptr));
662 }
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
Definition: TBrowser.cxx:261
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
Definition: TObject.cxx:778
virtual TObject * Remove(TObject *obj)=0
static Int_t fgGarbageStack
Definition: TCollection.h:48
Bool_t IsReading() const
Definition: TBuffer.h:81
object has not been deleted
Definition: TObject.h:71
static Int_t DecreaseDirLevel()
Decrease the indentation level for ls().
Definition: TROOT.cxx:2569
const TCollection * GetCollection() const
Definition: TCollection.h:154
Bool_t MatchB(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10)
Definition: TPRegexp.h:78
short Version_t
Definition: RtypesCore.h:61
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.
const Ssiz_t kNPOS
Definition: RtypesCore.h:115
Int_t Compare(const TObject *obj) const
Compare two TCollection objects.
TIter & Begin()
Pointing to the first element of the container.
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:159
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
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.
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Regular expression class.
Definition: TRegexp.h:31
This class implements a mutex interface.
Definition: TVirtualMutex.h:32
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:587
TVirtualMutex * gCollectionMutex
Definition: TCollection.cxx:45
Basic string class.
Definition: TString.h:129
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition: TObject.cxx:126
Short_t Range(Short_t lb, Short_t ub, Short_t x)
Definition: TMathBase.h:232
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Definition: TObject.cxx:202
static TCollection * fgCurrentCollection
Definition: TCollection.h:45
TString fName
Definition: TCollection.h:56
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition: TObject.cxx:543
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual TObject * Clone(const char *newname="") const
Make a clone of an collection using the Streamer facility.
Float_t delta
void Reset()
Definition: TCollection.h:156
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:687
if object in a list can be deleted
Definition: TObject.h:58
virtual void RecursiveRemove(TObject *obj)
Recursively remove this object from a list.
Definition: TObject.cxx:565
#define SafeDelete(p)
Definition: RConfig.h:499
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:135
TIterator * fIterator
Definition: TCollection.h:140
Int_t bsize[]
Definition: SparseFit4.cxx:31
void AddVector(TObject *obj1,...)
Add all arguments to the collection.
Definition: TCollection.cxx:71
#define va_(arg)
Definition: Varargs.h:41
virtual void PrintCollectionEntry(TObject *entry, Option_t *option, Int_t recurse) const
Print the collection entry.
virtual Bool_t IsEqual(const TObject *obj) const
Default equal comparison (objects are equal if they have the same address in memory).
Definition: TObject.cxx:476
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
TIter & operator=(const TIter &rhs)
Assigning an TIter to another.
virtual void RecursiveRemove(TObject *obj)
Remove object from this collection and recursively remove the object from all other objects (and coll...
virtual Int_t GrowBy(Int_t delta) const
Increase the collection&#39;s capacity by delta slots.
SVector< double, 2 > v
Definition: Dict.h:5
static TCollection * GetCurrentCollection()
Return the globally accessible collection.
virtual TIterator * MakeIterator(Bool_t dir=kIterForward) const =0
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:436
Collection abstract base class.
Definition: TCollection.h:42
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual void Paint(Option_t *option="")
Paint all objects in this collection.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:873
Ssiz_t Length() const
Definition: TString.h:388
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2632
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:71
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
static void StartGarbageCollection()
Set up for garbage collection.
This class registers all instances of TObject and its derived classes in a hash table.
Definition: TObjectTable.h:35
write collection with single key
Definition: TObject.h:78
virtual Bool_t Notify()
&#39;Notify&#39; all objects in this collection.
void SetName(const char *name)
Definition: TCollection.h:111
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:47
static TIter End()
Pointing to the element after the last - to a nullptr value in our case.
#define R__LOCKGUARD2(mutex)
const Bool_t kFALSE
Definition: RtypesCore.h:92
void RemoveAll()
Definition: TCollection.h:109
static void GarbageCollect(TObject *obj)
Add to the list of things to be cleaned up.
void Add(THist< DIMENSIONS, PRECISION_TO, STAT_TO... > &to, const THist< DIMENSIONS, PRECISION_FROM, STAT_FROM... > &from)
Add two histograms.
Definition: THist.hxx:336
#define ClassImp(name)
Definition: Rtypes.h:336
virtual void ls(Option_t *option="") const
List (ls) all objects in this collection.
void Add(TObject *obj)
Add an object to the object table.
static TObjectTable * fgGarbageCollection
Definition: TCollection.h:46
virtual void Dump() const
Dump contents of object on stdout.
Definition: TObject.cxx:273
void Browse(TBrowser *b)
Browse this collection (called by TBrowser).
virtual void Add(TObject *obj)=0
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
Compare a string to char *cs2.
Definition: TString.cxx:396
static void EmptyGarbageCollection()
Do the garbage collection.
Mother of all ROOT objects.
Definition: TObject.h:37
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
Definition: TObject.cxx:151
static Int_t IncreaseDirLevel()
Increase the indentation level for ls().
Definition: TROOT.cxx:2624
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:408
typedef void((*Func_t)())
virtual void PrintCollectionHeader(Option_t *option) const
Print the collection header.
Int_t Capacity() const
Definition: TCollection.h:74
const Int_t kMaxInt
Definition: RtypesCore.h:103
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.
Bool_t AssertClass(TClass *cl) const
Make sure all objects in this collection inherit from class cl.
Definition: TCollection.cxx:86
void ResetBit(UInt_t f)
Definition: TObject.h:158
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:364
virtual Int_t GetSize() const
Definition: TCollection.h:89
void Delete(Option_t *opt="")
Delete all objects stored in the TObjectTable.
TObject * operator()(const char *name) const
Find an object in this collection by name.
#define R__FOR_EACH(type, proc)
Definition: TCollection.h:196
const Bool_t kTRUE
Definition: RtypesCore.h:91
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write all objects in this collection.
virtual const char * GetName() const
Return name of this collection.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
const char * Data() const
Definition: TString.h:347