Logo ROOT   6.07/09
Reference Guide
TClingValue.h
Go to the documentation of this file.
1 // @(#)root/core/meta:$Id$e
2 // Author: Vassil Vassilev 13/03/2013
3 
4 /*******************************************************************************
5  * Copyright (C) 1995-2013, 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 ////////////////////////////////////////////////////////////////////////////////
13 // //
14 // Class representing a value coming from cling. Its main use case //
15 // is to TCallFunc. When TCallFunc returns by-value, i.e. a temporary //
16 // variable, its lifetime has to be extended. TClingValue provides a //
17 // way to extend the temporaries lifetime and gives the user to control it. //
18 // //
19 // The class is used to hide the implementation details of //
20 // cling::Value. //
21 // //
22 ////////////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_TClingValue
25 #define ROOT_TClingValue
26 
27 #ifndef ROOT_Rtypes
28 #include "Rtypes.h"
29 #endif
30 #ifndef ROOT_TInterpreterValue
31 #include "TInterpreterValue.h"
32 #endif
33 
34 namespace cling {
35  class Value;
36 }
37 
39 private:
43  void* fType;
44  void* fInterpreter;
45  } fValue;
46 
48  return reinterpret_cast<cling::Value&>(fValue); }
49  const cling::Value& ToCV() const {
50  return reinterpret_cast<const cling::Value&>(fValue); }
51 
52 public:
53  TClingValue();
54  TClingValue(const TClingValue& Other);
55  TClingValue& operator=(TClingValue &Other);
56  ~TClingValue();
57 
58  const void* GetValAddr() const { return &fValue; }
59  void* GetValAddr() { return &fValue; }
60 
61  Bool_t IsValid() const;
62  Double_t GetAsDouble() const;
63  Long_t GetAsLong() const;
64  ULong_t GetAsUnsignedLong() const;
65  void* GetAsPointer() const;
66 };
67 
68 #endif // ROOT_TClingValue
const cling::Value & ToCV() const
Definition: TClingValue.h:49
bool Bool_t
Definition: RtypesCore.h:59
const void * GetValAddr() const
Definition: TClingValue.h:58
PyObject * fValue
void * GetValAddr()
Definition: TClingValue.h:59
long Long_t
Definition: RtypesCore.h:50
double Double_t
Definition: RtypesCore.h:55
Print a TSeq at the prompt:
Definition: TDatime.h:114
unsigned long ULong_t
Definition: RtypesCore.h:51
cling::Value & ToCV()
Definition: TClingValue.h:47
Bridge between cling::Value and ROOT.
Definition: TClingValue.h:38
const char * Value
Definition: TXMLSetup.cxx:73