Logo ROOT   6.08/07
Reference Guide
TVirtualObject.h
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Philippe Canal July, 2008
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_TVirtualObject
13 #define ROOT_TVirtualObject
14 
15 /**
16 \class TVirtualObject
17 \ingroup IO
18 
19 Wrapper around an object and giving indirect access to its content
20 even if the object is not of a class in the Cint/Reflex dictionary.
21 */
22 
23 #ifndef ROOT_TClassRef
24 #include "TClassRef.h"
25 #endif
26 
27 
29 private:
30 
31  TVirtualObject(const TVirtualObject&); // not implemented
32  TVirtualObject &operator=(const TVirtualObject&); // not implemented
33 
34 public:
36  void *fObject;
37 
38  TVirtualObject(TClass *cl) : fClass(cl), fObject(cl ? cl->New() : 0) { }
39  ~TVirtualObject() { if (fClass) fClass->Destructor(fObject); }
40 
41 
42  TClass *GetClass() const { return fClass; }
43  void *GetObject() const { return fObject; }
44 
45 };
46 
47 #endif // ROOT_TVirtualObject
TClass * GetClass() const
TVirtualObject & operator=(const TVirtualObject &)
TVirtualObject(TClass *cl)
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:5071
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
Wrapper around an object and giving indirect access to its content even if the object is not of a cla...
TClassRef fClass
void * GetObject() const
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:33
TVirtualObject(const TVirtualObject &)