149 ::operator
delete(obj);
216 if (
this == &tc)
return *
this;
219 Error(
"operator=",
"cannot copy TClonesArray's when classes are different");
228 for (i = 0; i <
fSize; i++)
237 for (i = 0; i < tc.
fSize; i++) {
321 for ( ; j <
fSize; j++) {
372 obj->
Clear(clear_options);
391 if (option && option[0] ==
'C') {
392 const char *cplus = strstr(option,
"+");
399 for (
Int_t i = 0; i <
n; i++) {
451 Error (
"Expand",
"newSize must be positive (%d)", newSize);
454 if (newSize ==
fSize)
456 if (newSize <
fSize) {
459 for (
int i = newSize; i <
fSize; i++)
481 Error(
"ExpandCreate",
"n must be positive (%d)", n);
488 for (i = 0; i <
n; i++) {
498 for (i = n; i <
fSize; i++)
525 for (i = 0; i <
n; i++) {
546 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
574 if (i == -1)
return 0;
593 if (!
BoundsOk(
"RemoveRange", idx1))
return;
594 if (!
BoundsOk(
"RemoveRange", idx2))
return;
611 if (idx1 < fLast || fLast > idx2)
return;
628 Error(
"SetClass",
"TClonesArray already initialized with another class");
634 Error(
"SetClass",
"called with a null pointer");
640 Error(
"SetClass",
"%s does not inherit from TObject", classname);
645 Error(
"SetClass",
"%s must inherit from TObject as the left most base class.", classname);
648 Int_t nch = strlen(classname)+2;
649 char *
name =
new char[nch];
650 snprintf(name,nch,
"%ss", classname);
685 if (nentries <= 0 ||
fSorted)
return;
689 Error(
"Sort",
"objects in array are not sortable");
705 void TClonesArray::Streamer(
TBuffer &
b)
718 const Int_t kOldBypassStreamer =
BIT(14);
722 TObject::Streamer(b);
731 s = s(pos+1, s.
Length()-pos-1);
736 printf(
"TClonesArray::Streamer expecting class %s\n", classv.
Data());
743 nobjects = -nobjects;
769 for (
Int_t i = 0; i < nobjects; i++) {
783 for (
Int_t i = 0; i < nobjects; i++) {
820 TObject::Streamer(b);
830 for (
Int_t i = 0; i < nobjects; i++) {
860 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
864 Error(
"operator[]",
"invalid class specified in TClonesArray ctor");
893 if (idx < 0 || idx >=
fSize) {
894 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
908 Error(
"New",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
912 Error(
"New",
"invalid class specified in TClonesArray ctor");
947 Error(
"AbsorbObjects",
"cannot absorb objects when classes are different");
952 Error(
"AbsorbObjects",
"range is not valid: idx1>idx2");
956 Error(
"AbsorbObjects",
"range is not valid: idx2 out of bounds");
966 Int_t newSize = oldSize + (idx2-idx1+1);
971 for (
Int_t i = idx1; i <= idx2; i++) {
972 Int_t newindex = oldSize+i -idx1;
975 (*fKeep)[newindex] = (*(tc->
fKeep))[i];
977 (*(tc->
fKeep))[i] = 0;
983 (*(tc->
fKeep))[i-(idx2-idx1+1)] = (*(tc->
fKeep))[i];
985 (*(tc->
fKeep))[i] = 0;
1001 if (nentries <= 1 ||
fSorted)
return;
1006 Error(
"MultiSort",
"objects in array are not sortable");
1010 if (sortedCheck && i > 1) {
1019 for (
int i = 0; i < nTCs; i++) {
1020 if (tcs[i] ==
this) {
1021 Error(
"MultiSort",
"tcs[%d] = \"this\"", i);
1025 Error(
"MultiSort",
"tcs[%d] has length %d != length of this (%d)",
1033 for (
int i = 0; i < nTCs; i++) {
1034 b[2*i] = tcs[i]->
fCont;
virtual void Clear(Option_t *="")
virtual const char * GetName() const
Returns name of object.
object has not been deleted
TObjArray(Int_t s=TCollection::kInitCapacity, Int_t lowerBound=0)
Create an object array.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
void MultiSort(Int_t nTCs, TClonesArray **tcs, Int_t upto=kMaxInt)
Sort multiple TClonesArrays simultaneously with this array.
void AbsorbObjects(TClonesArray *tc)
Directly move the object pointers from tc without cloning (copying).
Bool_t TestBit(UInt_t f) const
virtual Int_t ReadClones(TClonesArray *a, Int_t nobjects, Version_t objvers)=0
Buffer base class used for serializing objects.
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
void RemoveQuietly(TObject *obj)
Remove an object from the object table.
static void * ObjectAlloc(size_t size)
Used to allocate a TObject on the heap (via TObject::operator new()).
Short_t Min(Short_t a, Short_t b)
virtual Bool_t IsSorted() const
Bool_t CanBypassStreamer() const
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
virtual Int_t WriteClones(TClonesArray *a, Int_t nobjects)=0
virtual void RemoveRange(Int_t idx1, Int_t idx2)
Remove objects from index idx1 to idx2 included.
void BypassStreamer(Bool_t bypass=kTRUE)
When the kBypassStreamer bit is set, the automatically generated Streamer can call directly TClass::W...
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
virtual void SetOwner(Bool_t enable=kTRUE)
A TClonesArray is always the owner of the object it contains.
TObject * ConstructedAt(Int_t idx)
Get an object at index 'idx' that is guaranteed to have been constructed.
TClonesArray()
Default Constructor.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual void Clear(Option_t *option="")
Clear the clones array.
TObject * First() const
Return the object in the first slot.
void SetClass(const char *classname, Int_t size=1000)
see TClonesArray::SetClass(const TClass*)
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
virtual void Delete(Option_t *option="")
Clear the clones array.
if object has a TUUID (its fUniqueID=UUIDNumber)
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Int_t GetEntriesFast() const
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Int_t Size() const
Return size of object of this class.
The ROOT global object gROOT contains a list of all defined classes.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
void SetName(const char *name)
static Bool_t GetObjectStat()
Get status of object stat flag.
static void QSort(TObject **a, Int_t first, Int_t last)
Sort array of TObject pointers using a quicksort algorithm.
R__EXTERN TObjectTable * gObjectTable
virtual void StreamObject(void *obj, const std::type_info &typeinfo, const TClass *onFileClass=0)=0
Int_t fLowerBound
Array contents.
UInt_t fBits
bit field status word
Bool_t BoundsOk(const char *where, Int_t at) const
Int_t GetAbsLast() const
Return absolute index to last object in array.
Version_t GetClassVersion() const
TObject * UncheckedAt(Int_t i) const
Int_t IndexOf(const TObject *obj) const
virtual ~TObject()
TObject destructor.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
TClonesArray & operator=(const TClonesArray &tc)
Assignment operator.
static void R__ReleaseMemory(TClass *cl, TObject *obj)
Internal Utility routine to correctly release the memory for an object.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Mother of all ROOT objects.
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual void ForceWriteInfoClones(TClonesArray *a)=0
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
An array of clone (identical) objects.
virtual void ExpandCreateFast(Int_t n)
Expand or shrink the array to n elements and create the clone objects by calling their default ctor...
virtual void Sort(Int_t upto=kMaxInt)
If objects in array are sortable (i.e.
Short_t Max(Short_t a, Short_t b)
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
if object is referenced by a TRef or TRefArray
Int_t Atoi() const
Return integer value of string.
TObject *& operator[](Int_t idx)
Return pointer to reserved area in which a new object of clones class can be constructed.
Bool_t IsSortable() const
virtual Int_t GetSize() const
static Int_t ObjCompare(TObject *a, TObject *b)
Compare to objects in the collection. Use member Compare() of object a.
TObject * New(Int_t idx)
Create an object of type fClass with the default ctor at the specified index.
virtual TObject * Remove(TObject *obj)
Remove object from array.
virtual void ExpandCreate(Int_t n)
Expand or shrink the array to n elements and create the clone objects by calling their default ctor...
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
virtual void Compress()
Remove empty slots from array.
virtual ~TClonesArray()
Delete a clones array.
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TObjArray * fKeep
Pointer to the class of the elements.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
const char * Data() const