#ifndef ROO_LINKED_LIST_ELEM
#define ROO_LINKED_LIST_ELEM
#include "Rtypes.h"
class TObject ;
class RooLinkedListElem ;
class TBuffer ;
namespace RooLinkedListImplDetails {
class Chunk;
class Pool;
}
class RooLinkedListElem {
public:
RooLinkedListElem() :
_prev(0), _next(0), _arg(0), _refCount(0) {
}
void init(TObject* arg, RooLinkedListElem* after=0) {
_arg = arg ;
_refCount = 1 ;
if (after) {
_prev = after ;
_next = after->_next ;
after->_next = this ;
if (_next) {
_next->_prev = this ;
}
}
}
void release() {
if (_prev) _prev->_next = _next ;
if (_next) _next->_prev = _prev ;
_prev = 0 ;
_next = 0 ;
}
RooLinkedListElem(TObject* arg) :
_prev(0), _next(0), _arg(arg), _refCount(1) {
}
RooLinkedListElem(TObject* arg, RooLinkedListElem* after) :
_prev(after), _next(after->_next), _arg(arg), _refCount(1) {
after->_next = this ;
if (_next) _next->_prev = this ;
}
virtual ~RooLinkedListElem() {
if (_prev) _prev->_next = _next ;
if (_next) _next->_prev = _prev ;
}
Int_t refCount() const { return _refCount ; }
Int_t incRefCount() { return ++_refCount ; }
Int_t decRefCount() { return --_refCount ; }
protected:
friend class RooHashTable ;
friend class RooLinkedList ;
friend class RooLinkedListImplDetails::Pool;
friend class RooLinkedListImplDetails::Chunk;
friend class RooLinkedListIter ;
friend class RooFIter ;
RooLinkedListElem* _prev ;
RooLinkedListElem* _next ;
TObject* _arg ;
Int_t _refCount ;
protected:
RooLinkedListElem(const RooLinkedListElem&) ;
ClassDef(RooLinkedListElem,1)
} ;
#endif