46using std::cout, std::endl;
67 Chunk(
const Chunk&) =
delete;
73 Int_t capacity()
const
82 bool full()
const {
return !
free(); }
84 bool empty()
const {
return capacity() ==
free(); }
123 typedef RooLinkedListImplDetails::Chunk Chunk;
125 typedef std::map<const void*, Chunk*>
AddrMap;
132 inline void acquire() { ++_refCount; }
134 inline bool release() {
return 0 == --_refCount; }
170 Chunk *
c =
new Chunk(
sz);
205 Chunk *
c =
ci->second;
207 c->push_free_elem(
el);
232 Int_t Pool::nextChunkSz()
const
267 _hashThresh(
htsize), _size(0), _first(nullptr), _last(nullptr), _htableName(nullptr), _htableLink(nullptr), _useNptr(
true)
277 TObject(
other), _hashThresh(
other._hashThresh), _size(0), _first(nullptr), _last(nullptr), _htableName(nullptr), _htableLink(nullptr),
279 _useNptr(
other._useNptr)
334 coutE(InputArguments) <<
"RooLinkedList::setHashTable() ERROR size must be positive" << endl ;
374 if (
_pool->release()) {
393 if (ptr->
_arg == arg) {
546 return elem ?
elem->_arg : nullptr ;
640 if (!
nptr)
return nullptr;
695 if (ptr->
_arg==arg)
return idx ;
726 cout <<
elem->_arg <<
" : " ;
727 elem->_arg->Print(opt) ;
738 auto iterImpl = std::make_unique<RooLinkedListIterImpl>(
this, forward);
748 auto iterImpl = std::make_unique<RooLinkedListIterImpl>(
this, forward);
757 auto iterImpl = std::make_unique<RooFIterForLinkedList>(
this);
766 return {
this,
nullptr,
true};
770 return {
this,
false};
774 return {
this,
nullptr,
false};
786 for (
auto it =
_at.begin(); it !=
_at.end(); ++it,
elem =
elem->_next) {
794template <
bool ascending>
800 if (tail) *tail =
l1;
805 std::vector<RooLinkedListElem *>
arr(
sz,
nullptr);
806 for (
int i = 0;
l1;
l1 =
l1->_next, ++i)
arr[i] =
l1;
815 (tmp->_arg->Compare(
arr[
j]->_arg) <= 0) :
816 (
arr[
j]->_arg->Compare(tmp->_arg) <= 0);
823 }
while (
int(
sz) != i);
826 arr[0]->_prev =
arr[
sz - 1]->_next =
nullptr;
827 for (
int i = 0; i <
int(
sz - 1); ++i) {
828 arr[i]->_next =
arr[i + 1];
829 arr[i + 1]->_prev =
arr[i];
831 if (tail) *tail =
arr[
sz - 1];
839 if (!
end->_next)
break;
842 l2->_prev->_next =
nullptr;
850 (
l2->_arg->Compare(
l1->_arg) <= 0)) ?
l1 :
l2;
860 (
l2->_arg->Compare(
l1->_arg) <= 0);
864 l1->_prev->_next =
l2;
865 l2->_prev =
l1->_prev;
905 if (
R__b.IsReading()) {
920 if (
v > 1 &&
v < 4) {
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Binding & operator=(OUT(*fun)(void))
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
const TNamed * namePtr() const
De-duplicated pointer to this object's name.
Abstract base class for binned and unbinned datasets.
const TNamed * namePtr() const
De-duplicated pointer to this object's name.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
Link element for the RooLinkedList class.
TObject * _arg
Link to contents.
Int_t _refCount
! Reference count
RooLinkedListElem * _next
Link to next element in list.
Implementation of the actual iterator on RooLinkedLists.
A wrapper around TIterator derivatives.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
RooLinkedListIterImpl rend() const
TObject * At(int index) const
Return object stored in sequential position given by index.
RooLinkedListIter iterator(bool forward=true) const
Create an iterator for this list.
static Pool * _pool
shared memory pool for allocation of RooLinkedListElems
~RooLinkedList() override
Destructor.
RooLinkedListIterImpl end() const
RooLinkedListImplDetails::Pool Pool
memory pool for quick allocation of RooLinkedListElems
std::vector< RooLinkedListElem * > _at
! index list for quick index through At
std::unique_ptr< HashTableByName > _htableName
! Hash table by name
void RecursiveRemove(TObject *obj) override
If one of the TObject we have a referenced to is deleted, remove the reference.
bool Replace(const TObject *oldArg, const TObject *newArg)
Replace object 'oldArg' in collection with new object 'newArg'.
RooLinkedList(Int_t htsize=0)
void Print(const char *opt) const override
Print contents of list, defers to Print() function of contained objects.
std::unique_ptr< HashTableByLink > _htableLink
! Hash table by link pointer
RooFIter fwdIterator() const
Create a one-time-use forward iterator for this list.
void deleteElement(RooLinkedListElem *)
RooLinkedListElem * findLink(const TObject *arg) const
Find the element link containing the given object.
void Streamer(TBuffer &) override
Custom streaming handling schema evolution w.r.t past implementations.
RooLinkedListIterImpl rbegin() const
TClass * IsA() const override
Int_t _hashThresh
Size threshold for hashing.
RooLinkedListElem * createElement(TObject *obj, RooLinkedListElem *elem=nullptr)
cout << "RooLinkedList::createElem(" << this << ") obj = " << obj << " elem = " << elem << endl ;
RooAbsArg * findArg(const RooAbsArg *) const
Return pointer to object with given name in collection.
void Delete(Option_t *o=nullptr) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
TObject * find(const char *name) const
Return pointer to object with given name in collection.
RooLinkedList & operator=(const RooLinkedList &other)
Assignment operator, copy contents from 'other'.
virtual void Add(TObject *arg)
Int_t _size
Current size of list.
RooLinkedListIterImpl begin() const
RooLinkedListElem * _last
! Link to last element of list
void setHashTableSize(Int_t size)
Change the threshold for hash-table use to given size.
TObject * FindObject(const char *name) const override
Return pointer to object with given name.
RooLinkedListElem * _first
! Link to first element of list
TIterator * MakeIterator(bool forward=true) const
Create a TIterator for this list.
void Clear(Option_t *o=nullptr) override
Remove all elements from collection.
static RooLinkedListElem * mergesort_impl(RooLinkedListElem *l1, const unsigned sz, RooLinkedListElem **tail=nullptr)
length 0, 1 lists are sorted
void Sort(bool ascend=true)
Int_t IndexOf(const char *name) const
Return position of given object in list.
virtual bool Remove(TObject *arg)
Remove object from collection.
@ kRenamedArg
TNamed flag to indicate that some RooAbsArg has been renamed (flag set in new name)
static const TNamed * known(const char *stringPtr)
If the name is already known, return its TNamed pointer. Otherwise return 0 (don't register the name)...
Buffer base class used for serializing objects.
Iterator abstract base class.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Streamer(TBuffer &)
Stream an object of class TObject.
void CallRecursiveRemoveIfNeeded(TObject &obj)
call RecursiveRemove for obj if gROOT is valid and obj.TestBit(kMustCleanup) is true.