Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CandRefCounted.h

Go to the documentation of this file.
00001 
00002 // $Id: CandRefCounted.h,v 1.3 2003/03/13 23:54:10 gmieg Exp $
00003 //
00004 // CandRefCounted.h
00005 //
00006 // The CandBase class inherits from CandRefCounted for ref-counting.
00007 //
00008 // Each concrete CandBase must define a Dup function.
00009 // Each concrete CandBase must grant friendship to class CandRefer.
00010 //
00011 // Adapted from Babar's BbrRefCounted (written by Gautier Hamel de
00012 // Monchenault and Bob Jacobsen).
00013 //
00014 // Author:  G. Irwin 1/2000
00016 
00017 #ifndef CANDREFCOUNTED_H
00018 #define CANDREFCOUNTED_H
00019 
00020 // not inheriting from TObject so we need an explicit Rtypes
00021 #ifndef ROOT_Rtypes
00022 #if !defined(__CINT__) || defined(__MAKECINT__)
00023 #include "Rtypes.h"
00024 #endif
00025 #endif
00026 
00027 class CandBase;
00028 
00029 class CandRefCounted
00030 {
00031 
00032 public:
00033 
00034 // Dup - Forces subclasses to define a Dup function (for cloning).
00035    virtual CandBase *Dup() const = 0;
00036 
00037 protected:
00038 
00039 // Constructor
00040    CandRefCounted();
00041 
00042 // Destructor
00043    virtual ~CandRefCounted();
00044 
00045   // Protected modifiers
00046    Int_t AddLink()  {return ++fNLinks;}     // Includes LocalHandle link
00047    Int_t DropLink() {return --fNLinks;}     // Includes LocalHandle link
00048 
00049 // Protected access
00050    Int_t GetNLinks() const {return fNLinks;} // Includes LocalHandle ref
00051 
00052 private:
00053   Int_t fNLinks;   
00054 
00055 ClassDef(CandRefCounted,2)                 // Reference counting pointer
00056 
00057 };
00058 
00059 #endif                                              // CANDREFCOUNTED_H

Generated on Mon Feb 15 11:06:28 2010 for loon by  doxygen 1.3.9.1