Logo ROOT   6.14/05
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 #include "TClassRef.h"
24 
25 
27 private:
28 
29  TVirtualObject(const TVirtualObject&); // not implemented
30  TVirtualObject &operator=(const TVirtualObject&); // not implemented
31 
32 public:
34  void *fObject;
35 
36  TVirtualObject(TClass *cl) : fClass(cl), fObject(cl ? cl->New() : 0) { }
37  ~TVirtualObject() { if (fClass) fClass->Destructor(fObject); }
38 
39 
40  TClass *GetClass() const { return fClass; }
41  void *GetObject() const { return fObject; }
42 
43 };
44 
45 #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:5149
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
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:29
TVirtualObject(const TVirtualObject &)