ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
45 TVirtualMutex *gCollectionMutex = 0;
46 
47 TCollection *TCollection::fgCurrentCollection = 0;
48 TObjectTable *TCollection::fgGarbageCollection = 0;
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 /// Paint all objects in this collection.
270 
272 {
273  this->R__FOR_EACH(TObject,Paint)(option);
274 }
275 
276 ////////////////////////////////////////////////////////////////////////////////
277 /// Print the collection header.
278 
280 {
282  printf("Collection name='%s', class='%s', size=%d\n",
283  GetName(), ClassName(), GetSize());
284 }
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// For given collection entry return the string that is used to
288 /// identify the object and, potentially, perform wildcard/regexp
289 /// filtering on.
290 
292 {
293  return entry->GetName();
294 }
295 
296 ////////////////////////////////////////////////////////////////////////////////
297 /// Print the collection entry.
298 
300 {
301  TCollection* coll = dynamic_cast<TCollection*>(entry);
302  if (coll) {
303  coll->Print(option, recurse);
304  } else {
306  entry->Print(option);
307  }
308 }
309 
310 ////////////////////////////////////////////////////////////////////////////////
311 /// Default print for collections, calls Print(option, 1).
312 /// This will print the collection header and Print() methods of
313 /// all the collection entries.
314 ///
315 /// If you want to override Print() for a collection class, first
316 /// see if you can accomplish it by overriding the following protected
317 /// methods:
318 /// ~~~ {.cpp}
319 /// void PrintCollectionHeader(Option_t* option) const;
320 /// const char* GetCollectionEntryName(TObject* entry) const;
321 /// void PrintCollectionEntry(TObject* entry, Option_t* option, Int_t recurse) const;
322 /// ~~~
323 /// Otherwise override the `Print(Option_t *option, Int_t)`
324 /// variant. Remember to declare:
325 /// ~~~ {.cpp]
326 /// using TCollection::Print;
327 /// ~~~
328 /// somewhere close to the method declaration.
329 
330 void TCollection::Print(Option_t *option) const
331 {
332  Print(option, 1);
333 }
334 
335 ////////////////////////////////////////////////////////////////////////////////
336 /// Print the collection header and its elements.
337 ///
338 /// If recurse is non-zero, descend into printing of
339 /// collection-entries with recurse - 1.
340 /// This means, if recurse is negative, the recursion is infinite.
341 ///
342 /// Option is passed recursively.
343 
344 void TCollection::Print(Option_t *option, Int_t recurse) const
345 {
346  PrintCollectionHeader(option);
347 
348  if (recurse != 0)
349  {
350  TIter next(this);
351  TObject *object;
352 
354  while ((object = next())) {
355  PrintCollectionEntry(object, option, recurse - 1);
356  }
358  }
359 }
360 
361 ////////////////////////////////////////////////////////////////////////////////
362 /// Print the collection header and its elements that match the wildcard.
363 ///
364 /// If recurse is non-zero, descend into printing of
365 /// collection-entries with recurse - 1.
366 /// This means, if recurse is negative, the recursion is infinite.
367 ///
368 /// Option is passed recursively, but wildcard is only used on the
369 /// first level.
370 
371 void TCollection::Print(Option_t *option, const char* wildcard, Int_t recurse) const
372 {
373  PrintCollectionHeader(option);
374 
375  if (recurse != 0)
376  {
377  if (!wildcard) wildcard = "";
378  TRegexp re(wildcard, kTRUE);
379  Int_t nch = strlen(wildcard);
380  TIter next(this);
381  TObject *object;
382 
384  while ((object = next())) {
385  TString s = GetCollectionEntryName(object);
386  if (nch == 0 || s == wildcard || s.Index(re) != kNPOS) {
387  PrintCollectionEntry(object, option, recurse - 1);
388  }
389  }
391  }
392 }
393 
394 ////////////////////////////////////////////////////////////////////////////////
395 /// Print the collection header and its elements that match the regexp.
396 ///
397 /// If recurse is non-zero, descend into printing of
398 /// collection-entries with recurse - 1.
399 /// This means, if recurse is negative, the recursion is infinite.
400 ///
401 /// Option is passed recursively, but regexp is only used on the
402 /// first level.
403 
404 void TCollection::Print(Option_t *option, TPRegexp& regexp, Int_t recurse) const
405 {
406  PrintCollectionHeader(option);
407 
408  if (recurse != 0)
409  {
410  TIter next(this);
411  TObject *object;
412 
414  while ((object = next())) {
415  TString s = GetCollectionEntryName(object);
416  if (regexp.MatchB(s)) {
417  PrintCollectionEntry(object, option, recurse - 1);
418  }
419  }
421  }
422 }
423 
424 ////////////////////////////////////////////////////////////////////////////////
425 /// Remove object from this collection and recursively remove the object
426 /// from all other objects (and collections).
427 
429 {
430  if (!obj) return;
431 
432  // Scan list and remove obj in the list itself
433  while (Remove(obj))
434  ;
435 
436  // Scan again the list and invoke RecursiveRemove for all objects
437  TIter next(this);
438  TObject *object;
439 
440  while ((object = next())) {
441  if (object->TestBit(kNotDeleted)) object->RecursiveRemove(obj);
442  }
443 }
444 
445 ////////////////////////////////////////////////////////////////////////////////
446 /// Remove all objects in collection col from this collection.
447 
449 {
450  TIter next(col);
451  TObject *obj;
452 
453  while ((obj = next()))
454  Remove(obj);
455 }
456 
457 ////////////////////////////////////////////////////////////////////////////////
458 /// Stream all objects in the collection to or from the I/O buffer.
459 
460 void TCollection::Streamer(TBuffer &b)
461 {
462  Int_t nobjects;
463  TObject *obj;
464  UInt_t R__s, R__c;
465 
466  if (b.IsReading()) {
467  Version_t v = b.ReadVersion(&R__s, &R__c);
468  if (v > 2)
469  TObject::Streamer(b);
470  if (v > 1)
471  fName.Streamer(b);
472  b >> nobjects;
473  for (Int_t i = 0; i < nobjects; i++) {
474  b >> obj;
475  Add(obj);
476  }
477  b.CheckByteCount(R__s, R__c,TCollection::IsA());
478  } else {
479  R__c = b.WriteVersion(TCollection::IsA(), kTRUE);
480  TObject::Streamer(b);
481  fName.Streamer(b);
482  nobjects = GetSize();
483  b << nobjects;
484 
485  TIter next(this);
486 
487  while ((obj = next())) {
488  b << obj;
489  }
490  b.SetByteCount(R__c, kTRUE);
491  }
492 }
493 
494 ////////////////////////////////////////////////////////////////////////////////
495 /// Write all objects in this collection. By default all objects in
496 /// the collection are written individually (each object gets its
497 /// own key). Note, this is recursive, i.e. objects in collections
498 /// in the collection are also written individually. To write all
499 /// objects using a single key specify a name and set option to
500 /// TObject::kSingleKey (i.e. 1).
501 
502 Int_t TCollection::Write(const char *name, Int_t option, Int_t bsize) const
503 {
504  if ((option & kSingleKey)) {
505  return TObject::Write(name, option, bsize);
506  } else {
507  option &= ~kSingleKey;
508  Int_t nbytes = 0;
509  TIter next(this);
510  TObject *obj;
511  while ((obj = next())) {
512  nbytes += obj->Write(name, option, bsize);
513  }
514  return nbytes;
515  }
516 }
517 
518 ////////////////////////////////////////////////////////////////////////////////
519 /// Write all objects in this collection. By default all objects in
520 /// the collection are written individually (each object gets its
521 /// own key). Note, this is recursive, i.e. objects in collections
522 /// in the collection are also written individually. To write all
523 /// objects using a single key specify a name and set option to
524 /// TObject::kSingleKey (i.e. 1).
525 
527 {
528  return ((const TCollection*)this)->Write(name,option,bsize);
529 }
530 
531 ////////////////////////////////////////////////////////////////////////////////
532 /// Return the globally accessible collection.
533 
535 {
536  return fgCurrentCollection;
537 }
538 
539 ////////////////////////////////////////////////////////////////////////////////
540 /// Set this collection to be the globally accesible collection.
541 
543 {
544  fgCurrentCollection = this;
545 }
546 
547 ////////////////////////////////////////////////////////////////////////////////
548 /// Set up for garbage collection.
549 
551 {
552  R__LOCKGUARD2(gCollectionMutex);
553  if (!fgGarbageCollection) {
556  fgGarbageStack = 0;
557  }
558  fgGarbageStack++;
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 /// Do the garbage collection.
563 
565 {
566  R__LOCKGUARD2(gCollectionMutex);
567  if (fgGarbageStack > 0) fgGarbageStack--;
573  }
574 }
575 
576 ////////////////////////////////////////////////////////////////////////////////
577 /// Add to the list of things to be cleaned up.
578 
580 {
581  {
582  R__LOCKGUARD2(gCollectionMutex);
583  if (fgGarbageCollection) {
584  if (!fgEmptyingGarbage) {
585  fgGarbageCollection->Add(obj);
586  return;
587  }
588  }
589  }
590  delete obj;
591 }
592 
593 ////////////////////////////////////////////////////////////////////////////////
594 /// Set whether this collection is the owner (enable==true)
595 /// of its content. If it is the owner of its contents,
596 /// these objects will be deleted whenever the collection itself
597 /// is delete. The objects might also be deleted or destructed when Clear
598 /// is called (depending on the collection).
599 
601 {
602  if (enable)
603  SetBit(kIsOwner);
604  else
606 }
607 
608 ////////////////////////////////////////////////////////////////////////////////
609 /// Copy a TIter. This involves allocating a new TIterator of the right
610 /// sub class and assigning it with the original.
611 
613 {
614  if (iter.fIterator) {
616  fIterator->operator=(*iter.fIterator);
617  } else
618  fIterator = 0;
619 }
620 
621 ////////////////////////////////////////////////////////////////////////////////
622 /// Assigning an TIter to another. This involves allocating a new TIterator
623 /// of the right sub class and assigning it with the original.
624 
626 {
627  if (this != &rhs) {
628  if (rhs.fIterator) {
629  delete fIterator;
631  fIterator->operator=(*rhs.fIterator);
632  }
633  }
634  return *this;
635 }
636 
637 ////////////////////////////////////////////////////////////////////////////////
638 /// Pointing to the first element of the container.
639 
641 {
642  fIterator->Reset();
643  fIterator->Next();
644  return *this;
645 }
646 
647 ////////////////////////////////////////////////////////////////////////////////
648 /// Pointing to the element after the last - to a nullptr value in our case.
649 
651 {
652  return TIter(static_cast<TIterator*>(nullptr));
653 }
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:2430
virtual void Reset()=0
virtual const char * GetName() const
Return name of this collection.
Bool_t IsReading() const
Definition: TBuffer.h:83
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.
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.
Definition: TMatrixT.cxx:2925
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.
void regexp()
Definition: regexp.C:34
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:86
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
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:52
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:71
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:2493
const Ssiz_t kNPOS
Definition: Rtypes.h:115
tuple obj1
Definition: fildir.py:72
virtual TObject * Next()=0
static void IndentLevel()
Functions used by ls() to indent an object hierarchy.
Definition: TROOT.cxx:2501
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:372
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