169 ::operator
delete(obj);
236 if (
this == &tc)
return *
this;
239 Error(
"operator=",
"cannot copy TClonesArray's when classes are different");
248 for (i = 0; i <
fSize; i++)
257 for (i = 0; i < tc.
fSize; i++) {
341 for ( ; j <
fSize; j++) {
392 obj->
Clear(clear_options);
412 const char *cplus = strstr(
option,
"+");
419 for (
Int_t i = 0; i <
n; i++) {
472 Error (
"Expand",
"newSize must be positive (%d)", newSize);
476 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
479 if (newSize ==
fSize)
481 if (newSize <
fSize) {
484 for (
int i = newSize; i <
fSize; i++)
506 Error(
"ExpandCreate",
"n must be positive (%d)",
n);
510 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
517 for (i = 0; i <
n; i++) {
527 for (i =
n; i <
fSize; i++)
554 for (i = 0; i <
n; i++) {
575 if (!
BoundsOk(
"RemoveAt", idx))
return nullptr;
599 if (!obj)
return nullptr;
603 if (i == -1)
return nullptr;
622 if (!
BoundsOk(
"RemoveRange", idx1))
return;
623 if (!
BoundsOk(
"RemoveRange", idx2))
return;
631 if (!(*obj)->IsDestructed()) {
640 if (idx1 < fLast || fLast > idx2)
return;
657 Error(
"SetClass",
"TClonesArray already initialized with another class");
663 Error(
"SetClass",
"called with a null pointer");
669 Error(
"SetClass",
"%s does not inherit from TObject", classname);
674 Error(
"SetClass",
"%s must inherit from TObject as the left most base class.", classname);
677 Int_t nch = strlen(classname)+2;
678 char *
name =
new char[nch];
718 Error(
"Sort",
"objects in array are not sortable");
747 const Int_t kOldBypassStreamer =
BIT(14);
760 s = s(pos+1, s.
Length()-pos-1);
765 Error(
"Streamer",
"expecting class %s but it was not found by TClass::GetClass\n",
773 nobjects = -nobjects;
802 for (
Int_t i = 0; i < nobjects; i++) {
812 if (clv < 8 && classv ==
"TF1") {
817 b.ReadClones(&temp, nobjects, clv);
821 }
else if (clv <= 8 && clv > 3 && clv != 6 && classv ==
"TFormula") {
826 b.ReadClones(&temp, nobjects, clv);
832 b.ReadClones(
this, nobjects, clv);
835 for (
Int_t i = 0; i < nobjects; i++) {
858 b.ForceWriteInfoClones(
this);
880 b.WriteClones(
this,nobjects);
882 for (
Int_t i = 0; i < nobjects; i++) {
893 b.SetByteCount(R__c,
kTRUE);
912 Error(
"operator[]",
"out of bounds at %d in %zx", idx, (
size_t)
this);
916 Error(
"operator[]",
"invalid class specified in TClonesArray ctor");
945 if (idx < 0 || idx >=
fSize) {
946 Error(
"operator[]",
"out of bounds at %d in %zx", idx, (
size_t)
this);
960 Error(
"New",
"out of bounds at %d in %zx", idx, (
size_t)
this);
964 Error(
"New",
"invalid class specified in TClonesArray ctor");
999 Error(
"AbsorbObjects",
"cannot absorb objects when classes are different");
1004 Error(
"AbsorbObjects",
"range is not valid: idx1>idx2");
1008 Error(
"AbsorbObjects",
"range is not valid: idx2 out of bounds");
1018 Int_t newSize = oldSize + (idx2-idx1+1);
1023 for (
Int_t i = idx1; i <= idx2; i++) {
1024 Int_t newindex = oldSize+i -idx1;
1027 (*fKeep)[newindex] = (*(tc->
fKeep))[i];
1028 tc->
fCont[i] =
nullptr;
1029 (*(tc->
fKeep))[i] =
nullptr;
1035 (*(tc->
fKeep))[i-(idx2-idx1+1)] = (*(tc->
fKeep))[i];
1036 tc->
fCont[i] =
nullptr;
1037 (*(tc->
fKeep))[i] =
nullptr;
1058 Error(
"MultiSort",
"objects in array are not sortable");
1062 if (sortedCheck && i > 1) {
1071 for (
int i = 0; i < nTCs; i++) {
1072 if (tcs[i] ==
this) {
1073 Error(
"MultiSort",
"tcs[%d] = \"this\"", i);
1077 Error(
"MultiSort",
"tcs[%d] has length %d != length of this (%d)",
1085 for (
int i = 0; i < nTCs; i++) {
void(*)(Int_t nobjects, TObject **from, TObject **to) Updater_t
Updater_t gClonesArrayTFormulaUpdater
Updater_t gClonesArrayTF1Updater
static void R__ReleaseMemory(TClass *cl, TObject *obj)
Internal Utility routine to correctly release the memory for an object.
bool R__SetClonesArrayTFormulaUpdater(Updater_t func)
bool R__SetClonesArrayTF1Updater(Updater_t func)
R__EXTERN TObjectTable * gObjectTable
Buffer base class used for serializing objects.
@ kCannotHandleMemberWiseStreaming
TClass instances represent classes, structs and namespaces in the ROOT type system.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Int_t Size() const
Return size of object of this class.
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Int_t GetBaseClassOffset(const TClass *toBase, void *address=nullptr, bool isDerivedObject=true)
Version_t GetClassVersion() const
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.
An array of clone (identical) objects.
TObjArray * fKeep
Pointer to the class of the elements.
TObject *& operator[](Int_t idx) override
Return pointer to reserved area in which a new object of clones class can be constructed.
TClass * IsA() const override
void BypassStreamer(Bool_t bypass=kTRUE)
When the kBypassStreamer bit is set, the automatically generated Streamer can call directly TClass::W...
virtual ~TClonesArray()
Delete a clones array.
void AbsorbObjects(TClonesArray *tc)
Directly move the object pointers from tc without cloning (copying).
virtual void ExpandCreateFast(Int_t n)
Expand or shrink the array to n elements and create the clone objects by calling their default ctor.
void Expand(Int_t newSize) override
Expand or shrink the array to newSize elements.
TObject * RemoveAt(Int_t idx) override
Remove object at index idx.
void SetClass(const char *classname, Int_t size=1000)
see TClonesArray::SetClass(const TClass*)
Bool_t CanBypassStreamer() const
void Clear(Option_t *option="") override
Clear the clones array.
void Delete(Option_t *option="") override
Clear the clones array.
TClonesArray & operator=(const TClonesArray &tc)
Assignment operator.
void Sort(Int_t upto=kMaxInt) override
If objects in array are sortable (i.e.
void Streamer(TBuffer &) override
Write all objects in array to the I/O buffer.
void RemoveRange(Int_t idx1, Int_t idx2) override
Remove objects from index idx1 to idx2 included.
TObject * ConstructedAt(Int_t idx)
Get an object at index 'idx' that is guaranteed to have been constructed.
virtual void ExpandCreate(Int_t n)
Expand or shrink the array to n elements and create the clone objects by calling their default ctor.
TClonesArray()
Default Constructor.
void Compress() override
Remove empty slots from array.
void SetOwner(Bool_t enable=kTRUE) override
A TClonesArray is always the owner of the object it contains.
TObject * New(Int_t idx)
Create an object of type fClass with the default ctor at the specified index.
TObject * Remove(TObject *obj) override
Remove object from array.
void MultiSort(Int_t nTCs, TClonesArray **tcs, Int_t upto=kMaxInt)
Sort multiple TClonesArrays simultaneously with this array.
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
void SetName(const char *name)
Bool_t IsSortable() const override
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
const char * GetName() const override
Returns name of object.
Int_t GetEntriesFast() const
Int_t IndexOf(const TObject *obj) const override
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
TObject ** GetObjectRef() const
TObject * Last() const override
Return the object in the last filled slot. Returns 0 if no entries.
void Clear(Option_t *option="") override
Remove all objects from the array.
Bool_t BoundsOk(const char *where, Int_t at) const
TObject * UncheckedAt(Int_t i) const
TObject * First() const override
Return the object in the first slot.
Int_t fLowerBound
Array contents.
Int_t GetAbsLast() const
Return absolute index to last object in array.
void RemoveQuietly(TObject *obj)
Remove an object from the object table.
Mother of all ROOT objects.
virtual void Clear(Option_t *="")
Bool_t IsDestructed() const
IsDestructed.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
UInt_t fBits
bit field status word
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
static Bool_t GetObjectStat()
Get status of object stat flag.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
virtual Int_t Compare(const TObject *obj) const
Compare abstract method.
virtual ~TObject()
TObject destructor.
@ kHasUUID
if object has a TUUID (its fUniqueID=UUIDNumber)
@ kIsReferenced
if object is referenced by a TRef or TRefArray
virtual Bool_t IsSorted() const
static void QSort(TObject **a, Int_t first, Int_t last)
Sort array of TObject pointers using a quicksort algorithm.
static Int_t ObjCompare(TObject *a, TObject *b)
Compare to objects in the collection. Use member Compare() of object a.
static void * ObjectAlloc(size_t size)
Used to allocate a TObject on the heap (via TObject::operator new()).
Int_t Atoi() const
Return integer value of string.
const char * Data() const
virtual void Streamer(TBuffer &)
Stream a string object.
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.