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
19Wrapper around an object and giving indirect access to its content
20even if the object is not of a class in the Cint/Reflex dictionary.
21*/
22
23#include "TClassRef.h"
24
25
27private:
28
31
32public:
34 void *fObject;
35
36 TVirtualObject(TClass *cl) : fClass(cl), fObject(cl ? cl->New() : nullptr) { }
38
39
40 TClass *GetClass() const { return fClass; }
41 void *GetObject() const { return fObject; }
42
43};
44
45#endif // ROOT_TVirtualObject
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:28
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:5393
Wrapper around an object and giving indirect access to its content even if the object is not of a cla...
void * GetObject() const
TVirtualObject & operator=(const TVirtualObject &)=delete
TClassRef fClass
TVirtualObject(TClass *cl)
TVirtualObject(const TVirtualObject &)=delete
TClass * GetClass() const