168 ::operator
delete(obj);
235 if (
this == &tc)
return *
this;
238 Error(
"operator=",
"cannot copy TClonesArray's when classes are different");
247 for (i = 0; i <
fSize; i++)
256 for (i = 0; i < tc.
fSize; i++) {
340 for ( ; j <
fSize; j++) {
391 obj->
Clear(clear_options);
410 if (option && option[0] ==
'C') {
411 const char *cplus = strstr(option,
"+");
418 for (
Int_t i = 0; i <
n; i++) {
470 Error (
"Expand",
"newSize must be positive (%d)", newSize);
474 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
477 if (newSize ==
fSize)
479 if (newSize <
fSize) {
482 for (
int i = newSize; i <
fSize; i++)
504 Error(
"ExpandCreate",
"n must be positive (%d)",
n);
508 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
515 for (i = 0; i <
n; i++) {
525 for (i =
n; i <
fSize; i++)
552 for (i = 0; i <
n; i++) {
573 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
601 if (i == -1)
return 0;
620 if (!
BoundsOk(
"RemoveRange", idx1))
return;
621 if (!
BoundsOk(
"RemoveRange", idx2))
return;
638 if (idx1 < fLast || fLast > idx2)
return;
655 Error(
"SetClass",
"TClonesArray already initialized with another class");
661 Error(
"SetClass",
"called with a null pointer");
667 Error(
"SetClass",
"%s does not inherit from TObject", classname);
672 Error(
"SetClass",
"%s must inherit from TObject as the left most base class.", classname);
675 Int_t nch = strlen(classname)+2;
676 char *
name =
new char[nch];
716 Error(
"Sort",
"objects in array are not sortable");
732void TClonesArray::Streamer(
TBuffer &
b)
745 const Int_t kOldBypassStreamer =
BIT(14);
749 TObject::Streamer(
b);
758 s =
s(pos+1,
s.Length()-pos-1);
763 Error(
"Streamer",
"expecting class %s but it was not found by TClass::GetClass\n",
765 b.CheckByteCount(R__s, R__c,TClonesArray::IsA());
771 nobjects = -nobjects;
800 for (
Int_t i = 0; i < nobjects; i++) {
810 if (clv < 8 && classv ==
"TF1") {
814 temp.ExpandCreate(nobjects);
815 b.ReadClones(&temp, nobjects, clv);
819 }
else if (clv <= 8 && clv > 3 && clv != 6 && classv ==
"TFormula") {
823 temp.ExpandCreate(nobjects);
824 b.ReadClones(&temp, nobjects, clv);
830 b.ReadClones(
this, nobjects, clv);
833 for (
Int_t i = 0; i < nobjects; i++) {
850 b.CheckByteCount(R__s, R__c,TClonesArray::IsA());
856 b.ForceWriteInfoClones(
this);
869 R__c =
b.WriteVersion(TClonesArray::IsA(),
kTRUE);
870 TObject::Streamer(
b);
878 b.WriteClones(
this,nobjects);
880 for (
Int_t i = 0; i < nobjects; i++) {
891 b.SetByteCount(R__c,
kTRUE);
910 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
914 Error(
"operator[]",
"invalid class specified in TClonesArray ctor");
943 if (idx < 0 || idx >=
fSize) {
944 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
958 Error(
"New",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
962 Error(
"New",
"invalid class specified in TClonesArray ctor");
997 Error(
"AbsorbObjects",
"cannot absorb objects when classes are different");
1002 Error(
"AbsorbObjects",
"range is not valid: idx1>idx2");
1006 Error(
"AbsorbObjects",
"range is not valid: idx2 out of bounds");
1016 Int_t newSize = oldSize + (idx2-idx1+1);
1021 for (
Int_t i = idx1; i <= idx2; i++) {
1022 Int_t newindex = oldSize+i -idx1;
1025 (*fKeep)[newindex] = (*(tc->
fKeep))[i];
1027 (*(tc->
fKeep))[i] = 0;
1033 (*(tc->
fKeep))[i-(idx2-idx1+1)] = (*(tc->
fKeep))[i];
1035 (*(tc->
fKeep))[i] = 0;
1056 Error(
"MultiSort",
"objects in array are not sortable");
1060 if (sortedCheck && i > 1) {
1069 for (
int i = 0; i < nTCs; i++) {
1070 if (tcs[i] ==
this) {
1071 Error(
"MultiSort",
"tcs[%d] = \"this\"", i);
1075 Error(
"MultiSort",
"tcs[%d] has length %d != length of this (%d)",
1083 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
typedef void((*Func_t)())
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=0, 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.
virtual void Delete(Option_t *option="")
Clear the clones array.
TObjArray * fKeep
Pointer to the class of the elements.
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
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.
virtual void Compress()
Remove empty slots from array.
virtual void SetOwner(Bool_t enable=kTRUE)
A TClonesArray is always the owner of the object it contains.
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 SetClass(const char *classname, Int_t size=1000)
see TClonesArray::SetClass(const TClass*)
virtual void RemoveRange(Int_t idx1, Int_t idx2)
Remove objects from index idx1 to idx2 included.
Bool_t CanBypassStreamer() const
TClonesArray & operator=(const TClonesArray &tc)
Assignment operator.
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
virtual void Clear(Option_t *option="")
Clear the clones array.
TObject * ConstructedAt(Int_t idx)
Get an object at index 'idx' that is guaranteed to have been constructed.
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.
TClonesArray()
Default Constructor.
virtual void Sort(Int_t upto=kMaxInt)
If objects in array are sortable (i.e.
TObject *& operator[](Int_t idx)
Return pointer to reserved area in which a new object of clones class can be constructed.
TObject * New(Int_t idx)
Create an object of type fClass with the default ctor at the specified index.
void MultiSort(Int_t nTCs, TClonesArray **tcs, Int_t upto=kMaxInt)
Sort multiple TClonesArrays simultaneously with this array.
Bool_t IsSortable() const
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
void SetName(const char *name)
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
virtual const char * GetName() const
Returns name of object.
Int_t IndexOf(const TObject *obj) const
Int_t GetEntriesFast() const
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
Bool_t BoundsOk(const char *where, Int_t at) const
virtual void Clear(Option_t *option="")
Remove all objects from the array.
TObject * UncheckedAt(Int_t i) const
TObject * First() const
Return the object in the first slot.
Int_t fLowerBound
Array contents.
Int_t GetAbsLast() const
Return absolute index to last object in array.
TObjArray(Int_t s=TCollection::kInitCapacity, Int_t lowerBound=0)
Create an object array.
void RemoveQuietly(TObject *obj)
Remove an object from the object table.
Mother of all ROOT objects.
virtual void Clear(Option_t *="")
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.
@ kNotDeleted
object has not been deleted
UInt_t fBits
bit field status word
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()).
const char * Data() const
static constexpr double s
Short_t Max(Short_t a, Short_t b)
Short_t Min(Short_t a, Short_t b)