#ifndef ROO_LINKED_LIST_ITER
#define ROO_LINKED_LIST_ITER
#include "Rtypes.h"
#include "TIterator.h"
#include "RooAbsArg.h"
#include "RooLinkedList.h"
class RooLinkedListIter : public TIterator {
public:
RooLinkedListIter() {} ;
RooLinkedListIter(const RooLinkedList* list, Bool_t forward) :
TIterator(), _forward(forward), _list(list)
{
_ptr = _list->_first ;
_cptr = _ptr;
}
RooLinkedListIter(const RooLinkedListIter& other) :
TIterator(other),
_forward(other._forward),
_cptr(other._cptr),
_ptr(other._ptr),
_list(other._list)
{
}
virtual ~RooLinkedListIter() { ; }
TIterator& operator=(const TIterator& other) {
if (&other==this) return *this ;
const RooLinkedListIter* iter = dynamic_cast<const RooLinkedListIter*>(&other) ;
if (iter) {
_list = iter->_list ;
_ptr = iter->_ptr ;
_cptr = iter->_cptr;
_forward = iter->_forward ;
}
return *this ;
}
virtual const TCollection *GetCollection() const {
return 0 ;
}
virtual TObject *Next() {
if (!_ptr) return 0 ;
_cptr = _ptr;
TObject* arg = _ptr->_arg ;
_ptr = _forward ? _ptr->_next : _ptr->_prev ;
return arg ;
}
virtual void Reset() {
_ptr = _forward ? _list->_first : _list->_last ;
_cptr = _ptr;
}
bool operator!=(const TIterator &aIter) const {
if (nullptr == &aIter)
return _cptr;
if ((aIter.IsA() == RooLinkedListIter::Class())) {
const RooLinkedListIter &iter(dynamic_cast<const RooLinkedListIter &>(aIter));
return (_cptr != iter._cptr);
}
return false;
}
bool operator!=(const RooLinkedListIter &aIter) const {
if (nullptr == (&aIter))
return _cptr;
return (_cptr != aIter._cptr);
}
virtual TObject *operator*() const {
return (_cptr ? _cptr->_arg : nullptr);
}
protected:
Bool_t _forward ;
const RooLinkedListElem* _cptr ;
const RooLinkedListElem* _ptr ;
const RooLinkedList* _list ;
ClassDef(RooLinkedListIter,1)
} ;
#endif
Last change: Wed Jun 25 08:33:21 2008
Last generated: 2008-06-25 08:33
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.