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