169 ::operator
delete(obj);
247 if (
this == &tc)
return *
this;
250 Error(
"operator=",
"cannot copy TClonesArray's when classes are different");
259 for (i = 0; i <
fSize; i++)
268 for (i = 0; i < tc.
fSize; i++) {
352 for ( ; j <
fSize; j++) {
403 obj->
Clear(clear_options);
423 const char *cplus = strstr(
option,
"+");
430 for (
Int_t i = 0; i <
n; i++) {
483 Error (
"Expand",
"newSize must be positive (%d)", newSize);
487 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
490 if (newSize ==
fSize)
492 if (newSize <
fSize) {
495 for (
int i = newSize; i <
fSize; i++)
517 Error(
"ExpandCreate",
"n must be positive (%d)",
n);
521 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
528 for (i = 0; i <
n; i++) {
538 for (i =
n; i <
fSize; i++)
565 for (i = 0; i <
n; i++) {
586 if (!
BoundsOk(
"RemoveAt", idx))
return nullptr;
610 if (!obj)
return nullptr;
614 if (i == -1)
return nullptr;
633 if (!
BoundsOk(
"RemoveRange", idx1))
return;
634 if (!
BoundsOk(
"RemoveRange", idx2))
return;
642 if (!(*obj)->IsDestructed()) {
651 if (idx1 < fLast || fLast > idx2)
return;
668 Error(
"SetClass",
"TClonesArray already initialized with another class");
674 Error(
"SetClass",
"called with a null pointer");
680 Error(
"SetClass",
"%s does not inherit from TObject", classname);
685 Error(
"SetClass",
"%s must inherit from TObject as the left most base class.", classname);
688 Int_t nch = strlen(classname)+2;
689 char *
name =
new char[nch];
729 Error(
"Sort",
"objects in array are not sortable");
758 const Int_t kOldBypassStreamer =
BIT(14);
771 s = s(pos+1, s.
Length()-pos-1);
776 Error(
"Streamer",
"expecting class %s but it was not found by TClass::GetClass\n",
784 nobjects = -nobjects;
813 for (
Int_t i = 0; i < nobjects; i++) {
823 if (clv < 8 && classv ==
"TF1") {
828 b.ReadClones(&temp, nobjects, clv);
832 }
else if (clv <= 8 && clv > 3 && clv != 6 && classv ==
"TFormula") {
837 b.ReadClones(&temp, nobjects, clv);
843 b.ReadClones(
this, nobjects, clv);
846 for (
Int_t i = 0; i < nobjects; i++) {
869 b.ForceWriteInfoClones(
this);
891 b.WriteClones(
this,nobjects);
893 for (
Int_t i = 0; i < nobjects; i++) {
904 b.SetByteCount(R__c,
kTRUE);
923 Error(
"operator[]",
"out of bounds at %d in %zx", idx, (
size_t)
this);
927 Error(
"operator[]",
"invalid class specified in TClonesArray ctor");
956 if (idx < 0 || idx >=
fSize) {
957 Error(
"operator[]",
"out of bounds at %d in %zx", idx, (
size_t)
this);
971 Error(
"New",
"out of bounds at %d in %zx", idx, (
size_t)
this);
975 Error(
"New",
"invalid class specified in TClonesArray ctor");
1010 Error(
"AbsorbObjects",
"cannot absorb objects when classes are different");
1015 Error(
"AbsorbObjects",
"range is not valid: idx1>idx2");
1019 Error(
"AbsorbObjects",
"range is not valid: idx2 out of bounds");
1029 Int_t newSize = oldSize + (idx2-idx1+1);
1034 for (
Int_t i = idx1; i <= idx2; i++) {
1035 Int_t newindex = oldSize+i -idx1;
1038 (*fKeep)[newindex] = (*(tc->
fKeep))[i];
1039 tc->
fCont[i] =
nullptr;
1040 (*(tc->
fKeep))[i] =
nullptr;
1046 (*(tc->
fKeep))[i-(idx2-idx1+1)] = (*(tc->
fKeep))[i];
1047 tc->
fCont[i] =
nullptr;
1048 (*(tc->
fKeep))[i] =
nullptr;
1069 Error(
"MultiSort",
"objects in array are not sortable");
1073 if (sortedCheck && i > 1) {
1082 for (
int i = 0; i < nTCs; i++) {
1083 if (tcs[i] ==
this) {
1084 Error(
"MultiSort",
"tcs[%d] = \"this\"", i);
1088 Error(
"MultiSort",
"tcs[%d] has length %d != length of this (%d)",
1096 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)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
R__EXTERN TObjectTable * gObjectTable
TClonesArrayOwnershipRAII(TClonesArray *arr)
TClonesArray * fClonesArray
~TClonesArrayOwnershipRAII()
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.
Collection abstract base class.
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
void SetName(const char *name)
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
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.