Logo ROOT  
Reference Guide
TRefCnt.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 04/08/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TRefCnt
13 #define ROOT_TRefCnt
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TRefCnt //
19 // //
20 // Base class for reference counted objects. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #include "RtypesCore.h"
25 
26 
27 class TRefCnt {
28 
29 protected:
30  UInt_t fRefs; // (1 less than) number of references
31 
32 public:
34 
35  TRefCnt(Int_t initRef = 0) : fRefs((UInt_t)initRef-1) { }
37  virtual ~TRefCnt() { }
38  UInt_t References() const { return fRefs+1; }
39  void SetRefCount(UInt_t r) { fRefs = r-1; }
40  void AddReference() { fRefs++; }
41  UInt_t RemoveReference() { return fRefs--; }
42 };
43 
44 #endif
TRefCnt::SetRefCount
void SetRefCount(UInt_t r)
Definition: TRefCnt.h:39
TRefCnt::References
UInt_t References() const
Definition: TRefCnt.h:38
r
ROOT::R::TRInterface & r
Definition: Object.C:4
TRefCnt::AddReference
void AddReference()
Definition: TRefCnt.h:40
TRefCnt::fRefs
UInt_t fRefs
Definition: TRefCnt.h:30
TRefCnt::~TRefCnt
virtual ~TRefCnt()
Definition: TRefCnt.h:37
unsigned int
TRefCnt::TRefCnt
TRefCnt(Int_t initRef=0)
Definition: TRefCnt.h:35
RtypesCore.h
TRefCnt::RemoveReference
UInt_t RemoveReference()
Definition: TRefCnt.h:41
TRefCnt::kStaticInit
@ kStaticInit
Definition: TRefCnt.h:33
TRefCnt::EReferenceFlag
EReferenceFlag
Definition: TRefCnt.h:33
TRefCnt
Definitions for TRefCnt, base class for reference counted objects.
Definition: TRefCnt.h:27
int