TVirtualObject.h

Go to the documentation of this file.
00001 // @(#)root/io:$Id: TVirtualObject.h 30902 2009-10-28 15:13:43Z pcanal $
00002 // Author: Philippe Canal July, 2008
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010   *************************************************************************/
00011 
00012 #ifndef ROOT_TVirtualObject
00013 #define ROOT_TVirtualObject
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // TVirtualObject                                                       //
00019 //                                                                      //
00020 // Wrapper around an object and giving indirect access to its content    //
00021 // even if the object is not of a class in the Cint/Reflex dictionary.  //
00022 //                                                                      //
00023 //////////////////////////////////////////////////////////////////////////
00024 
00025 #ifndef ROOT_TClassRef
00026 #include "TClassRef.h"
00027 #endif
00028 
00029 
00030 class TVirtualObject {
00031 private:
00032 
00033    TVirtualObject(const TVirtualObject&);             // not implemented
00034    TVirtualObject &operator=(const TVirtualObject&);  // not implemented
00035 
00036 public:
00037    TClassRef  fClass;
00038    void      *fObject;
00039 
00040    TVirtualObject(TClass *cl) : fClass(cl), fObject(cl ? cl->New() : 0) { }
00041    ~TVirtualObject() { if (fClass) fClass->Destructor(fObject); }
00042 
00043 
00044    TClass *GetClass() const { return fClass; }
00045    void   *GetObject() const { return fObject; }
00046 
00047 };
00048 
00049 #endif // ROOT_TVirtualObject

Generated on Tue Jul 5 14:28:28 2011 for ROOT_528-00b_version by  doxygen 1.5.1