Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TIteratorToSTLInterface< STLContainer > Class Template Referencefinal

template<class STLContainer>
class TIteratorToSTLInterface< STLContainer >

TIterator and GenericRooFIter front end with STL back end.

By default, this iterators counts, at which position the current element should be. On request, it does an index access to the underlying collection, and returns the element. This happens because the RooLinkedList, which used to be the default collection in RooFit, will not invalidate iterators when inserting elements. Since the default is now an STL collection, reallocations might invalidate the iterator.

With an iterator that counts, only inserting before or at the iterator position will create problems. deal with reallocations while iterating. Therefore, this iterator will also check that the last element it was pointing to is the the current element when it is invoked again. This ensures that inserting or removing before this iterator does not happen, which was possible with the linked list iterators of RooFit. When NDEBUG is defined, these checks will disappear.

Note
This is a legacy iterator that only exists to not break old code. Use begin(), end() and range-based for loops with RooArgList and RooArgSet.

Definition at line 98 of file RooLinkedListIter.h.

Public Member Functions

 TIteratorToSTLInterface (const STLContainer &container)
 
const TCollectionGetCollection () const override
 
RooAbsArgnext () override
 Return next element or nullptr if at end.
 
TObjectNext () override
 
bool operator!= (const TIterator &other) const override
 Compare two iterator objects.
 
TObjectoperator* () const override
 Return current object or nullptr.
 
TIteratoroperator= (const TIterator &) override
 
void Reset () override
 
- Public Member Functions inherited from TIterator
virtual ~TIterator ()
 
virtual Option_tGetOption () const
 
TObjectoperator() ()
 
Bool_t operator== (const TIterator &other) const
 
- Public Member Functions inherited from GenericRooFIter
virtual ~GenericRooFIter ()
 

Private Member Functions

bool atEnd () const
 
RooAbsArgnextChecked ()
 

Private Attributes

const RooAbsArgfCurrentElem
 
std::size_t fIndex
 
const STLContainer & fSTLContainer
 

Additional Inherited Members

- Protected Member Functions inherited from TIterator
 TIterator ()
 
 TIterator (const TIterator &)
 

#include <RooLinkedListIter.h>

Inheritance diagram for TIteratorToSTLInterface< STLContainer >:
[legend]

Constructor & Destructor Documentation

◆ TIteratorToSTLInterface()

template<class STLContainer >
TIteratorToSTLInterface< STLContainer >::TIteratorToSTLInterface ( const STLContainer &  container)
inline

Definition at line 101 of file RooLinkedListIter.h.

Member Function Documentation

◆ atEnd()

template<class STLContainer >
bool TIteratorToSTLInterface< STLContainer >::atEnd ( ) const
inlineprivate

Definition at line 166 of file RooLinkedListIter.h.

◆ GetCollection()

template<class STLContainer >
const TCollection * TIteratorToSTLInterface< STLContainer >::GetCollection ( ) const
inlineoverridevirtual

Implements TIterator.

Definition at line 119 of file RooLinkedListIter.h.

◆ next()

template<class STLContainer >
RooAbsArg * TIteratorToSTLInterface< STLContainer >::next ( )
inlineoverridevirtual

Return next element or nullptr if at end.

Implements GenericRooFIter.

Definition at line 123 of file RooLinkedListIter.h.

◆ Next()

template<class STLContainer >
TObject * TIteratorToSTLInterface< STLContainer >::Next ( )
inlineoverridevirtual

Implements TIterator.

Definition at line 134 of file RooLinkedListIter.h.

◆ nextChecked()

template<class STLContainer >
RooAbsArg * TIteratorToSTLInterface< STLContainer >::nextChecked ( )
inlineprivate

Definition at line 172 of file RooLinkedListIter.h.

◆ operator!=()

template<class STLContainer >
bool TIteratorToSTLInterface< STLContainer >::operator!= ( const TIterator ) const
inlineoverridevirtual

Compare two iterator objects.

For backward compatibility reasons we have to provide this default implementation.

Reimplemented from TIterator.

Definition at line 146 of file RooLinkedListIter.h.

◆ operator*()

template<class STLContainer >
TObject * TIteratorToSTLInterface< STLContainer >::operator* ( ) const
inlineoverridevirtual

Return current object or nullptr.

For backward compatibility reasons we have to provide this default implementation.

Reimplemented from TIterator.

Definition at line 153 of file RooLinkedListIter.h.

◆ operator=()

template<class STLContainer >
TIterator & TIteratorToSTLInterface< STLContainer >::operator= ( const TIterator )
inlineoverridevirtual

Implements TIterator.

Definition at line 115 of file RooLinkedListIter.h.

◆ Reset()

template<class STLContainer >
void TIteratorToSTLInterface< STLContainer >::Reset ( )
inlineoverridevirtual

Implements TIterator.

Definition at line 138 of file RooLinkedListIter.h.

Member Data Documentation

◆ fCurrentElem

template<class STLContainer >
const RooAbsArg* TIteratorToSTLInterface< STLContainer >::fCurrentElem
private

Definition at line 186 of file RooLinkedListIter.h.

◆ fIndex

template<class STLContainer >
std::size_t TIteratorToSTLInterface< STLContainer >::fIndex
private

Definition at line 185 of file RooLinkedListIter.h.

◆ fSTLContainer

template<class STLContainer >
const STLContainer& TIteratorToSTLInterface< STLContainer >::fSTLContainer
private

Definition at line 184 of file RooLinkedListIter.h.

  • roofit/roofitcore/inc/RooLinkedListIter.h