151 ::operator
delete(obj);
218 if (
this == &tc)
return *
this;
221 Error(
"operator=",
"cannot copy TClonesArray's when classes are different");
230 for (i = 0; i <
fSize; i++)
239 for (i = 0; i < tc.
fSize; i++) {
323 for ( ; j <
fSize; j++) {
374 obj->
Clear(clear_options);
393 if (option && option[0] ==
'C') {
394 const char *cplus = strstr(option,
"+");
401 for (
Int_t i = 0; i <
n; i++) {
453 Error (
"Expand",
"newSize must be positive (%d)", newSize);
456 if (newSize ==
fSize)
458 if (newSize <
fSize) {
461 for (
int i = newSize; i <
fSize; i++)
483 Error(
"ExpandCreate",
"n must be positive (%d)", n);
490 for (i = 0; i <
n; i++) {
500 for (i = n; i <
fSize; i++)
527 for (i = 0; i <
n; i++) {
548 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
576 if (i == -1)
return 0;
595 if (!
BoundsOk(
"RemoveRange", idx1))
return;
596 if (!
BoundsOk(
"RemoveRange", idx2))
return;
613 if (idx1 < fLast || fLast > idx2)
return;
630 Error(
"SetClass",
"TClonesArray already initialized with another class");
636 Error(
"SetClass",
"called with a null pointer");
642 Error(
"SetClass",
"%s does not inherit from TObject", classname);
647 Error(
"SetClass",
"%s must inherit from TObject as the left most base class.", classname);
650 Int_t nch = strlen(classname)+2;
651 char *
name =
new char[nch];
652 snprintf(name,nch,
"%ss", classname);
687 if (nentries <= 0 ||
fSorted)
return;
691 Error(
"Sort",
"objects in array are not sortable");
707 void TClonesArray::Streamer(
TBuffer &
b)
720 const Int_t kOldBypassStreamer =
BIT(14);
724 TObject::Streamer(b);
733 s =
s(pos+1, s.
Length()-pos-1);
738 printf(
"TClonesArray::Streamer expecting class %s\n", classv.
Data());
745 nobjects = -nobjects;
771 for (
Int_t i = 0; i < nobjects; i++) {
785 for (
Int_t i = 0; i < nobjects; i++) {
822 TObject::Streamer(b);
832 for (
Int_t i = 0; i < nobjects; i++) {
862 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
866 Error(
"operator[]",
"invalid class specified in TClonesArray ctor");
895 if (idx < 0 || idx >=
fSize) {
896 Error(
"operator[]",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
910 Error(
"New",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
914 Error(
"New",
"invalid class specified in TClonesArray ctor");
949 Error(
"AbsorbObjects",
"cannot absorb objects when classes are different");
954 Error(
"AbsorbObjects",
"range is not valid: idx1>idx2");
958 Error(
"AbsorbObjects",
"range is not valid: idx2 out of bounds");
968 Int_t newSize = oldSize + (idx2-idx1+1);
973 for (
Int_t i = idx1; i <= idx2; i++) {
974 Int_t newindex = oldSize+i -idx1;
977 (*fKeep)[newindex] = (*(tc->
fKeep))[i];
979 (*(tc->
fKeep))[i] = 0;
985 (*(tc->
fKeep))[i-(idx2-idx1+1)] = (*(tc->
fKeep))[i];
987 (*(tc->
fKeep))[i] = 0;
1003 if (nentries <= 1 ||
fSorted)
return;
1008 Error(
"MultiSort",
"objects in array are not sortable");
1012 if (sortedCheck && i > 1) {
1021 for (
int i = 0; i < nTCs; i++) {
1022 if (tcs[i] ==
this) {
1023 Error(
"MultiSort",
"tcs[%d] = \"this\"", i);
1027 Error(
"MultiSort",
"tcs[%d] has length %d != length of this (%d)",
1035 for (
int i = 0; i < nTCs; i++) {
1036 b[2*i] = tcs[i]->
fCont;
virtual void Clear(Option_t *="")
virtual const char * GetName() const
Returns name of object.
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).
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
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) 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.
object has not been deleted
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 constexpr double s
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