128 Warning(
"TRefArray",
"size (%d) < 0", s);
145 Warning(
"TRefArray",
"size (%d) < 0", s);
164 fUIDs[i] = a.
fUIDs[i];
186 fUIDs[i] = a.
fUIDs[i];
199 if (fUIDs)
delete []
fUIDs;
224 Info(
TString::Format(
"TRefArray::%s",methodname),
"The ProcessID for the %p has been switched to %s/%s:%d.",
245 Warning(
TString::Format(
"TRefArray::%s",methodname),
"The ProcessID for the %p has been switched to %s/%s:%d. There are too many referenced objects.",
249 Error(
TString::Format(
"TRefArray::%s",methodname),
"The object at %p can not be registered in the process the TRefArray points to (pid = %s/%s) because the ProcessID has too many objects and the TRefArray already contains other objects.",obj,
fPID->
GetName(),
fPID->
GetTitle());
257 "The object at %p is not registered in the process the TRefArray points to (pid = %s/%s)",obj,
fPID->
GetName(),
fPID->
GetTitle());
301 Error(
"AddBefore",
"before not found, object not added");
305 Error(
"AddBefore",
"cannot add before lowerbound (%d)", fLowerBound);
308 AddAt(obj, idx+fLowerBound-1);
325 Error(
"AddAfter",
"after not found, object not added");
339 if (idx < fLowerBound) {
340 Error(
"AddAt",
"out of bounds at %d in %lx", idx, (
Long_t)
this);
343 if (idx-fLowerBound >=
fSize)
362 if (!
BoundsOk(
"AddAt", idx))
return;
382 for (i = 0; i <
fSize; i++)
403 if (!obj || !
fPID)
return 0;
406 if (idx == -1 || idx ==
fSize-1)
return 0;
416 if (!obj || !
fPID)
return 0;
419 if (idx == -1 || idx == 0)
return 0;
431 for (
Int_t j=0 ; j <
fSize; j++) fUIDs[j] = 0;
452 for ( ; j <
fSize; j++) fUIDs[j] = 0;
477 Error (
"Expand",
"newSize must be positive (%d)", newSize);
480 if (newSize ==
fSize)
return;
483 fUIDs =
new UInt_t[newSize];
484 if (newSize <
fSize) memcpy(fUIDs,temp, newSize*
sizeof(
UInt_t));
487 memset(&fUIDs[
fSize],0,(newSize-fSize)*
sizeof(
UInt_t));
492 if (temp)
delete [] temp;
513 void TRefArray::Streamer(
TBuffer &R__b)
520 TObject::Streamer(R__b);
521 fName.Streamer(R__b);
530 for (
Int_t i = 0; i < nobjects; i++) {
532 if (fUIDs[i] != 0)
fLast = i;
535 if ((i > 0 && i%10 == 0) || (i == nobjects-1))
printf(
"\n");
543 TObject::Streamer(R__b);
544 fName.Streamer(R__b);
552 for (
Int_t i = 0; i < nobjects; i++) {
556 if ((i > 0 && i%10 == 0) || (i == nobjects-1))
printf(
"\n");
644 if (j >= 0 && j <
fSize) {
664 return fLowerBound-1;
666 for (i = 0; i <
fSize; i++)
668 return i+fLowerBound;
670 for (i = 0; i <
fSize; i++)
675 return fLowerBound-1;
683 if (fUIDs &&
fSize != s) {
692 for (
Int_t i=0;i<s;i++) fUIDs[i] = 0;
696 fLowerBound = lowerBound;
714 Error(where,
"index %d out of bounds (size: %d, this: 0x%lx)", i,
fSize, (
Long_t)
this);
723 if (!
BoundsOk(
"RemoveAt", idx))
return 0;
752 if (idx == -1)
return 0;
786 Error(
"Sort",
"Function not yet implemented");
810 Error(
"BinarySearch",
"Function not yet implemented");
906 if (fCursor < fArray->Capacity()) {
961 return (((
fCurCursor >= 0) && (fCurCursor < fArray->Capacity())) ?
virtual Int_t AddAtFree(TObject *obj)
Return the position of the new object.
virtual const char * GetTitle() const
Returns title of object.
void Init(Int_t s, Int_t lowerBound)
Initialize a TRefArray.
Int_t IndexOf(const TObject *obj) const
TObject * Before(const TObject *obj) const
Return the object before obj. Returns 0 if obj is first object.
TIterator & operator=(const TIterator &rhs)
Overridden assignment operator.
virtual void Sort(Int_t upto=kMaxInt)
If objects in array are sortable (i.e.
Bool_t BoundsOk(const char *where, Int_t at) const
virtual void Expand(Int_t newSize)
Expand or shrink the array to newSize elements.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
Bool_t OutOfBoundsError(const char *where, Int_t i) const
Generate an out-of-bounds error. Always returns false.
Buffer base class used for serializing objects.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
An array of references to TObjects.
virtual UShort_t GetPidOffset() const =0
virtual UInt_t WriteVersion(const TClass *cl, Bool_t useBcnt=kFALSE)=0
void SetLast(Int_t last)
Set index of last object in array, effectively truncating the array.
Int_t GetAbsLast() const
Return absolute index to last object in array.
virtual Int_t BinarySearch(TObject *obj, Int_t upto=kMaxInt)
Find object using a binary search.
virtual void AddLast(TObject *obj)
Add object in the next empty slot in the array.
Iterator abstract base class.
Int_t GetEntries() const
Return the number of objects in array (i.e.
virtual ~TRefArray()
Usual destructor (The object pointed to by the array are never deleted).
Int_t GetLast() const
Return index of last object in array.
Sequenceable collection abstract base class.
virtual TProcessID * ReadProcessID(UShort_t pidf)=0
Return the current Process-ID.
TObject * At(Int_t idx) const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString...
virtual Int_t GrowBy(Int_t delta) const
Increase the collection's capacity by delta slots.
TObject ** GetObjectRef(const TObject *obj) const
Return address of pointer obj.
std::map< std::string, std::string >::const_iterator iter
virtual void AddFirst(TObject *obj)
Add object in the first slot of the array.
const Bool_t kIterForward
A TProcessID identifies a ROOT job in a unique way in time and space.
Bool_t GetObjectUID(Int_t &uid, TObject *obj, const char *methodname)
Private/static function, check for validity of pid.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual UShort_t WriteProcessID(TProcessID *pid)=0
Always return 0 (current processID).
Iterator of object array.
TObject * First() const
Return the object in the first slot.
TObject * GetFromTable(Int_t idx) const
the reference may be in the TRefTable
TObject * Last() const
Return the object in the last filled slot. Returns 0 if no entries.
static TProcessID * GetProcessWithUID(const TObject *obj)
static function returning a pointer to TProcessID with its pid encoded in the highest byte of obj->Ge...
virtual void AddAt(TObject *obj, Int_t idx)
Add object at position ids.
virtual void Compress()
Remove empty slots from array.
Bool_t TestBit(UInt_t f) const
virtual const char * GetName() const
Returns name of object.
virtual void SetByteCount(UInt_t cntpos, Bool_t packInVersion=kFALSE)=0
void Reset(Detail::TBranchProxy *x)
TIterator * MakeIterator(Bool_t dir=kIterForward) const
Returns an array iterator.
TObject * GetObjectWithID(UInt_t uid)
returns the TObject with unique identifier uid in the table of objects
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
virtual void Delete(Option_t *option="")
Remove all objects from the array and free the internal memory.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
static TRefTable * GetRefTable()
Static function returning the current TRefTable.
TRefArray(TProcessID *pid=0)
virtual void AddAfter(const TObject *after, TObject *obj)
Add object in the slot after object after.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
A TRefTable maintains the association between a referenced object and the parent object supporting th...
TObject * Next()
Return next object in array. Returns 0 when no more objects in array.
TObject * operator*() const
Return current object or nullptr.
static TProcessID * GetSessionProcessID()
static function returning the pointer to the session TProcessID
friend class TRefArrayIter
UInt_t GetUID(Int_t at) const
Return UID of element at.
virtual UInt_t GetUniqueID() const
Return the unique object id.
Mother of all ROOT objects.
Bool_t operator!=(const TIterator &aIter) const
This operator compares two TIterator objects.
void Reset()
Reset array iterator.
ClassImp(TRefArray) TRefArray
default constructor
Short_t Max(Short_t a, Short_t b)
static UInt_t AssignID(TObject *obj)
static function returning the ID assigned to obj If the object is not yet referenced, its kIsReferenced bit is set and its fUniqueID set to the current number of referenced objects so far.
static UInt_t GetObjectCount()
Return the current referenced object count fgNumber is incremented every time a new object is referen...
virtual TObject * RemoveAt(Int_t idx)
Remove object at index idx.
static Bool_t IsValid(TProcessID *pid)
static function. return kTRUE if pid is a valid TProcessID
virtual TObject * Remove(TObject *obj)
Remove object from array.
virtual void SetUID(UInt_t uid, TProcessID *context=0)
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
virtual Bool_t Notify()
This function is called by TRef::Streamer or TStreamerInfo::ReadBuffer when reading a reference...
TRefArray & operator=(const TRefArray &a)
Assignment operator.
TObject * After(const TObject *obj) const
Return the object after obj. Returns 0 if obj is last object.
virtual void AddBefore(const TObject *before, TObject *obj)
Add object in the slot before object before.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.