Logo ROOT   6.21/01
Reference Guide
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 97 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. More...
 
TObjectNext () override
 
Bool_t operator!= (const TIterator &other) const override
 Compare two iterator objects. More...
 
TObjectoperator* () const override
 Return current object or nullptr. More...
 
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 100 of file RooLinkedListIter.h.

Member Function Documentation

◆ atEnd()

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

Definition at line 165 of file RooLinkedListIter.h.

◆ GetCollection()

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

Implements TIterator.

Definition at line 118 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 122 of file RooLinkedListIter.h.

◆ Next()

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

Implements TIterator.

Definition at line 133 of file RooLinkedListIter.h.

◆ nextChecked()

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

Definition at line 171 of file RooLinkedListIter.h.

◆ operator!=()

template<class STLContainer >
Bool_t 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 145 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 152 of file RooLinkedListIter.h.

◆ operator=()

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

Reimplemented from TIterator.

Definition at line 114 of file RooLinkedListIter.h.

◆ Reset()

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

Implements TIterator.

Definition at line 137 of file RooLinkedListIter.h.

Member Data Documentation

◆ fCurrentElem

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

Definition at line 185 of file RooLinkedListIter.h.

◆ fIndex

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

Definition at line 184 of file RooLinkedListIter.h.

◆ fSTLContainer

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

Definition at line 183 of file RooLinkedListIter.h.


The documentation for this class was generated from the following file: