167 ::operator
delete(obj);
234 if (
this == &tc)
return *
this;
237 Error(
"operator=",
"cannot copy TClonesArray's when classes are different");
246 for (i = 0; i <
fSize; i++)
255 for (i = 0; i < tc.
fSize; i++) {
339 for ( ; j <
fSize; j++) {
390 obj->
Clear(clear_options);
409 if (option && option[0] ==
'C') {
410 const char *cplus = strstr(option,
"+");
417 for (
Int_t i = 0; i <
n; i++) {
469 Error (
"Expand",
"newSize must be positive (%d)", newSize);
473 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
476 if (newSize ==
fSize)
478 if (newSize <
fSize) {
481 for (
int i = newSize; i <
fSize; i++)
503 Error(
"ExpandCreate",
"n must be positive (%d)",
n);
507 Error(
"ExpandCreate",
"Not initialized properly, fKeep is still a nullptr");
514 for (i = 0; i <
n; i++) {
524 for (i =
n; i <
fSize; i++)
551 for (i = 0; i <
n; i++) {
572 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
600 if (i == -1)
return 0;
619 if (!
BoundsOk(
"RemoveRange", idx1))
return;
620 if (!
BoundsOk(
"RemoveRange", idx2))
return;
637 if (idx1 < fLast || fLast > idx2)
return;
654 Error(
"SetClass",
"TClonesArray already initialized with another class");
660 Error(
"SetClass",
"called with a null pointer");
666 Error(
"SetClass",
"%s does not inherit from TObject", classname);
671 Error(
"SetClass",
"%s must inherit from TObject as the left most base class.", classname);
674 Int_t nch = strlen(classname)+2;
675 char *
name =
new char[nch];
715 Error(
"Sort",
"objects in array are not sortable");
731void TClonesArray::Streamer(
TBuffer &
b)
744 const Int_t kOldBypassStreamer =
BIT(14);
748 TObject::Streamer(
b);
757 s =
s(pos+1,
s.Length()-pos-1);
762 Error(
"Streamer",
"expecting class %s but it was not found by TClass::GetClass\n",
764 b.CheckByteCount(R__s, R__c,TClonesArray::IsA());
770 nobjects = -nobjects;
799 for (
Int_t i = 0; i < nobjects; i++) {
809 if (clv < 8 && classv ==
"TF1") {
813 temp.ExpandCreate(nobjects);
814 b.ReadClones(&temp, nobjects, clv);
818 }
else if (clv <= 8 && clv > 3 && clv != 6 && classv ==
"TFormula") {
822 temp.ExpandCreate(nobjects);
823 b.ReadClones(&temp, nobjects, clv);
829 b.ReadClones(
this, nobjects, clv);
832 for (
Int_t i = 0; i < nobjects; i++) {
849 b.CheckByteCount(R__s, R__c,TClonesArray::IsA());
855 b.ForceWriteInfoClones(
this);
868 R__c =
b.WriteVersion(TClonesArray::IsA(),
kTRUE);
869 TObject::Streamer(
b);
877 b.WriteClones(
this,nobjects);
879 for (
Int_t i = 0; i < nobjects; i++) {
890 b.SetByteCount(R__c,
kTRUE);
909 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
913 Error(
"operator[]",
"invalid class specified in TClonesArray ctor");
942 if (idx < 0 || idx >=
fSize) {
943 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
957 Error(
"New",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
961 Error(
"New",
"invalid class specified in TClonesArray ctor");
996 Error(
"AbsorbObjects",
"cannot absorb objects when classes are different");
1001 Error(
"AbsorbObjects",
"range is not valid: idx1>idx2");
1005 Error(
"AbsorbObjects",
"range is not valid: idx2 out of bounds");
1015 Int_t newSize = oldSize + (idx2-idx1+1);
1020 for (
Int_t i = idx1; i <= idx2; i++) {
1021 Int_t newindex = oldSize+i -idx1;
1024 (*fKeep)[newindex] = (*(tc->
fKeep))[i];
1026 (*(tc->
fKeep))[i] = 0;
1032 (*(tc->
fKeep))[i-(idx2-idx1+1)] = (*(tc->
fKeep))[i];
1034 (*(tc->
fKeep))[i] = 0;
1055 Error(
"MultiSort",
"objects in array are not sortable");
1059 if (sortedCheck && i > 1) {
1068 for (
int i = 0; i < nTCs; i++) {
1069 if (tcs[i] ==
this) {
1070 Error(
"MultiSort",
"tcs[%d] = \"this\"", i);
1074 Error(
"MultiSort",
"tcs[%d] has length %d != length of this (%d)",
1082 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)