ROOT logo
// @(#)root/io:$Id: TVirtualObject.h 30902 2009-10-28 15:13:43Z pcanal $
// Author: Philippe Canal July, 2008

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
  *************************************************************************/

#ifndef ROOT_TVirtualObject
#define ROOT_TVirtualObject


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVirtualObject                                                       //
//                                                                      //
// Wrapper around an object and giving indirect access to its content    //
// even if the object is not of a class in the Cint/Reflex dictionary.  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TClassRef
#include "TClassRef.h"
#endif


class TVirtualObject {
private:

   TVirtualObject(const TVirtualObject&);             // not implemented
   TVirtualObject &operator=(const TVirtualObject&);  // not implemented

public:
   TClassRef  fClass;
   void      *fObject;

   TVirtualObject(TClass *cl) : fClass(cl), fObject(cl ? cl->New() : 0) { }
   ~TVirtualObject() { if (fClass) fClass->Destructor(fObject); }


   TClass *GetClass() const { return fClass; }
   void   *GetObject() const { return fObject; }

};

#endif // ROOT_TVirtualObject
 TVirtualObject.h:1
 TVirtualObject.h:2
 TVirtualObject.h:3
 TVirtualObject.h:4
 TVirtualObject.h:5
 TVirtualObject.h:6
 TVirtualObject.h:7
 TVirtualObject.h:8
 TVirtualObject.h:9
 TVirtualObject.h:10
 TVirtualObject.h:11
 TVirtualObject.h:12
 TVirtualObject.h:13
 TVirtualObject.h:14
 TVirtualObject.h:15
 TVirtualObject.h:16
 TVirtualObject.h:17
 TVirtualObject.h:18
 TVirtualObject.h:19
 TVirtualObject.h:20
 TVirtualObject.h:21
 TVirtualObject.h:22
 TVirtualObject.h:23
 TVirtualObject.h:24
 TVirtualObject.h:25
 TVirtualObject.h:26
 TVirtualObject.h:27
 TVirtualObject.h:28
 TVirtualObject.h:29
 TVirtualObject.h:30
 TVirtualObject.h:31
 TVirtualObject.h:32
 TVirtualObject.h:33
 TVirtualObject.h:34
 TVirtualObject.h:35
 TVirtualObject.h:36
 TVirtualObject.h:37
 TVirtualObject.h:38
 TVirtualObject.h:39
 TVirtualObject.h:40
 TVirtualObject.h:41
 TVirtualObject.h:42
 TVirtualObject.h:43
 TVirtualObject.h:44
 TVirtualObject.h:45
 TVirtualObject.h:46
 TVirtualObject.h:47
 TVirtualObject.h:48
 TVirtualObject.h:49