Logo ROOT  
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&) = delete; // not implemented
30  TVirtualObject &operator=(const TVirtualObject&) = delete; // not implemented
31 
32 public:
34  void *fObject;
35 
36  TVirtualObject(TClass *cl) : fClass(cl), fObject(cl ? cl->New() : 0) { }
38 
39 
40  TClass *GetClass() const { return fClass; }
41  void *GetObject() const { return fObject; }
42 
43 };
44 
45 #endif // ROOT_TVirtualObject
TVirtualObject
Wrapper around an object and giving indirect access to its content even if the object is not of a cla...
Definition: TVirtualObject.h:26
TVirtualObject::GetClass
TClass * GetClass() const
Definition: TVirtualObject.h:40
TVirtualObject::TVirtualObject
TVirtualObject(TClass *cl)
Definition: TVirtualObject.h:36
TVirtualObject::operator=
TVirtualObject & operator=(const TVirtualObject &)=delete
TClassRef.h
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TClass::Destructor
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:5290
TVirtualObject::~TVirtualObject
~TVirtualObject()
Definition: TVirtualObject.h:37
TVirtualObject::fClass
TClassRef fClass
Definition: TVirtualObject.h:33
TVirtualObject::GetObject
void * GetObject() const
Definition: TVirtualObject.h:41
TClassRef
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:28
TVirtualObject::TVirtualObject
TVirtualObject(const TVirtualObject &)=delete
TVirtualObject::fObject
void * fObject
Definition: TVirtualObject.h:34