Logo ROOT   6.16/01
Reference Guide
RooLinkedListElem.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooLinkedListElem.h,v 1.11 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_LINKED_LIST_ELEM
17#define ROO_LINKED_LIST_ELEM
18
19#include "Rtypes.h"
20
21class TObject ;
23class TBuffer ;
24
26 class Chunk;
27 class Pool;
28}
29
31public:
32 // Initial element ctor
34 _prev(0), _next(0), _arg(0), _refCount(0) {
35 }
36
37 void init(TObject* arg, RooLinkedListElem* after=0) {
38 _arg = arg ;
39 _refCount = 1 ;
40
41 if (after) {
42 _prev = after ;
43 _next = after->_next ;
44 after->_next = this ;
45 if (_next) {
46 _next->_prev = this ;
47 }
48 }
49 }
50
51 void release() {
52 if (_prev) _prev->_next = _next ;
53 if (_next) _next->_prev = _prev ;
54 _prev = 0 ;
55 _next = 0 ;
56 }
57
59 // Constructor with payload
60 _prev(0), _next(0), _arg(arg), _refCount(1) {
61 }
62
64 // Constructor with payload and next chain element
65 _prev(after), _next(after->_next), _arg(arg), _refCount(1) {
66
67 // Insert self in link
68 after->_next = this ;
69 if (_next) _next->_prev = this ;
70 }
71
72 // Destructor
73 virtual ~RooLinkedListElem() {
74 // Remove self from link
75 if (_prev) _prev->_next = _next ;
76 if (_next) _next->_prev = _prev ;
77 }
78
79 Int_t refCount() const { return _refCount ; }
80 Int_t incRefCount() { return ++_refCount ; }
81 Int_t decRefCount() { return --_refCount ; }
82
83protected:
84 friend class RooHashTable ;
85 friend class RooLinkedList ;
88 friend class RooLinkedListIter ;
89 friend class RooFIter ;
90 RooLinkedListElem* _prev ; // Link to previous element in list
91 RooLinkedListElem* _next ; // Link to next element in list
92 TObject* _arg ; // Link to contents
93 Int_t _refCount ; //! Reference count
94
95protected:
96
97 // Forbidden
99
100 ClassDef(RooLinkedListElem,1) // Element of RooLinkedList container class
101} ;
102
103
104
105#endif
int Int_t
Definition: RtypesCore.h:41
#define ClassDef(name, id)
Definition: Rtypes.h:324
RooHashTable implements a hash table for TObjects.
Definition: RooHashTable.h:28
RooLinkedListElem is an link element for the RooLinkedList class.
RooLinkedListElem(TObject *arg)
friend class RooLinkedListImplDetails::Pool
RooLinkedListElem(TObject *arg, RooLinkedListElem *after)
virtual ~RooLinkedListElem()
void init(TObject *arg, RooLinkedListElem *after=0)
RooLinkedListElem(const RooLinkedListElem &)
Reference count.
RooLinkedListElem * _prev
RooLinkedListElem * _next
friend class RooLinkedListImplDetails::Chunk
Int_t refCount() const
RooLinkedListIter is the TIterator implementation for RooLinkedList.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
Definition: RooLinkedList.h:35
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Mother of all ROOT objects.
Definition: TObject.h:37