Logo ROOT  
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#include "RtypesCore.h"
28#include "TInterpreterValue.h"
29#include <string>
30#include <utility>
31
32namespace cling {
33 class Value;
34}
35
37private:
41 void* fType;
44
46 return reinterpret_cast<cling::Value&>(fValue); }
47 const cling::Value& ToCV() const {
48 return reinterpret_cast<const cling::Value&>(fValue); }
49
50public:
52 TClingValue(const TClingValue& Other);
55
56 const void* GetValAddr() const override { return &fValue; }
57 void* GetValAddr() override { return &fValue; }
58
59 std::pair<std::string, std::string> ToTypeAndValueString() const override;
60 Bool_t IsValid() const override;
61 Double_t GetAsDouble() const override;
62 Long_t GetAsLong() const override;
63 ULong_t GetAsUnsignedLong() const override;
64 void* GetAsPointer() const override;
65 std::string ToString() const override;
66};
67
68#endif // ROOT_TClingValue
bool Bool_t
Definition: RtypesCore.h:63
long Long_t
Definition: RtypesCore.h:54
double Double_t
Definition: RtypesCore.h:59
unsigned long ULong_t
Definition: RtypesCore.h:55
Bridge between cling::Value and ROOT.
Definition: TClingValue.h:36
ULong_t GetAsUnsignedLong() const override
Definition: TClingValue.cxx:76
std::pair< std::string, std::string > ToTypeAndValueString() const override
Definition: TClingValue.cxx:47
TClingValue & operator=(TClingValue &Other)
Definition: TClingValue.cxx:41
struct TClingValue::HasTheSameSizeAsClingValue fValue
Bool_t IsValid() const override
Definition: TClingValue.cxx:64
const void * GetValAddr() const override
Definition: TClingValue.h:56
void * GetAsPointer() const override
Definition: TClingValue.cxx:80
const cling::Value & ToCV() const
Definition: TClingValue.h:47
Long_t GetAsLong() const override
Definition: TClingValue.cxx:72
Double_t GetAsDouble() const override
Definition: TClingValue.cxx:68
std::string ToString() const override
Definition: TClingValue.cxx:84
cling::Value & ToCV()
Definition: TClingValue.h:45
void * GetValAddr() override
Definition: TClingValue.h:57
const char * Value
Definition: TXMLSetup.cxx:73